OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/location_bar_controller.h" | 5 #include "chrome/browser/extensions/location_bar_controller.h" |
6 | 6 |
7 #include "chrome/browser/extensions/active_script_controller.h" | 7 #include "chrome/browser/extensions/active_script_controller.h" |
8 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 8 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
9 #include "chrome/browser/extensions/extension_action_manager.h" | 9 #include "chrome/browser/extensions/extension_action_manager.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 ActiveScriptController* active_script_controller = | 38 ActiveScriptController* active_script_controller = |
39 ActiveScriptController::GetForWebContents(web_contents_); | 39 ActiveScriptController::GetForWebContents(web_contents_); |
40 for (ExtensionSet::const_iterator iter = extensions.begin(); | 40 for (ExtensionSet::const_iterator iter = extensions.begin(); |
41 iter != extensions.end(); | 41 iter != extensions.end(); |
42 ++iter) { | 42 ++iter) { |
43 // Right now, we can consolidate these actions because we only want to show | 43 // Right now, we can consolidate these actions because we only want to show |
44 // one action per extension. If clicking on an active script action ever | 44 // one action per extension. If clicking on an active script action ever |
45 // has a response, then we will need to split the actions. | 45 // has a response, then we will need to split the actions. |
46 ExtensionAction* action = action_manager_->GetPageAction(**iter); | 46 ExtensionAction* action = action_manager_->GetPageAction(**iter); |
47 if (!action && active_script_controller->WantsToRun(*iter)) { | 47 if (!action && active_script_controller->WantsToRun(iter->get())) { |
48 ExtensionActionMap::iterator existing = | 48 ExtensionActionMap::iterator existing = |
49 active_script_actions_.find((*iter)->id()); | 49 active_script_actions_.find((*iter)->id()); |
50 if (existing != active_script_actions_.end()) { | 50 if (existing != active_script_actions_.end()) { |
51 action = existing->second.get(); | 51 action = existing->second.get(); |
52 } else { | 52 } else { |
53 linked_ptr<ExtensionAction> active_script_action( | 53 linked_ptr<ExtensionAction> active_script_action( |
54 ExtensionActionManager::Get(browser_context_)-> | 54 ExtensionActionManager::Get(browser_context_)-> |
55 GetBestFitAction(**iter, ActionInfo::TYPE_PAGE).release()); | 55 GetBestFitAction(**iter, ActionInfo::TYPE_PAGE).release()); |
56 active_script_action->SetIsVisible( | 56 active_script_action->SetIsVisible( |
57 ExtensionAction::kDefaultTabId, true); | 57 ExtensionAction::kDefaultTabId, true); |
(...skipping 22 matching lines...) Expand all Loading... |
80 content::BrowserContext* browser_context, | 80 content::BrowserContext* browser_context, |
81 const Extension* extension, | 81 const Extension* extension, |
82 UnloadedExtensionInfo::Reason reason) { | 82 UnloadedExtensionInfo::Reason reason) { |
83 if (action_manager_->GetPageAction(*extension)) { | 83 if (action_manager_->GetPageAction(*extension)) { |
84 ExtensionActionAPI::Get(browser_context)-> | 84 ExtensionActionAPI::Get(browser_context)-> |
85 NotifyPageActionsChanged(web_contents_); | 85 NotifyPageActionsChanged(web_contents_); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 } // namespace extensions | 89 } // namespace extensions |
OLD | NEW |