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

Unified Diff: extensions/renderer/dispatcher.cc

Issue 537773003: Add a user agent stylesheet for extension options pages (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: extensions/renderer/dispatcher.cc
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index d52d1505c06bfe2a7da38acde2639c831bf5fa29..c98e4a3365d152ba312953df6b5e899077af977d 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -32,6 +32,7 @@
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/manifest_handlers/externally_connectable.h"
+#include "extensions/common/manifest_handlers/options_page_info.h"
#include "extensions/common/manifest_handlers/sandboxed_page_info.h"
#include "extensions/common/message_bundle.h"
#include "extensions/common/permissions/permission_set.h"
@@ -332,13 +333,14 @@ void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) {
// are hosted in the extension process.
GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL(
frame, frame->document().url(), true /* match_about_blank */);
+
const Extension* extension =
extensions_.GetExtensionOrAppByURL(effective_document_url);
if (extension &&
(extension->is_extension() || extension->is_platform_app())) {
- int resource_id =
- extension->is_platform_app() ? IDR_PLATFORM_APP_CSS : IDR_EXTENSION_CSS;
+ int resource_id = extension->is_platform_app() ? IDR_PLATFORM_APP_CSS
+ : IDR_EXTENSION_FONTS_CSS;
std::string stylesheet = ResourceBundle::GetSharedInstance()
.GetRawDataResource(resource_id)
.as_string();
@@ -352,6 +354,15 @@ void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) {
// documents that are loaded in each app or extension.
frame->document().insertStyleSheet(WebString::fromUTF8(stylesheet));
}
+
+ if (extension && extension->is_extension() &&
+ OptionsPageInfo::ShouldUseChromeStyle(extension) &&
+ effective_document_url == OptionsPageInfo::GetOptionsPage(extension)) {
Devlin 2014/09/04 21:27:37 Is this data copied over to the renderer process?
ericzeng 2014/09/04 22:30:30 I don't know either. Which data in particular?
Devlin 2014/09/04 22:39:19 The extension's manifest data for whether or not i
ericzeng 2014/09/04 23:48:58 I'm pretty sure that it is - the IPC call when ext
Yoyo Zhou 2014/09/05 16:24:35 Yes, the renderer ought to have all the manifest d
+ frame->document().insertStyleSheet(
+ WebString::fromUTF8(ResourceBundle::GetSharedInstance()
+ .GetRawDataResource(IDR_EXTENSION_CSS)
Devlin 2014/09/04 21:27:37 Naively looking at this, it seems that you inject
ericzeng 2014/09/04 22:30:30 I think the conditional above should catch it - it
Devlin 2014/09/04 22:39:19 D'oh. Don't know why I missed that.
+ .as_string()));
+ }
content_watcher_->DidCreateDocumentElement(frame);
}

Powered by Google App Engine
This is Rietveld 408576698