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

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

Issue 2693063003: Unload old Cast extensions after initializing ToolbarActionsModel (Closed)
Patch Set: Remove virtual, rebase Created 3 years, 10 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 InitializeActionList(); 261 InitializeActionList();
262 // Wait until the extension system is ready before observing any further 262 // Wait until the extension system is ready before observing any further
263 // changes so that the toolbar buttons can be shown in their stable ordering 263 // changes so that the toolbar buttons can be shown in their stable ordering
264 // taken from prefs. 264 // taken from prefs.
265 extension_registry_observer_.Add(extension_registry_); 265 extension_registry_observer_.Add(extension_registry_);
266 extension_action_observer_.Add(extension_action_api_); 266 extension_action_observer_.Add(extension_action_api_);
267 267
268 actions_initialized_ = true; 268 actions_initialized_ = true;
269 for (Observer& observer : observers_) 269 for (Observer& observer : observers_)
270 observer.OnToolbarModelInitialized(); 270 observer.OnToolbarModelInitialized();
271
272 if (use_redesign_) {
273 ComponentToolbarActionsFactory::GetInstance()->UnloadMigratedExtensions(
274 extensions::ExtensionSystem::Get(profile_)->extension_service(),
275 extension_registry_);
276 }
271 } 277 }
272 278
273 size_t ToolbarActionsModel::FindNewPositionFromLastKnownGood( 279 size_t ToolbarActionsModel::FindNewPositionFromLastKnownGood(
274 const ToolbarItem& action) { 280 const ToolbarItem& action) {
275 // See if we have last known good position for this action. 281 // See if we have last known good position for this action.
276 size_t new_index = 0; 282 size_t new_index = 0;
277 // Loop through the ID list of known positions, to count the number of 283 // Loop through the ID list of known positions, to count the number of
278 // visible action icons preceding |action|'s id. 284 // visible action icons preceding |action|'s id.
279 for (const std::string& last_pos_id : last_known_positions_) { 285 for (const std::string& last_pos_id : last_known_positions_) {
280 if (last_pos_id == action.id) 286 if (last_pos_id == action.id)
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 return extension_registry_->enabled_extensions().GetByID(id); 852 return extension_registry_->enabled_extensions().GetByID(id);
847 } 853 }
848 854
849 bool ToolbarActionsModel::IsActionVisible(const std::string& action_id) const { 855 bool ToolbarActionsModel::IsActionVisible(const std::string& action_id) const {
850 size_t index = 0u; 856 size_t index = 0u;
851 while (toolbar_items().size() > index && 857 while (toolbar_items().size() > index &&
852 toolbar_items()[index].id != action_id) 858 toolbar_items()[index].id != action_id)
853 ++index; 859 ++index;
854 return index < visible_icon_count(); 860 return index < visible_icon_count();
855 } 861 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/component_toolbar_actions_factory_unittest.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698