Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_actions_model.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_actions_model.h ('k') | chrome/browser/ui/toolbar/toolbar_actions_model_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698