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

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

Issue 248006: Extensions: Listen for BROWSER_THEME_CHANGED and send updated CSS. (Closed)
Patch Set: Listen for notification after sending CSS Created 11 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/gtk/extension_shelf_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_host.cc
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index ea19514207709f696b0b363c0ea85ffc51910d82..9a1baa64c7391845381cc3466c3aac945a91fe81 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -135,9 +135,14 @@ void ExtensionHost::NavigateToURL(const GURL& url) {
void ExtensionHost::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NotificationType::EXTENSION_BACKGROUND_PAGE_READY);
- DCHECK(extension_->GetBackgroundPageReady());
- NavigateToURL(url_);
+ if (type == NotificationType::EXTENSION_BACKGROUND_PAGE_READY) {
+ DCHECK(extension_->GetBackgroundPageReady());
+ NavigateToURL(url_);
+ } else if (type == NotificationType::BROWSER_THEME_CHANGED) {
+ InsertThemeCSS();
+ } else {
+ NOTREACHED();
+ }
}
void ExtensionHost::UpdatePreferredWidth(int pref_width) {
@@ -241,10 +246,15 @@ void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) {
void ExtensionHost::DocumentAvailableInMainFrame(RenderViewHost* rvh) {
document_element_available_ = true;
- if (is_background_page())
+ if (is_background_page()) {
extension_->SetBackgroundPageReady();
- else
+ } else {
InsertThemeCSS();
+
+ // Listen for browser changes so we can resend the CSS.
+ registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
+ NotificationService::AllSources());
+ }
}
void ExtensionHost::RunJavaScriptMessage(const std::wstring& message,
« no previous file with comments | « no previous file | chrome/browser/gtk/extension_shelf_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698