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/ui/toolbar/action_box_button_controller.h" | 5 #include "chrome/browser/ui/toolbar/action_box_button_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 extensions::ExtensionSystem::Get(browser_->profile())-> | 81 extensions::ExtensionSystem::Get(browser_->profile())-> |
82 extension_service(); | 82 extension_service(); |
83 if (!browser_->profile()->IsOffTheRecord()) { | 83 if (!browser_->profile()->IsOffTheRecord()) { |
84 int next_share_intent_command_id = SHARE_COMMAND_FIRST; | 84 int next_share_intent_command_id = SHARE_COMMAND_FIRST; |
85 share_intent_service_ids_.clear(); | 85 share_intent_service_ids_.clear(); |
86 const ExtensionSet* extension_set = extension_service->extensions(); | 86 const ExtensionSet* extension_set = extension_service->extensions(); |
87 WebIntentsRegistry* intents_registry = | 87 WebIntentsRegistry* intents_registry = |
88 WebIntentsRegistryFactory::GetForProfile(browser_->profile()); | 88 WebIntentsRegistryFactory::GetForProfile(browser_->profile()); |
89 for (ExtensionSet::const_iterator it = extension_set->begin(); | 89 for (ExtensionSet::const_iterator it = extension_set->begin(); |
90 it != extension_set->end(); ++it) { | 90 it != extension_set->end(); ++it) { |
91 const extensions::Extension* extension = *it; | 91 const extensions::Extension* extension = *it.get(); |
92 WebIntentsRegistry::IntentServiceList services; | 92 WebIntentsRegistry::IntentServiceList services; |
93 intents_registry->GetIntentServicesForExtensionFilter( | 93 intents_registry->GetIntentServicesForExtensionFilter( |
94 ASCIIToUTF16(kShareIntentAction), | 94 ASCIIToUTF16(kShareIntentAction), |
95 ASCIIToUTF16(kShareIntentMimeType), | 95 ASCIIToUTF16(kShareIntentMimeType), |
96 extension->id(), | 96 extension->id(), |
97 &services); | 97 &services); |
98 if (!services.empty()) { | 98 if (!services.empty()) { |
99 int command_id = next_share_intent_command_id++; | 99 int command_id = next_share_intent_command_id++; |
100 if (command_id > SHARE_COMMAND_LAST) | 100 if (command_id > SHARE_COMMAND_LAST) |
101 break; | 101 break; |
(...skipping 18 matching lines...) Expand all Loading... |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 // Add Extensions. | 123 // Add Extensions. |
124 next_extension_command_id_ = EXTENSION_COMMAND_FIRST; | 124 next_extension_command_id_ = EXTENSION_COMMAND_FIRST; |
125 extension_command_ids_.clear(); | 125 extension_command_ids_.clear(); |
126 const extensions::ExtensionList& extensions = | 126 const extensions::ExtensionList& extensions = |
127 extension_service->toolbar_model()->action_box_menu_items(); | 127 extension_service->toolbar_model()->action_box_menu_items(); |
128 for (extensions::ExtensionList::const_iterator it = extensions.begin(); | 128 for (extensions::ExtensionList::const_iterator it = extensions.begin(); |
129 it != extensions.end(); ++it) { | 129 it != extensions.end(); ++it) { |
130 menu_model->AddExtension(**it, GetCommandIdForExtension(**it)); | 130 menu_model->AddExtension(**it.get(), GetCommandIdForExtension(**it.get())); |
131 } | 131 } |
132 | 132 |
133 // And show the menu. | 133 // And show the menu. |
134 delegate_->ShowMenu(menu_model.Pass()); | 134 delegate_->ShowMenu(menu_model.Pass()); |
135 } | 135 } |
136 | 136 |
137 bool ActionBoxButtonController::IsCommandIdChecked(int command_id) const { | 137 bool ActionBoxButtonController::IsCommandIdChecked(int command_id) const { |
138 return false; | 138 return false; |
139 } | 139 } |
140 | 140 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 kShareIntentAction, | 240 kShareIntentAction, |
241 kShareIntentMimeType); | 241 kShareIntentMimeType); |
242 chrome::NavigateParams params(browser_->profile(), query_url, | 242 chrome::NavigateParams params(browser_->profile(), query_url, |
243 content::PAGE_TRANSITION_LINK); | 243 content::PAGE_TRANSITION_LINK); |
244 params.disposition = NEW_FOREGROUND_TAB; | 244 params.disposition = NEW_FOREGROUND_TAB; |
245 chrome::Navigate(¶ms); | 245 chrome::Navigate(¶ms); |
246 | 246 |
247 content::RecordAction(UserMetricsAction("ActionBox.FindShareHandlers")); | 247 content::RecordAction(UserMetricsAction("ActionBox.FindShareHandlers")); |
248 send_uma_share_command_count = true; | 248 send_uma_share_command_count = true; |
249 } | 249 } |
OLD | NEW |