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

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

Issue 10535155: Hook the activeTab permission up to the omnibox, page action, and context menu APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile Created 8 years, 6 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 | Annotate | Revision Log
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_manager.h" 5 #include "chrome/browser/extensions/active_tab_permission_manager.h"
6 6
7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_system.h"
7 #include "chrome/browser/extensions/extension_tab_helper.h" 9 #include "chrome/browser/extensions/extension_tab_helper.h"
8 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents.h"
10 #include "chrome/common/chrome_notification_types.h" 12 #include "chrome/common/chrome_notification_types.h"
11 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/extensions/extension_messages.h" 14 #include "chrome/common/extensions/extension_messages.h"
13 #include "chrome/common/extensions/extension_permission_set.h" 15 #include "chrome/common/extensions/extension_permission_set.h"
14 #include "content/public/browser/navigation_entry.h" 16 #include "content/public/browser/navigation_entry.h"
15 #include "content/public/browser/notification_details.h" 17 #include "content/public/browser/notification_details.h"
16 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return; 52 return;
51 53
52 granted_.Insert(extension); 54 granted_.Insert(extension);
53 extension->SetTabSpecificHostPermissions(tab_id(), active_urls_); 55 extension->SetTabSpecificHostPermissions(tab_id(), active_urls_);
54 Send(new ExtensionMsg_UpdateTabSpecificPermissions(GetPageID(), 56 Send(new ExtensionMsg_UpdateTabSpecificPermissions(GetPageID(),
55 tab_id(), 57 tab_id(),
56 extension->id(), 58 extension->id(),
57 active_urls_)); 59 active_urls_));
58 } 60 }
59 61
62 void ActiveTabPermissionManager::GrantIfRequested(
63 const std::string& extension_id) {
64 ExtensionService* service =
65 ExtensionSystem::Get(tab_contents_->profile())->extension_service();
66 const Extension* extension = service->extensions()->GetByID(extension_id);
67 if (extension)
68 GrantIfRequested(extension);
69 }
70
60 void ActiveTabPermissionManager::DidCommitProvisionalLoadForFrame( 71 void ActiveTabPermissionManager::DidCommitProvisionalLoadForFrame(
61 int64 frame_id, 72 int64 frame_id,
62 bool is_main_frame, 73 bool is_main_frame,
63 const GURL& url, 74 const GURL& url,
64 content::PageTransition transition_type, 75 content::PageTransition transition_type,
65 content::RenderViewHost* render_view_host) { 76 content::RenderViewHost* render_view_host) {
66 if (is_main_frame) 77 if (is_main_frame)
67 ClearActiveURLsAndNotify(); 78 ClearActiveURLsAndNotify();
68 InsertActiveURL(url); 79 InsertActiveURL(url);
69 } 80 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 int32 ActiveTabPermissionManager::tab_id() { 124 int32 ActiveTabPermissionManager::tab_id() {
114 return tab_contents_->extension_tab_helper()->tab_id(); 125 return tab_contents_->extension_tab_helper()->tab_id();
115 } 126 }
116 127
117 int32 ActiveTabPermissionManager::GetPageID() { 128 int32 ActiveTabPermissionManager::GetPageID() {
118 return tab_contents_->web_contents()->GetController().GetActiveEntry()-> 129 return tab_contents_->web_contents()->GetController().GetActiveEntry()->
119 GetPageID(); 130 GetPageID();
120 } 131 }
121 132
122 } // namespace extensions 133 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/active_tab_permission_manager.h ('k') | chrome/browser/extensions/api/omnibox/omnibox_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698