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

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

Issue 10703090: Turn pageAction.show -> browserAction.sensibleThing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: views (incomplete) Created 8 years, 5 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/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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 Browser* browser, 89 Browser* browser,
90 GURL* popup_url_out) { 90 GURL* popup_url_out) {
91 TabContents* tab_contents = browser->GetActiveTabContents(); 91 TabContents* tab_contents = browser->GetActiveTabContents();
92 if (!tab_contents) 92 if (!tab_contents)
93 return ACTION_NONE; 93 return ACTION_NONE;
94 94
95 int tab_id = ExtensionTabUtil::GetTabId(tab_contents->web_contents()); 95 int tab_id = ExtensionTabUtil::GetTabId(tab_contents->web_contents());
96 if (tab_id < 0) 96 if (tab_id < 0)
97 return ACTION_NONE; 97 return ACTION_NONE;
98 98
99 ExtensionAction* browser_action = extension->browser_action();
100
101 // For browser actions, visibility == enabledness.
102 if (!browser_action->GetIsVisible(tab_id))
103 return ACTION_NONE;
104
99 tab_contents->extension_tab_helper()->active_tab_permission_manager()-> 105 tab_contents->extension_tab_helper()->active_tab_permission_manager()->
100 GrantIfRequested(extension); 106 GrantIfRequested(extension);
101 107
102 ExtensionAction* browser_action = extension->browser_action();
103 if (browser_action->HasPopup(tab_id)) { 108 if (browser_action->HasPopup(tab_id)) {
104 if (popup_url_out) 109 if (popup_url_out)
105 *popup_url_out = browser_action->GetPopupUrl(tab_id); 110 *popup_url_out = browser_action->GetPopupUrl(tab_id);
106 return ACTION_SHOW_POPUP; 111 return ACTION_SHOW_POPUP;
107 } 112 }
108 113
109 service_->browser_event_router()->BrowserActionExecuted( 114 service_->browser_event_router()->BrowserActionExecuted(
110 *browser_action, browser); 115 *browser_action, browser);
111 return ACTION_NONE; 116 return ACTION_NONE;
112 } 117 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 int incognito_index = 0, i = 0; 293 int incognito_index = 0, i = 0;
289 for (ExtensionList::iterator iter = begin(); iter != end(); 294 for (ExtensionList::iterator iter = begin(); iter != end();
290 ++iter, ++i) { 295 ++iter, ++i) {
291 if (original_index == i) 296 if (original_index == i)
292 break; 297 break;
293 if (service_->IsIncognitoEnabled((*iter)->id())) 298 if (service_->IsIncognitoEnabled((*iter)->id()))
294 ++incognito_index; 299 ++incognito_index;
295 } 300 }
296 return incognito_index; 301 return incognito_index;
297 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698