diff options
author | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 00:23:34 +0000 |
---|---|---|
committer | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 00:23:34 +0000 |
commit | a1f42985d74de36d1fc4fc173b9f2f7da4391d12 (patch) | |
tree | 140ad42c9d736bdd3002fe3df7fe507df63af262 /chrome/browser/extensions/extension_host.cc | |
parent | fc2d3fced2e685464564407b14e57077cad3250e (diff) | |
download | chromium_src-a1f42985d74de36d1fc4fc173b9f2f7da4391d12.zip chromium_src-a1f42985d74de36d1fc4fc173b9f2f7da4391d12.tar.gz chromium_src-a1f42985d74de36d1fc4fc173b9f2f7da4391d12.tar.bz2 |
Revert change 26184, 26181 and 26178 to fix
the compile error on the toolkit builder.
TBR:finnur
Review URL: http://codereview.chromium.org/203064
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26186 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_host.cc')
-rw-r--r-- | chrome/browser/extensions/extension_host.cc | 65 |
1 files changed, 19 insertions, 46 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 2a19667..c483070 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -8,7 +8,6 @@ #include "base/string_util.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/browser_theme_provider.h" #include "chrome/browser/debugger/devtools_manager.h" #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/extensions/extension_tabs_module.h" @@ -37,8 +36,6 @@ using WebKit::WebDragOperationsMask; // static bool ExtensionHost::enable_dom_automation_ = false; -static const char* kToolstripTextColorSubstitution = "$TEXT_COLOR$"; - ExtensionHost::ExtensionHost(Extension* extension, SiteInstance* site_instance, const GURL& url, ViewType::Type host_type) : extension_(extension), @@ -153,57 +150,33 @@ void ExtensionHost::DidNavigate(RenderViewHost* render_view_host, new ExtensionFunctionDispatcher(render_view_host_, this, url_)); } -void ExtensionHost::InsertCssIfToolstrip() { +void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) { + static const base::StringPiece toolstrip_css( + ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_EXTENSIONS_TOOLSTRIP_CSS)); #if defined(TOOLKIT_VIEWS) ExtensionView* view = view_.get(); - if (!view) - return; - if (!view->is_toolstrip()) { - // No CSS injecting currently, but call SetDidInsertCSS to tell the view - // that it's OK to display. - view->SetDidInsertCSS(true); - return; + if (view) { + // TODO(erikkay) this injection should really happen in the renderer. + // When the Jerry's view type change lands, investigate moving this there. + + // As a toolstrip, inject our toolstrip CSS to make it easier for toolstrips + // to blend in with the chrome UI. + if (view->is_toolstrip()) { + render_view_host->InsertCSSInWebFrame(L"", toolstrip_css.as_string()); + } else { + // No CSS injecting currently, but call SetDidInsertCSS to tell the view + // that it's OK to display. + view->SetDidInsertCSS(true); + } } #elif defined(OS_LINUX) ExtensionViewGtk* view = view_.get(); - if (!view || !view->is_toolstrip()) - return; -#endif - - static const base::StringPiece toolstrip_css( - ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_EXTENSIONS_TOOLSTRIP_CSS)); - - std::string css = toolstrip_css.as_string(); - ThemeProvider* theme_provider = - render_view_host()->process()->profile()->GetThemeProvider(); - - SkColor text_color = theme_provider ? - theme_provider->GetColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT) : - SK_ColorBLACK; - - std::string hex_color_string = StringPrintf( - "#%02x%02x%02x", SkColorGetR(text_color), - SkColorGetG(text_color), - SkColorGetB(text_color)); - size_t pos = css.find(kToolstripTextColorSubstitution); - while (pos != std::string::npos) { - css.replace(pos, 12, hex_color_string); - pos = css.find(kToolstripTextColorSubstitution); + if (view && view->is_toolstrip()) { + render_view_host->InsertCSSInWebFrame(L"", toolstrip_css.as_string()); } - -#if defined(TOOLKIT_VIEWS) || defined(OS_LINUX) - // TODO(erikkay) this injection should really happen in the renderer. - // When the Jerry's view type change lands, investigate moving this there. - - // As a toolstrip, inject our toolstrip CSS to make it easier for toolstrips - // to blend in with the chrome UI. - render_view_host()->InsertCSSInWebFrame(L"", css, "ToolstripDefaultCss"); #endif -} -void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) { - InsertCssIfToolstrip(); if (!did_stop_loading_) { NotificationService::current()->Notify( NotificationType::EXTENSION_HOST_DID_STOP_LOADING, |