| 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_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
| 19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 | 21 |
| 22 using extensions::Extension; | 22 using extensions::Extension; |
| 23 using extensions::ExtensionList; | 23 using extensions::ExtensionList; |
| 24 | 24 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 FOR_EACH_OBSERVER(Observer, observers_, BrowserActionMoved(extension, index)); | 81 FOR_EACH_OBSERVER(Observer, observers_, BrowserActionMoved(extension, index)); |
| 82 | 82 |
| 83 UpdatePrefs(); | 83 UpdatePrefs(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 ExtensionToolbarModel::Action ExtensionToolbarModel::ExecuteBrowserAction( | 86 ExtensionToolbarModel::Action ExtensionToolbarModel::ExecuteBrowserAction( |
| 87 const Extension* extension, | 87 const Extension* extension, |
| 88 Browser* browser, | 88 Browser* browser, |
| 89 GURL* popup_url_out) { | 89 GURL* popup_url_out) { |
| 90 TabContentsWrapper* tab_contents = browser->GetSelectedTabContentsWrapper(); | 90 TabContents* tab_contents = browser->GetActiveTabContents(); |
| 91 if (!tab_contents) | 91 if (!tab_contents) |
| 92 return ACTION_NONE; | 92 return ACTION_NONE; |
| 93 | 93 |
| 94 int tab_id = ExtensionTabUtil::GetTabId(tab_contents->web_contents()); | 94 int tab_id = ExtensionTabUtil::GetTabId(tab_contents->web_contents()); |
| 95 if (tab_id < 0) | 95 if (tab_id < 0) |
| 96 return ACTION_NONE; | 96 return ACTION_NONE; |
| 97 | 97 |
| 98 ExtensionAction* browser_action = extension->browser_action(); | 98 ExtensionAction* browser_action = extension->browser_action(); |
| 99 if (browser_action->HasPopup(tab_id)) { | 99 if (browser_action->HasPopup(tab_id)) { |
| 100 if (popup_url_out) | 100 if (popup_url_out) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 int incognito_index = 0, i = 0; | 284 int incognito_index = 0, i = 0; |
| 285 for (ExtensionList::iterator iter = begin(); iter != end(); | 285 for (ExtensionList::iterator iter = begin(); iter != end(); |
| 286 ++iter, ++i) { | 286 ++iter, ++i) { |
| 287 if (original_index == i) | 287 if (original_index == i) |
| 288 break; | 288 break; |
| 289 if (service_->IsIncognitoEnabled((*iter)->id())) | 289 if (service_->IsIncognitoEnabled((*iter)->id())) |
| 290 ++incognito_index; | 290 ++incognito_index; |
| 291 } | 291 } |
| 292 return incognito_index; | 292 return incognito_index; |
| 293 } | 293 } |
| OLD | NEW |