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/extension_browser_event_router.h" | 7 #include "chrome/browser/extensions/extension_browser_event_router.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
10 #include "chrome/browser/extensions/extension_tab_helper.h" | 10 #include "chrome/browser/extensions/extension_tab_helper.h" |
11 #include "chrome/browser/extensions/extension_tab_util.h" | 11 #include "chrome/browser/extensions/extension_tab_util.h" |
12 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
13 #include "chrome/common/extensions/extension_set.h" | 13 #include "chrome/common/extensions/extension_set.h" |
14 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
15 #include "content/public/browser/invalidate_type.h" | 15 #include "content/public/browser/invalidate_type.h" |
16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
18 | 18 |
19 namespace extensions { | 19 namespace extensions { |
20 | 20 |
21 PageActionController::PageActionController(TabContents* tab_contents) | 21 PageActionController::PageActionController(TabContents* tab_contents) |
22 : tab_contents_(tab_contents) {} | 22 : tab_contents_(tab_contents) {} |
23 | 23 |
24 PageActionController::~PageActionController() {} | 24 PageActionController::~PageActionController() {} |
25 | 25 |
26 std::vector<ExtensionAction*> PageActionController::GetCurrentActions() { | 26 std::vector<ExtensionAction*> PageActionController::GetCurrentActions() const { |
27 ExtensionService* service = GetExtensionService(); | 27 ExtensionService* service = GetExtensionService(); |
28 if (!service) | 28 if (!service) |
29 return std::vector<ExtensionAction*>(); | 29 return std::vector<ExtensionAction*>(); |
30 | 30 |
31 std::vector<ExtensionAction*> current_actions; | 31 std::vector<ExtensionAction*> current_actions; |
32 | 32 |
33 for (ExtensionSet::const_iterator i = service->extensions()->begin(); | 33 for (ExtensionSet::const_iterator i = service->extensions()->begin(); |
34 i != service->extensions()->end(); ++i) { | 34 i != service->extensions()->end(); ++i) { |
35 ExtensionAction* action = (*i)->page_action(); | 35 ExtensionAction* action = (*i)->page_action(); |
36 if (action) | 36 if (action) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 return ACTION_NONE; | 76 return ACTION_NONE; |
77 } | 77 } |
78 | 78 |
79 void PageActionController::NotifyChange() { | 79 void PageActionController::NotifyChange() { |
80 tab_contents_->web_contents()->NotifyNavigationStateChanged( | 80 tab_contents_->web_contents()->NotifyNavigationStateChanged( |
81 content::INVALIDATE_TYPE_PAGE_ACTIONS); | 81 content::INVALIDATE_TYPE_PAGE_ACTIONS); |
82 } | 82 } |
83 | 83 |
84 ExtensionService* PageActionController::GetExtensionService() { | 84 ExtensionService* PageActionController::GetExtensionService() const { |
85 return ExtensionSystem::Get(tab_contents_->profile())->extension_service(); | 85 return ExtensionSystem::Get(tab_contents_->profile())->extension_service(); |
86 } | 86 } |
87 | 87 |
88 } // namespace extensions | 88 } // namespace extensions |
OLD | NEW |