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

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

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ToolbarActionsBar* bar) { 157 ToolbarActionsBar* bar) {
158 DCHECK(browser); 158 DCHECK(browser);
159 DCHECK(bar); 159 DCHECK(bar);
160 ScopedVector<ToolbarActionViewController> action_list; 160 ScopedVector<ToolbarActionViewController> action_list;
161 161
162 // toolbar_items() might not equate to toolbar_items_ in the case where a 162 // toolbar_items() might not equate to toolbar_items_ in the case where a
163 // subset is highlighted. 163 // subset is highlighted.
164 for (const ToolbarItem& item : toolbar_items()) 164 for (const ToolbarItem& item : toolbar_items())
165 action_list.push_back(CreateActionForItem(browser, bar, item).release()); 165 action_list.push_back(CreateActionForItem(browser, bar, item).release());
166 166
167 return action_list.Pass(); 167 return action_list;
168 } 168 }
169 169
170 scoped_ptr<ToolbarActionViewController> 170 scoped_ptr<ToolbarActionViewController>
171 ToolbarActionsModel::CreateActionForItem(Browser* browser, 171 ToolbarActionsModel::CreateActionForItem(Browser* browser,
172 ToolbarActionsBar* bar, 172 ToolbarActionsBar* bar,
173 const ToolbarItem& item) { 173 const ToolbarItem& item) {
174 scoped_ptr<ToolbarActionViewController> result; 174 scoped_ptr<ToolbarActionViewController> result;
175 switch (item.type) { 175 switch (item.type) {
176 case EXTENSION_ACTION: { 176 case EXTENSION_ACTION: {
177 // Get the extension. 177 // Get the extension.
178 const extensions::Extension* extension = GetExtensionById(item.id); 178 const extensions::Extension* extension = GetExtensionById(item.id);
179 DCHECK(extension); 179 DCHECK(extension);
180 180
181 // Create and add an ExtensionActionViewController for the extension. 181 // Create and add an ExtensionActionViewController for the extension.
182 result.reset(new ExtensionActionViewController( 182 result.reset(new ExtensionActionViewController(
183 extension, browser, 183 extension, browser,
184 extension_action_manager_->GetExtensionAction(*extension), bar)); 184 extension_action_manager_->GetExtensionAction(*extension), bar));
185 break; 185 break;
186 } 186 }
187 case COMPONENT_ACTION: { 187 case COMPONENT_ACTION: {
188 DCHECK(use_redesign_); 188 DCHECK(use_redesign_);
189 result = ComponentToolbarActionsFactory::GetInstance() 189 result = ComponentToolbarActionsFactory::GetInstance()
190 ->GetComponentToolbarActionForId(item.id, browser, bar) 190 ->GetComponentToolbarActionForId(item.id, browser, bar);
191 .Pass();
192 break; 191 break;
193 } 192 }
194 case UNKNOWN_ACTION: 193 case UNKNOWN_ACTION:
195 NOTREACHED(); // Should never have an UNKNOWN_ACTION in toolbar_items. 194 NOTREACHED(); // Should never have an UNKNOWN_ACTION in toolbar_items.
196 break; 195 break;
197 } 196 }
198 return result.Pass(); 197 return result;
199 } 198 }
200 199
201 void ToolbarActionsModel::OnExtensionActionVisibilityChanged( 200 void ToolbarActionsModel::OnExtensionActionVisibilityChanged(
202 const std::string& extension_id, 201 const std::string& extension_id,
203 bool is_now_visible) { 202 bool is_now_visible) {
204 if (use_redesign_) 203 if (use_redesign_)
205 return; 204 return;
206 const extensions::Extension* extension = GetExtensionById(extension_id); 205 const extensions::Extension* extension = GetExtensionById(extension_id);
207 if (is_now_visible) 206 if (is_now_visible)
208 AddExtension(extension); 207 AddExtension(extension);
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 return true; 791 return true;
793 } 792 }
794 } 793 }
795 return false; 794 return false;
796 } 795 }
797 796
798 const extensions::Extension* ToolbarActionsModel::GetExtensionById( 797 const extensions::Extension* ToolbarActionsModel::GetExtensionById(
799 const std::string& id) const { 798 const std::string& id) const {
800 return extension_registry_->enabled_extensions().GetByID(id); 799 return extension_registry_->enabled_extensions().GetByID(id);
801 } 800 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_actions_bar.cc ('k') | chrome/browser/ui/translate/translate_bubble_model_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698