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

Unified Diff: chrome/browser/extensions/location_bar_controller.cc

Issue 540483002: Fix regression in showing bookmark star when an extension should override it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/location_bar_controller.cc
diff --git a/chrome/browser/extensions/location_bar_controller.cc b/chrome/browser/extensions/location_bar_controller.cc
index bbb6e8d615a2f500d80b292b100f7bf26a5f7502..22364ccd6096570272c5dccb78dd6d134d878706 100644
--- a/chrome/browser/extensions/location_bar_controller.cc
+++ b/chrome/browser/extensions/location_bar_controller.cc
@@ -7,6 +7,11 @@
#include "chrome/browser/extensions/active_script_controller.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/extension_action_manager.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/location_bar/location_bar.h"
+#include "chrome/common/extensions/manifest_handlers/ui_overrides_handler.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/feature_switch.h"
@@ -74,6 +79,25 @@ void LocationBarController::OnExtensionLoaded(
ExtensionActionAPI::Get(browser_context)->
NotifyPageActionsChanged(web_contents_);
}
+
+ // We might also need to update the location bar if the extension can remove
+ // the bookmark star.
+ if (UIOverrides::RemovesBookmarkButton(extension)) {
+ Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
+ // In a perfect world, this can never be NULL. Unfortunately, since a
+ // LocationBarController is attached to most WebContents, we can't make that
+ // guarantee.
+ if (!browser)
+ return;
+ // window() can be NULL if this is called before CreateBrowserWindow()
+ // completes, and there won't be a location bar if the window has no toolbar
+ // (e.g., and app window).
+ LocationBar* location_bar =
+ browser->window() ? browser->window()->GetLocationBar() : NULL;
+ if (!location_bar)
+ return;
+ location_bar->UpdateBookmarkStarVisibility();
+ }
}
void LocationBarController::OnExtensionUnloaded(
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698