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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 10544185: Order the script badges in the location bar consistently (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index e32bd74d70c98094ab06c7b27460a2c1b2a9a8ea..199434ef20ce0eefe8f483d6045924cc29375524 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -1002,21 +1002,22 @@ void LocationBarView::RefreshPageActionViews() {
old_visibility[(*i)->image_view()->page_action()] = (*i)->visible();
}
- std::vector<ExtensionAction*> page_actions;
+ std::vector<ExtensionAction*> new_page_actions;
TabContents* tab_contents = GetTabContents();
if (tab_contents) {
extensions::LocationBarController* controller =
tab_contents->extension_tab_helper()->location_bar_controller();
- page_actions.swap(*controller->GetCurrentActions());
+ new_page_actions.swap(*controller->GetCurrentActions());
}
// On startup we sometimes haven't loaded any extensions. This makes sure
// we catch up when the extensions (and any page actions) load.
- if (page_actions.size() != page_action_views_.size()) {
+ if (page_actions_ != new_page_actions) {
+ page_actions_.swap(new_page_actions);
DeletePageActionViews(); // Delete the old views (if any).
- page_action_views_.resize(page_actions.size());
+ page_action_views_.resize(page_actions_.size());
View* right_anchor = chrome_to_mobile_view_;
if (!right_anchor)
right_anchor = star_view_;
@@ -1026,9 +1027,9 @@ void LocationBarView::RefreshPageActionViews() {
// Add the page actions in reverse order, so that the child views are
// inserted in left-to-right order for accessibility.
- for (int i = page_actions.size() - 1; i >= 0; --i) {
+ for (int i = page_actions_.size() - 1; i >= 0; --i) {
page_action_views_[i] = new PageActionWithBadgeView(
- delegate_->CreatePageActionImageView(this, page_actions[i]));
+ delegate_->CreatePageActionImageView(this, page_actions_[i]));
page_action_views_[i]->SetVisible(false);
AddChildViewAt(page_action_views_[i], GetIndexOf(right_anchor));
}

Powered by Google App Engine
This is Rietveld 408576698