diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-19 19:31:51 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-19 19:31:51 +0000 |
commit | 078b3461fa0eee0bcf9e4b43f8b7a3171f9e0018 (patch) | |
tree | 6292b5fc4583430029fccafe4e16907c7dbd2cad /chrome/renderer/render_view.cc | |
parent | 2291d04b0d127ca1b31c4326f9297253e4399d2b (diff) | |
download | chromium_src-078b3461fa0eee0bcf9e4b43f8b7a3171f9e0018.zip chromium_src-078b3461fa0eee0bcf9e4b43f8b7a3171f9e0018.tar.gz chromium_src-078b3461fa0eee0bcf9e4b43f8b7a3171f9e0018.tar.bz2 |
Change the view mode when switching between moles and toolstrips, and
propogate this into the class of the document element so that it's
possible to use CSS rules to control the display of your toolstrip/mole.
BUG=21939,15494
TEST=run the Mappy extension and verify it can open and close
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=26635
Review URL: http://codereview.chromium.org/208020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26654 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r-- | chrome/renderer/render_view.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 2e68db7..a1aea97 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2080,6 +2080,11 @@ void RenderView::didCreateDocumentElement(WebFrame* frame) { RenderThread::current()->user_script_slave()->InjectScripts( frame, UserScript::DOCUMENT_START); } + if (view_type_ == ViewType::EXTENSION_TOOLSTRIP || + view_type_ == ViewType::EXTENSION_MOLE) { + InjectToolstripCSS(); + ExtensionProcessBindings::SetViewType(webview(), view_type_); + } while (!pending_code_execution_queue_.empty()) { scoped_refptr<CodeExecutionInfo> info = @@ -2974,6 +2979,15 @@ void RenderView::OnMediaPlayerActionAt(int x, } void RenderView::OnNotifyRendererViewType(ViewType::Type type) { + // When this is first set, the bindings aren't fully loaded. We only need + // to call through this API after the page has already been loaded. It's + // also called in didCreateDocumentElement to bootstrap. + if (view_type_ != ViewType::INVALID) { + if (type == ViewType::EXTENSION_MOLE || + type == ViewType::EXTENSION_TOOLSTRIP) { + ExtensionProcessBindings::SetViewType(webview(), type); + } + } view_type_ = type; } @@ -3249,6 +3263,17 @@ void RenderView::OnExtensionResponse(int request_id, request_id, success, response, error); } +void RenderView::InjectToolstripCSS() { + if (view_type_ != ViewType::EXTENSION_TOOLSTRIP) + return; + + static const base::StringPiece toolstrip_css( + ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_EXTENSION_TOOLSTRIP_CSS)); + std::string css = toolstrip_css.as_string(); + InsertCSS(L"", css, "ToolstripDefaultCSS"); +} + void RenderView::OnExtensionMessageInvoke(const std::string& function_name, const ListValue& args) { RendererExtensionBindings::Invoke(function_name, args, this); |