diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 17:08:08 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 17:08:08 +0000 |
commit | ffaef0ca68c27e10935be966b3660fb5ecd897b8 (patch) | |
tree | c2314df36ace91390c20eee91e97796b3287af2e /chrome/renderer | |
parent | 34021274343928d048f01bc39e7dbbe8481de880 (diff) | |
download | chromium_src-ffaef0ca68c27e10935be966b3660fb5ecd897b8.zip chromium_src-ffaef0ca68c27e10935be966b3660fb5ecd897b8.tar.gz chromium_src-ffaef0ca68c27e10935be966b3660fb5ecd897b8.tar.bz2 |
ExtensionShelf now uses the BookmarkExtensionBackground, just like the BookmarkBarView.
Changed the WebKit API to add an optional |id| parameter to the insertStyleText, which is needed to be able to replace style sheets that have been previously added.
Added an interface that both BookmarkBarView and ExtensionShelf implement.
This new interface tells us whether we are located at the top or at the bottom and whether we are detached from the frame or not.
Factored out some of the duplicate painting-related code to a namespace of its own. Not happy with the name (welcome suggestions).
Moved the check for whether extensions are on top to new class and now cache the value for the lifetime of the process.
Toolstrip text color values are no longer hard-coded but use the color specified in the theme.
Decreased the timeouts for showing and hiding the toolstrip handle.
Replaced the pressed background image and the hover background image for the toolstrip to match what the bookmark bar uses.
Known issues:
Some themes expose the fact that:
- The background for the extension shelf when in detached mode (and located on the bottom) does not seamlessly blend in with background of new tab page. Still works surprisingly well when it breaks, though.
- Didn't spend much time theming the shelf handle (just used the solid color from the theme).
- When extension shelf is merged with the bookmark bar, there is a painting artifact (horizontal dotted line) that appears (apparently it was known to appear before this change).
BUG=18452, 21272, 21273
TEST=Install a theme for Chrome and make sure everything looks correct and is updated on a theme change. Also make sure painting problems in bugs 21272 and 21273 are fixed.
Review URL: http://codereview.chromium.org/204022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26227 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 10 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 10 | ||||
-rw-r--r-- | chrome/renderer/user_script_slave.cc | 2 |
3 files changed, 14 insertions, 8 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index f339309..b8ee661 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2734,12 +2734,13 @@ void RenderView::EvaluateScript(const std::wstring& frame_xpath, } void RenderView::InsertCSS(const std::wstring& frame_xpath, - const std::string& css) { + const std::string& css, + const std::string& id) { WebFrame* web_frame = GetChildFrame(frame_xpath); if (!web_frame) return; - web_frame->insertStyleText(WebString::fromUTF8(css)); + web_frame->insertStyleText(WebString::fromUTF8(css), WebString::fromUTF8(id)); } void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath, @@ -2748,8 +2749,9 @@ void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath, } void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath, - const std::string& css) { - InsertCSS(frame_xpath, css); + const std::string& css, + const std::string& id) { + InsertCSS(frame_xpath, css, id); // Notify RenderViewHost that css has been inserted into the frame. Send(new ViewHostMsg_OnCSSInserted(routing_id_)); diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 5836b52..2fe5201 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -405,9 +405,12 @@ class RenderView : public RenderWidget, void EvaluateScript(const std::wstring& frame_xpath, const std::wstring& jscript); - // Inserts a string of CSS in a particular frame. + // Inserts a string of CSS in a particular frame. |id| can be specified to + // give the CSS style element an id, and (if specified) will replace the + // element with the same id. void InsertCSS(const std::wstring& frame_xpath, - const std::string& css); + const std::string& css, + const std::string& id); int delay_seconds_for_form_state_sync() const { return delay_seconds_for_form_state_sync_; @@ -590,7 +593,8 @@ class RenderView : public RenderWidget, void OnScriptEvalRequest(const std::wstring& frame_xpath, const std::wstring& jscript); void OnCSSInsertRequest(const std::wstring& frame_xpath, - const std::string& css); + const std::string& css, + const std::string& id); void OnAddMessageToConsole(const string16& frame_xpath, const string16& message, const WebKit::WebConsoleMessage::Level&); diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc index 2ebd68f..7f7ad31 100644 --- a/chrome/renderer/user_script_slave.cc +++ b/chrome/renderer/user_script_slave.cc @@ -130,7 +130,7 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame, for (size_t j = 0; j < script->css_scripts().size(); ++j) { UserScript::File& file = script->css_scripts()[j]; frame->insertStyleText( - WebString::fromUTF8(file.GetContent().as_string())); + WebString::fromUTF8(file.GetContent().as_string()), WebString()); } } if (script->run_location() == location) { |