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

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: 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
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 d0c72340eb68dc0740c74a72e6b5980917f2dfba..6a495e8e2da65ccdf11649af4cdcb186d35b4c4f 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -461,7 +461,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) {
@@ -722,23 +721,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 = 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_) {
+ 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);
}
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.h ('k') | chrome/browser/ui/views/location_bar/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698