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

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: revert scoped_ptr change, rebase 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
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 67f3c2160866c648f86d68789eb51227234585a5..c7f1a31f0083574d6936f9871abbab490b56b586 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -1028,21 +1028,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 = 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_;
@@ -1052,9 +1053,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));
}
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698