OLD | NEW |
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/extension_toolbar_model.h" | 5 #include "chrome/browser/extensions/extension_toolbar_model.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_browser_event_router.h" | 7 #include "chrome/browser/extensions/extension_browser_event_router.h" |
8 #include "chrome/browser/extensions/extension_prefs.h" | 8 #include "chrome/browser/extensions/extension_prefs.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_tab_helper.h" |
10 #include "chrome/browser/extensions/extension_tab_util.h" | 11 #include "chrome/browser/extensions/extension_tab_util.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 15 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
15 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
18 #include "content/public/browser/notification_details.h" | 19 #include "content/public/browser/notification_details.h" |
19 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 Browser* browser, | 89 Browser* browser, |
89 GURL* popup_url_out) { | 90 GURL* popup_url_out) { |
90 TabContents* tab_contents = browser->GetActiveTabContents(); | 91 TabContents* tab_contents = browser->GetActiveTabContents(); |
91 if (!tab_contents) | 92 if (!tab_contents) |
92 return ACTION_NONE; | 93 return ACTION_NONE; |
93 | 94 |
94 int tab_id = ExtensionTabUtil::GetTabId(tab_contents->web_contents()); | 95 int tab_id = ExtensionTabUtil::GetTabId(tab_contents->web_contents()); |
95 if (tab_id < 0) | 96 if (tab_id < 0) |
96 return ACTION_NONE; | 97 return ACTION_NONE; |
97 | 98 |
| 99 tab_contents->extension_tab_helper()->active_tab_permission_manager()-> |
| 100 GrantIfRequested(extension); |
| 101 |
98 ExtensionAction* browser_action = extension->browser_action(); | 102 ExtensionAction* browser_action = extension->browser_action(); |
99 if (browser_action->HasPopup(tab_id)) { | 103 if (browser_action->HasPopup(tab_id)) { |
100 if (popup_url_out) | 104 if (popup_url_out) |
101 *popup_url_out = browser_action->GetPopupUrl(tab_id); | 105 *popup_url_out = browser_action->GetPopupUrl(tab_id); |
102 return ACTION_SHOW_POPUP; | 106 return ACTION_SHOW_POPUP; |
103 } | 107 } |
104 | 108 |
105 service_->browser_event_router()->BrowserActionExecuted( | 109 service_->browser_event_router()->BrowserActionExecuted( |
106 extension->id(), browser); | 110 extension->id(), browser); |
107 return ACTION_NONE; | 111 return ACTION_NONE; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 int incognito_index = 0, i = 0; | 288 int incognito_index = 0, i = 0; |
285 for (ExtensionList::iterator iter = begin(); iter != end(); | 289 for (ExtensionList::iterator iter = begin(); iter != end(); |
286 ++iter, ++i) { | 290 ++iter, ++i) { |
287 if (original_index == i) | 291 if (original_index == i) |
288 break; | 292 break; |
289 if (service_->IsIncognitoEnabled((*iter)->id())) | 293 if (service_->IsIncognitoEnabled((*iter)->id())) |
290 ++incognito_index; | 294 ++incognito_index; |
291 } | 295 } |
292 return incognito_index; | 296 return incognito_index; |
293 } | 297 } |
OLD | NEW |