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/page_action_controller.h" | 5 #include "chrome/browser/extensions/page_action_controller.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/component_loader.h" | 8 #include "chrome/browser/extensions/component_loader.h" |
9 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
10 #include "chrome/browser/extensions/extension_action_manager.h" | 10 #include "chrome/browser/extensions/extension_action_manager.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 ExtensionService* service = GetExtensionService(); | 31 ExtensionService* service = GetExtensionService(); |
32 if (!service) | 32 if (!service) |
33 return std::vector<ExtensionAction*>(); | 33 return std::vector<ExtensionAction*>(); |
34 | 34 |
35 // Accumulate the list of all page actions to display. | 35 // Accumulate the list of all page actions to display. |
36 std::vector<ExtensionAction*> current_actions; | 36 std::vector<ExtensionAction*> current_actions; |
37 | 37 |
38 ExtensionActionManager* extension_action_manager = | 38 ExtensionActionManager* extension_action_manager = |
39 ExtensionActionManager::Get(profile()); | 39 ExtensionActionManager::Get(profile()); |
40 | 40 |
41 // The script bubble, if present, is always first. This will make it show up | |
42 // last in the omnibox. | |
43 const Extension* script_bubble = | |
44 service->component_loader()->GetScriptBubble(); | |
45 if (script_bubble) | |
46 current_actions.push_back( | |
47 extension_action_manager->GetPageAction(*script_bubble)); | |
48 | |
49 for (ExtensionSet::const_iterator i = service->extensions()->begin(); | 41 for (ExtensionSet::const_iterator i = service->extensions()->begin(); |
50 i != service->extensions()->end(); ++i) { | 42 i != service->extensions()->end(); ++i) { |
51 if (script_bubble && *i == script_bubble) | |
52 continue; | |
53 | |
54 ExtensionAction* action = extension_action_manager->GetPageAction(**i); | 43 ExtensionAction* action = extension_action_manager->GetPageAction(**i); |
55 if (action) | 44 if (action) |
56 current_actions.push_back(action); | 45 current_actions.push_back(action); |
57 } | 46 } |
58 | 47 |
59 return current_actions; | 48 return current_actions; |
60 } | 49 } |
61 | 50 |
62 LocationBarController::Action PageActionController::OnClicked( | 51 LocationBarController::Action PageActionController::OnClicked( |
63 const std::string& extension_id, int mouse_button) { | 52 const std::string& extension_id, int mouse_button) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 109 |
121 Profile* PageActionController::profile() const { | 110 Profile* PageActionController::profile() const { |
122 return Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 111 return Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
123 } | 112 } |
124 | 113 |
125 ExtensionService* PageActionController::GetExtensionService() const { | 114 ExtensionService* PageActionController::GetExtensionService() const { |
126 return ExtensionSystem::Get(profile())->extension_service(); | 115 return ExtensionSystem::Get(profile())->extension_service(); |
127 } | 116 } |
128 | 117 |
129 } // namespace extensions | 118 } // namespace extensions |
OLD | NEW |