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

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

Issue 10649003: Move each permission classes to its own files in extensions/permissions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase on HEAD Created 8 years, 5 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
44 #include "ui/base/l10n/l10n_util.h" 44 #include "ui/base/l10n/l10n_util.h"
45 #include "ui/base/resource/resource_bundle.h" 45 #include "ui/base/resource/resource_bundle.h"
46 46
47 using WebKit::WebSecurityOrigin; 47 using WebKit::WebSecurityOrigin;
48 using content::BrowserThread; 48 using content::BrowserThread;
49 using content::NavigationEntry; 49 using content::NavigationEntry;
50 using content::OpenURLParams; 50 using content::OpenURLParams;
51 using content::Referrer; 51 using content::Referrer;
52 using content::WebContents; 52 using content::WebContents;
53 using extensions::APIPermission;
53 54
54 // GeolocationInfoBarQueueController ------------------------------------------ 55 // GeolocationInfoBarQueueController ------------------------------------------
55 56
56 // This class controls the geolocation infobar queue per profile, and it's an 57 // This class controls the geolocation infobar queue per profile, and it's an
57 // internal class to GeolocationPermissionContext. 58 // internal class to GeolocationPermissionContext.
58 // An alternate approach would be to have this queue per tab, and use 59 // An alternate approach would be to have this queue per tab, and use
59 // notifications to broadcast when permission is set / listen to notification to 60 // notifications to broadcast when permission is set / listen to notification to
60 // cancel pending requests. This may be specially useful if there are other 61 // cancel pending requests. This may be specially useful if there are other
61 // things listening for such notifications. 62 // things listening for such notifications.
62 // For the time being this class is self-contained and it doesn't seem pulling 63 // For the time being this class is self-contained and it doesn't seem pulling
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 607
607 ExtensionService* extension_service = profile_->GetExtensionService(); 608 ExtensionService* extension_service = profile_->GetExtensionService();
608 if (extension_service) { 609 if (extension_service) {
609 const extensions::Extension* extension = 610 const extensions::Extension* extension =
610 extension_service->extensions()->GetExtensionOrAppByURL( 611 extension_service->extensions()->GetExtensionOrAppByURL(
611 ExtensionURLInfo( 612 ExtensionURLInfo(
612 WebSecurityOrigin::createFromString( 613 WebSecurityOrigin::createFromString(
613 UTF8ToUTF16(requesting_frame.spec())), 614 UTF8ToUTF16(requesting_frame.spec())),
614 requesting_frame)); 615 requesting_frame));
615 if (extension && 616 if (extension &&
616 extension->HasAPIPermission(ExtensionAPIPermission::kGeolocation)) { 617 extension->HasAPIPermission(APIPermission::kGeolocation)) {
617 // Make sure the extension is in the calling process. 618 // Make sure the extension is in the calling process.
618 if (extension_service->process_map()->Contains( 619 if (extension_service->process_map()->Contains(
619 extension->id(), render_process_id)) { 620 extension->id(), render_process_id)) {
620 NotifyPermissionSet(render_process_id, render_view_id, bridge_id, 621 NotifyPermissionSet(render_process_id, render_view_id, bridge_id,
621 requesting_frame, callback, true); 622 requesting_frame, callback, true);
622 return; 623 return;
623 } 624 }
624 } 625 }
625 } 626 }
626 627
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 BrowserThread::UI, FROM_HERE, 706 BrowserThread::UI, FROM_HERE,
706 base::Bind( 707 base::Bind(
707 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, 708 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest,
708 this, render_process_id, render_view_id, bridge_id)); 709 this, render_process_id, render_view_id, bridge_id));
709 return; 710 return;
710 } 711 }
711 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 712 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
712 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, 713 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id,
713 render_view_id, bridge_id); 714 render_view_id, bridge_id);
714 } 715 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698