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

Unified Diff: chrome/browser/ui/gtk/location_bar_view_gtk.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/gtk/location_bar_view_gtk.cc
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
index e08e4813dc1f9a7f4fd7c3fce4169f87f4a90e3a..987622ec289edd288e7f791549eebbe4a5400b04 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -449,7 +449,6 @@ void LocationBarViewGtk::SetPreviewEnabledPageAction(
ExtensionAction *page_action,
bool preview_enabled) {
DCHECK(page_action);
- UpdatePageActions();
for (ScopedVector<PageActionViewGtk>::iterator iter =
page_action_views_.begin(); iter != page_action_views_.end();
++iter) {
@@ -690,23 +689,24 @@ void LocationBarViewGtk::UpdateContentSettingsIcons() {
}
void LocationBarViewGtk::UpdatePageActions() {
- std::vector<ExtensionAction*> page_actions;
+ std::vector<ExtensionAction*> new_page_actions;
TabContents* tab_contents = GetTabContents();
if (tab_contents) {
LocationBarController* controller =
tab_contents->extension_tab_helper()->location_bar_controller();
- page_actions.swap(*controller->GetCurrentActions());
+ new_page_actions.swap(*controller->GetCurrentActions());
}
- // Initialize on the first call, or re-inialize if more extensions have been
+ // Initialize on the first call, or re-initialize if more extensions have been
// loaded or added after startup.
- if (page_actions.size() != page_action_views_.size()) {
- page_action_views_.reset(); // Delete the old views (if any).
+ if (new_page_actions != page_actions_) {
Evan Stade 2012/06/16 00:42:46 I've never actually tried to use comparison operat
Jeffrey Yasskin 2012/06/16 00:53:25 Yes: http://en.cppreference.com/w/cpp/container/ve
not at google - send to devlin 2012/06/18 17:50:27 Yep I assumed it did. Thanks Jeffrey for finding
+ page_actions_.swap(new_page_actions);
+ page_action_views_.reset();
- for (size_t i = 0; i < page_actions.size(); ++i) {
+ for (size_t i = 0; i < page_actions_.size(); ++i) {
page_action_views_.push_back(
- new PageActionViewGtk(this, page_actions[i]));
+ new PageActionViewGtk(this, page_actions_[i]));
gtk_box_pack_end(GTK_BOX(page_action_hbox_.get()),
page_action_views_[i]->widget(), FALSE, FALSE, 0);
}

Powered by Google App Engine
This is Rietveld 408576698