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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 rb.GetNativeImageNamed(IDR_MOBILE)); | 80 rb.GetNativeImageNamed(IDR_MOBILE)); |
81 } | 81 } |
82 | 82 |
83 ExtensionService* extension_service = | 83 ExtensionService* extension_service = |
84 extensions::ExtensionSystem::Get(browser_->profile())-> | 84 extensions::ExtensionSystem::Get(browser_->profile())-> |
85 extension_service(); | 85 extension_service(); |
86 if (extension_service) { | 86 if (extension_service) { |
87 const ExtensionSet* extensions = extension_service->extensions(); | 87 const ExtensionSet* extensions = extension_service->extensions(); |
88 for (ExtensionSet::const_iterator it = extensions->begin(); | 88 for (ExtensionSet::const_iterator it = extensions->begin(); |
89 it != extensions->end(); ++it) { | 89 it != extensions->end(); ++it) { |
90 const extensions::Extension* extension = *it; | 90 const extensions::Extension* extension = it->get(); |
91 if (ActionInfo::GetPageLauncherInfo(extension)) { | 91 if (ActionInfo::GetPageLauncherInfo(extension)) { |
92 int command_id = GetCommandIdForExtension(*extension); | 92 int command_id = GetCommandIdForExtension(*extension); |
93 menu_model->AddExtension(*extension, command_id); | 93 menu_model->AddExtension(*extension, command_id); |
94 } | 94 } |
95 } | 95 } |
96 } | 96 } |
97 return menu_model.Pass(); | 97 return menu_model.Pass(); |
98 } | 98 } |
99 | 99 |
100 void ActionBoxButtonController::OnButtonClicked() { | 100 void ActionBoxButtonController::OnButtonClicked() { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 for (ExtensionIdCommandMap::iterator it = extension_command_ids_.begin(); | 185 for (ExtensionIdCommandMap::iterator it = extension_command_ids_.begin(); |
186 it != extension_command_ids_.end();) { | 186 it != extension_command_ids_.end();) { |
187 if (it->second== extension->id()) | 187 if (it->second== extension->id()) |
188 extension_command_ids_.erase(it++); | 188 extension_command_ids_.erase(it++); |
189 else | 189 else |
190 ++it; | 190 ++it; |
191 } | 191 } |
192 // TODO(kalman): if there's a menu open, remove it from that too. | 192 // TODO(kalman): if there's a menu open, remove it from that too. |
193 // We may also want to listen to EXTENSION_LOADED to do the opposite. | 193 // We may also want to listen to EXTENSION_LOADED to do the opposite. |
194 } | 194 } |
OLD | NEW |