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/browser_event_router.h" | 7 #include "chrome/browser/extensions/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/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 Browser* browser, | 108 Browser* browser, |
109 GURL* popup_url_out) { | 109 GURL* popup_url_out) { |
110 TabContents* tab_contents = chrome::GetActiveTabContents(browser); | 110 TabContents* tab_contents = chrome::GetActiveTabContents(browser); |
111 if (!tab_contents) | 111 if (!tab_contents) |
112 return ACTION_NONE; | 112 return ACTION_NONE; |
113 | 113 |
114 int tab_id = ExtensionTabUtil::GetTabId(tab_contents->web_contents()); | 114 int tab_id = ExtensionTabUtil::GetTabId(tab_contents->web_contents()); |
115 if (tab_id < 0) | 115 if (tab_id < 0) |
116 return ACTION_NONE; | 116 return ACTION_NONE; |
117 | 117 |
118 ExtensionAction* browser_action = extension->browser_action(); | 118 ExtensionAction* browser_action = GetBrowserAction(tab_contents->profile(), |
| 119 *extension); |
119 | 120 |
120 // For browser actions, visibility == enabledness. | 121 // For browser actions, visibility == enabledness. |
121 if (!browser_action->GetIsVisible(tab_id)) | 122 if (!browser_action->GetIsVisible(tab_id)) |
122 return ACTION_NONE; | 123 return ACTION_NONE; |
123 | 124 |
124 tab_contents->extension_tab_helper()->active_tab_permission_manager()-> | 125 tab_contents->extension_tab_helper()->active_tab_permission_manager()-> |
125 GrantIfRequested(extension); | 126 GrantIfRequested(extension); |
126 | 127 |
127 if (browser_action->HasPopup(tab_id)) { | 128 if (browser_action->HasPopup(tab_id)) { |
128 if (popup_url_out) | 129 if (popup_url_out) |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 for (ExtensionList::iterator iter = toolbar_items_.begin(); | 399 for (ExtensionList::iterator iter = toolbar_items_.begin(); |
399 iter != toolbar_items_.end(); | 400 iter != toolbar_items_.end(); |
400 ++iter, ++i) { | 401 ++iter, ++i) { |
401 if (original_index == i) | 402 if (original_index == i) |
402 break; | 403 break; |
403 if (service_->IsIncognitoEnabled((*iter)->id())) | 404 if (service_->IsIncognitoEnabled((*iter)->id())) |
404 ++incognito_index; | 405 ++incognito_index; |
405 } | 406 } |
406 return incognito_index; | 407 return incognito_index; |
407 } | 408 } |
OLD | NEW |