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

Side by Side Diff: chrome/browser/extensions/active_tab_permission_granter.cc

Issue 51433002: Enable permission warnings from ManifestHandlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing. Created 7 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
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/extensions/active_tab_permission_granter.h" 5 #include "chrome/browser/extensions/active_tab_permission_granter.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 new_apis.insert(APIPermission::kTab); 53 new_apis.insert(APIPermission::kTab);
54 } 54 }
55 55
56 if (extension->HasAPIPermission(APIPermission::kTabCapture)) 56 if (extension->HasAPIPermission(APIPermission::kTabCapture))
57 new_apis.insert(APIPermission::kTabCaptureForTab); 57 new_apis.insert(APIPermission::kTabCaptureForTab);
58 58
59 if (!new_apis.empty() || !new_hosts.is_empty()) { 59 if (!new_apis.empty() || !new_hosts.is_empty()) {
60 granted_extensions_.Insert(extension); 60 granted_extensions_.Insert(extension);
61 scoped_refptr<const PermissionSet> new_permissions = 61 scoped_refptr<const PermissionSet> new_permissions =
62 new PermissionSet(new_apis, new_hosts, URLPatternSet()); 62 new PermissionSet(new_apis, ManifestPermissionSet(),
63 new_hosts, URLPatternSet());
63 PermissionsData::UpdateTabSpecificPermissions(extension, 64 PermissionsData::UpdateTabSpecificPermissions(extension,
64 tab_id_, 65 tab_id_,
65 new_permissions); 66 new_permissions);
66 const content::NavigationEntry* navigation_entry = 67 const content::NavigationEntry* navigation_entry =
67 web_contents()->GetController().GetVisibleEntry(); 68 web_contents()->GetController().GetVisibleEntry();
68 if (navigation_entry) { 69 if (navigation_entry) {
69 Send(new ExtensionMsg_UpdateTabSpecificPermissions( 70 Send(new ExtensionMsg_UpdateTabSpecificPermissions(
70 navigation_entry->GetPageID(), 71 navigation_entry->GetPageID(),
71 tab_id_, 72 tab_id_,
72 extension->id(), 73 extension->id(),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 it != granted_extensions_.end(); ++it) { 112 it != granted_extensions_.end(); ++it) {
112 PermissionsData::ClearTabSpecificPermissions(it->get(), tab_id_); 113 PermissionsData::ClearTabSpecificPermissions(it->get(), tab_id_);
113 extension_ids.push_back((*it)->id()); 114 extension_ids.push_back((*it)->id());
114 } 115 }
115 116
116 Send(new ExtensionMsg_ClearTabSpecificPermissions(tab_id_, extension_ids)); 117 Send(new ExtensionMsg_ClearTabSpecificPermissions(tab_id_, extension_ids));
117 granted_extensions_.Clear(); 118 granted_extensions_.Clear();
118 } 119 }
119 120
120 } // namespace extensions 121 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698