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

Unified Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

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/cocoa/location_bar/location_bar_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index 62ef99db92524857419e8b612f291a40740e4ae6..e9305bdd1314cdd79bedbd1a33d258f195ebfd0d 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -595,26 +595,22 @@ void LocationBarViewMac::RefreshPageActionDecorations() {
return;
}
- std::vector<ExtensionAction*> page_actions;
-
TabContents* tab_contents = GetTabContents();
if (!tab_contents) {
DeletePageActionDecorations(); // Necessary?
return;
}
- extensions::LocationBarController* controller =
- tab_contents->extension_tab_helper()->location_bar_controller();
- 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_decorations_.size()) {
- DeletePageActionDecorations(); // Delete the old views (if any).
+ std::vector<ExtensionAction*> new_page_actions =
+ tab_contents->extension_tab_helper()->location_bar_controller()->
+ GetCurrentActions();
- for (size_t i = 0; i < page_actions.size(); ++i) {
+ if (new_page_actions != page_actions_) {
+ page_actions_.swap(new_page_actions);
+ DeletePageActionDecorations();
+ for (size_t i = 0; i < page_actions_.size(); ++i) {
page_action_decorations_.push_back(
- new PageActionDecoration(this, profile_, page_actions[i]));
+ new PageActionDecoration(this, profile_, page_actions_[i]));
}
}
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h ('k') | chrome/browser/ui/gtk/location_bar_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698