Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/browser/geolocation/chrome_geolocation_permission_context.cc

Issue 8587001: Have ExtensionHost use TabContents instead of RenderViewHost. Try #3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" 5 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
6 6
7 #include <functional> 7 #include <functional>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 const Extension* ext = extensions->GetExtensionByURL(requesting_frame); 529 const Extension* ext = extensions->GetExtensionByURL(requesting_frame);
530 if (!ext) 530 if (!ext)
531 ext = extensions->GetExtensionByWebExtent(requesting_frame); 531 ext = extensions->GetExtensionByWebExtent(requesting_frame);
532 if (ext && ext->HasAPIPermission(ExtensionAPIPermission::kGeolocation)) { 532 if (ext && ext->HasAPIPermission(ExtensionAPIPermission::kGeolocation)) {
533 // Make sure the extension is in the calling process. 533 // Make sure the extension is in the calling process.
534 if (extensions->process_map()->Contains(ext->id(), render_process_id)) { 534 if (extensions->process_map()->Contains(ext->id(), render_process_id)) {
535 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, 535 NotifyPermissionSet(render_process_id, render_view_id, bridge_id,
536 requesting_frame, true); 536 requesting_frame, true);
537 return; 537 return;
538 } 538 }
539 } 539 }
joth 2011/11/17 09:45:12 I just recalled a question from a previous review
Matt Perry 2011/11/17 20:08:04 That I don't know. I tried to preserve the code as
540 } 540 }
541 541
542 TabContents* tab_contents = 542 TabContents* tab_contents =
543 tab_util::GetTabContentsByID(render_process_id, render_view_id); 543 tab_util::GetTabContentsByID(render_process_id, render_view_id);
544 if (!tab_contents) { 544 if (!tab_contents ||
545 tab_contents->GetRenderViewType() != content::VIEW_TYPE_TAB_CONTENTS) {
Matt Perry 2011/11/16 21:44:10 This fixes the geolocation bug I mentioned.
Aaron Boodman 2011/11/16 23:29:24 This seems like it could be a breaking change. I v
Matt Perry 2011/11/16 23:36:32 That's handled by the block above - we only reach
Aaron Boodman 2011/11/16 23:42:23 Right, what I mean is that I worry that before it
Matt Perry 2011/11/16 23:46:06 I see. There was a test that broke without this ch
545 // The tab may have gone away, or the request may not be from a tab at all. 546 // The tab may have gone away, or the request may not be from a tab at all.
547 // TODO(mpcomplete): the request could be from a background page or
548 // extension popup (tab_contents will have a different ViewType). But why do
549 // we care? Shouldn't we still put an infobar up in the current tab?
joth 2011/11/17 08:58:33 I don't quite understand this last question: are y
Matt Perry 2011/11/17 20:08:04 Thanks, your explanation answers my question. On
546 LOG(WARNING) << "Attempt to use geolocation tabless renderer: " 550 LOG(WARNING) << "Attempt to use geolocation tabless renderer: "
547 << render_process_id << "," << render_view_id << "," 551 << render_process_id << "," << render_view_id << ","
548 << bridge_id << " (can't prompt user without a visible tab)"; 552 << bridge_id << " (can't prompt user without a visible tab)";
joth 2011/11/17 08:58:33 assuming this warning is useful, it would be as we
549 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, 553 NotifyPermissionSet(render_process_id, render_view_id, bridge_id,
550 requesting_frame, false); 554 requesting_frame, false);
551 return; 555 return;
552 } 556 }
553 557
554 GURL embedder = tab_contents->GetURL(); 558 GURL embedder = tab_contents->GetURL();
555 if (!requesting_frame.is_valid() || !embedder.is_valid()) { 559 if (!requesting_frame.is_valid() || !embedder.is_valid()) {
556 LOG(WARNING) << "Attempt to use geolocation from an invalid URL: " 560 LOG(WARNING) << "Attempt to use geolocation from an invalid URL: "
557 << requesting_frame << "," << embedder 561 << requesting_frame << "," << embedder
558 << " (geolocation is not supported in popups)"; 562 << " (geolocation is not supported in popups)";
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 BrowserThread::UI, FROM_HERE, 635 BrowserThread::UI, FROM_HERE,
632 base::Bind( 636 base::Bind(
633 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, 637 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest,
634 this, render_process_id, render_view_id, bridge_id)); 638 this, render_process_id, render_view_id, bridge_id));
635 return; 639 return;
636 } 640 }
637 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 641 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
638 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, 642 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id,
639 render_view_id, bridge_id); 643 render_view_id, bridge_id);
640 } 644 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698