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

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
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 488983f53127621b00b3662d8b56da26f9d352b9..5d9b1ba32b0c81c2b2878ff9a3beb6de004feb10 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"
@@ -60,6 +65,19 @@ 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_);
+ if (!browser)
Peter Kasting 2014/09/03 23:13:08 Can this actually be NULL?
Devlin 2014/09/03 23:23:20 The comment above the method would imply so. [1] U
Peter Kasting 2014/09/03 23:41:03 Ugh, I really hate copying NULL-checks because oth
Avi (use Gerrit) 2014/09/04 00:47:08 Of course chrome::FindBrowserWithWebContents can r
Devlin 2014/09/05 20:15:16 Since a LocationBarController is attached as part
+ return;
+ LocationBar* location_bar =
+ browser->window() ? browser->window()->GetLocationBar() : NULL;
Peter Kasting 2014/09/03 23:13:08 Likewise, can the window() or the location bar be
Devlin 2014/09/03 23:23:20 window() can be NULL if this is called before Crea
Peter Kasting 2014/09/03 23:41:03 Cool, can you add brief comments noting that?
Devlin 2014/09/05 20:15:16 Done.
+ if (!location_bar)
+ return;
+ location_bar->UpdateBookmarkStarVisibility();
+ }
}
void LocationBarController::OnExtensionUnloaded(

Powered by Google App Engine
This is Rietveld 408576698