| 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/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 8 #include "chrome/browser/extensions/extension_browser_event_router.h" | 8 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 new std::vector<ExtensionAction*>()); | 28 new std::vector<ExtensionAction*>()); |
| 29 for (ExtensionSet::const_iterator i = extensions->begin(); | 29 for (ExtensionSet::const_iterator i = extensions->begin(); |
| 30 i != extensions->end(); ++i) { | 30 i != extensions->end(); ++i) { |
| 31 ExtensionAction* action = (*i)->page_action(); | 31 ExtensionAction* action = (*i)->page_action(); |
| 32 if (action) | 32 if (action) |
| 33 current_actions->push_back(action); | 33 current_actions->push_back(action); |
| 34 } | 34 } |
| 35 return current_actions.Pass(); | 35 return current_actions.Pass(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 ActionBoxController::Action PageActionController::OnClicked( | 38 LocationBarController::Action PageActionController::OnClicked( |
| 39 const std::string& extension_id, int mouse_button) { | 39 const std::string& extension_id, int mouse_button) { |
| 40 const Extension* extension = | 40 const Extension* extension = |
| 41 GetExtensionService()->extensions()->GetByID(extension_id); | 41 GetExtensionService()->extensions()->GetByID(extension_id); |
| 42 CHECK(extension); | 42 CHECK(extension); |
| 43 ExtensionAction* page_action = extension->page_action(); | 43 ExtensionAction* page_action = extension->page_action(); |
| 44 CHECK(page_action); | 44 CHECK(page_action); |
| 45 int tab_id = ExtensionTabUtil::GetTabId(tab_contents_->web_contents()); | 45 int tab_id = ExtensionTabUtil::GetTabId(tab_contents_->web_contents()); |
| 46 | 46 |
| 47 switch (mouse_button) { | 47 switch (mouse_button) { |
| 48 case 1: // left | 48 case 1: // left |
| (...skipping 16 matching lines...) Expand all Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 return ACTION_NONE; | 67 return ACTION_NONE; |
| 68 } | 68 } |
| 69 | 69 |
| 70 ExtensionService* PageActionController::GetExtensionService() { | 70 ExtensionService* PageActionController::GetExtensionService() { |
| 71 return ExtensionSystem::Get(tab_contents_->profile())->extension_service(); | 71 return ExtensionSystem::Get(tab_contents_->profile())->extension_service(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace extensions | 74 } // namespace extensions |
| OLD | NEW |