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/toolbar_actions_model.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 ScopedVector<ToolbarActionViewController> action_list; | 165 ScopedVector<ToolbarActionViewController> action_list; |
166 | 166 |
167 // toolbar_items() might not equate to toolbar_items_ in the case where a | 167 // toolbar_items() might not equate to toolbar_items_ in the case where a |
168 // subset is highlighted. | 168 // subset is highlighted. |
169 for (const ToolbarItem& item : toolbar_items()) | 169 for (const ToolbarItem& item : toolbar_items()) |
170 action_list.push_back(CreateActionForItem(browser, bar, item).release()); | 170 action_list.push_back(CreateActionForItem(browser, bar, item).release()); |
171 | 171 |
172 return action_list; | 172 return action_list; |
173 } | 173 } |
174 | 174 |
175 scoped_ptr<ToolbarActionViewController> | 175 std::unique_ptr<ToolbarActionViewController> |
176 ToolbarActionsModel::CreateActionForItem(Browser* browser, | 176 ToolbarActionsModel::CreateActionForItem(Browser* browser, |
177 ToolbarActionsBar* bar, | 177 ToolbarActionsBar* bar, |
178 const ToolbarItem& item) { | 178 const ToolbarItem& item) { |
179 scoped_ptr<ToolbarActionViewController> result; | 179 std::unique_ptr<ToolbarActionViewController> result; |
180 switch (item.type) { | 180 switch (item.type) { |
181 case EXTENSION_ACTION: { | 181 case EXTENSION_ACTION: { |
182 // Get the extension. | 182 // Get the extension. |
183 const extensions::Extension* extension = GetExtensionById(item.id); | 183 const extensions::Extension* extension = GetExtensionById(item.id); |
184 DCHECK(extension); | 184 DCHECK(extension); |
185 | 185 |
186 // Create and add an ExtensionActionViewController for the extension. | 186 // Create and add an ExtensionActionViewController for the extension. |
187 result.reset(new ExtensionActionViewController( | 187 result.reset(new ExtensionActionViewController( |
188 extension, browser, | 188 extension, browser, |
189 extension_action_manager_->GetExtensionAction(*extension), bar)); | 189 extension_action_manager_->GetExtensionAction(*extension), bar)); |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 return true; | 809 return true; |
810 } | 810 } |
811 } | 811 } |
812 return false; | 812 return false; |
813 } | 813 } |
814 | 814 |
815 const extensions::Extension* ToolbarActionsModel::GetExtensionById( | 815 const extensions::Extension* ToolbarActionsModel::GetExtensionById( |
816 const std::string& id) const { | 816 const std::string& id) const { |
817 return extension_registry_->enabled_extensions().GetByID(id); | 817 return extension_registry_->enabled_extensions().GetByID(id); |
818 } | 818 } |
OLD | NEW |