| 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_helper.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 Browser* browser, | 90 Browser* browser, |
| 91 GURL* popup_url_out) { | 91 GURL* popup_url_out) { |
| 92 TabContents* tab_contents = chrome::GetActiveTabContents(browser); | 92 TabContents* tab_contents = chrome::GetActiveTabContents(browser); |
| 93 if (!tab_contents) | 93 if (!tab_contents) |
| 94 return ACTION_NONE; | 94 return ACTION_NONE; |
| 95 | 95 |
| 96 int tab_id = ExtensionTabUtil::GetTabId(tab_contents->web_contents()); | 96 int tab_id = ExtensionTabUtil::GetTabId(tab_contents->web_contents()); |
| 97 if (tab_id < 0) | 97 if (tab_id < 0) |
| 98 return ACTION_NONE; | 98 return ACTION_NONE; |
| 99 | 99 |
| 100 ExtensionAction* browser_action = extension->browser_action(); |
| 101 |
| 102 // For browser actions, visibility == enabledness. |
| 103 if (!browser_action->GetIsVisible(tab_id)) |
| 104 return ACTION_NONE; |
| 105 |
| 100 tab_contents->extension_tab_helper()->active_tab_permission_manager()-> | 106 tab_contents->extension_tab_helper()->active_tab_permission_manager()-> |
| 101 GrantIfRequested(extension); | 107 GrantIfRequested(extension); |
| 102 | 108 |
| 103 ExtensionAction* browser_action = extension->browser_action(); | |
| 104 if (browser_action->HasPopup(tab_id)) { | 109 if (browser_action->HasPopup(tab_id)) { |
| 105 if (popup_url_out) | 110 if (popup_url_out) |
| 106 *popup_url_out = browser_action->GetPopupUrl(tab_id); | 111 *popup_url_out = browser_action->GetPopupUrl(tab_id); |
| 107 return ACTION_SHOW_POPUP; | 112 return ACTION_SHOW_POPUP; |
| 108 } | 113 } |
| 109 | 114 |
| 110 service_->browser_event_router()->BrowserActionExecuted( | 115 service_->browser_event_router()->BrowserActionExecuted( |
| 111 *browser_action, browser); | 116 *browser_action, browser); |
| 112 return ACTION_NONE; | 117 return ACTION_NONE; |
| 113 } | 118 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 int incognito_index = 0, i = 0; | 294 int incognito_index = 0, i = 0; |
| 290 for (ExtensionList::iterator iter = begin(); iter != end(); | 295 for (ExtensionList::iterator iter = begin(); iter != end(); |
| 291 ++iter, ++i) { | 296 ++iter, ++i) { |
| 292 if (original_index == i) | 297 if (original_index == i) |
| 293 break; | 298 break; |
| 294 if (service_->IsIncognitoEnabled((*iter)->id())) | 299 if (service_->IsIncognitoEnabled((*iter)->id())) |
| 295 ++incognito_index; | 300 ++incognito_index; |
| 296 } | 301 } |
| 297 return incognito_index; | 302 return incognito_index; |
| 298 } | 303 } |
| OLD | NEW |