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

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

Issue 2803923002: [Media Router] Unload the legacy Cast extension at install (Closed)
Patch Set: Unload instead of uninstall Created 3 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
« no previous file with comments | « chrome/browser/ui/toolbar/component_toolbar_actions_factory_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // Wait until the extension system is ready before observing any further 264 // Wait until the extension system is ready before observing any further
265 // changes so that the toolbar buttons can be shown in their stable ordering 265 // changes so that the toolbar buttons can be shown in their stable ordering
266 // taken from prefs. 266 // taken from prefs.
267 extension_registry_observer_.Add(extension_registry_); 267 extension_registry_observer_.Add(extension_registry_);
268 extension_action_observer_.Add(extension_action_api_); 268 extension_action_observer_.Add(extension_action_api_);
269 269
270 actions_initialized_ = true; 270 actions_initialized_ = true;
271 for (Observer& observer : observers_) 271 for (Observer& observer : observers_)
272 observer.OnToolbarModelInitialized(); 272 observer.OnToolbarModelInitialized();
273 273
274 if (use_redesign_) { 274 if (use_redesign_)
275 component_actions_factory_->UnloadMigratedExtensions( 275 component_actions_factory_->UnloadMigratedExtensions();
276 extensions::ExtensionSystem::Get(profile_)->extension_service(),
277 extension_registry_);
278 }
279 } 276 }
280 277
281 size_t ToolbarActionsModel::FindNewPositionFromLastKnownGood( 278 size_t ToolbarActionsModel::FindNewPositionFromLastKnownGood(
282 const ToolbarItem& action) { 279 const ToolbarItem& action) {
283 // See if we have last known good position for this action. 280 // See if we have last known good position for this action.
284 size_t new_index = 0; 281 size_t new_index = 0;
285 // Loop through the ID list of known positions, to count the number of 282 // Loop through the ID list of known positions, to count the number of
286 // visible action icons preceding |action|'s id. 283 // visible action icons preceding |action|'s id.
287 for (const std::string& last_pos_id : last_known_positions_) { 284 for (const std::string& last_pos_id : last_known_positions_) {
288 if (last_pos_id == action.id) 285 if (last_pos_id == action.id)
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 return extension_registry_->enabled_extensions().GetByID(id); 858 return extension_registry_->enabled_extensions().GetByID(id);
862 } 859 }
863 860
864 bool ToolbarActionsModel::IsActionVisible(const std::string& action_id) const { 861 bool ToolbarActionsModel::IsActionVisible(const std::string& action_id) const {
865 size_t index = 0u; 862 size_t index = 0u;
866 while (toolbar_items().size() > index && 863 while (toolbar_items().size() > index &&
867 toolbar_items()[index].id != action_id) 864 toolbar_items()[index].id != action_id)
868 ++index; 865 ++index;
869 return index < visible_icon_count(); 866 return index < visible_icon_count();
870 } 867 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/component_toolbar_actions_factory_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698