OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 2691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2702 void RenderView::EvaluateScript(const std::wstring& frame_xpath, | 2702 void RenderView::EvaluateScript(const std::wstring& frame_xpath, |
2703 const std::wstring& script) { | 2703 const std::wstring& script) { |
2704 WebFrame* web_frame = GetChildFrame(frame_xpath); | 2704 WebFrame* web_frame = GetChildFrame(frame_xpath); |
2705 if (!web_frame) | 2705 if (!web_frame) |
2706 return; | 2706 return; |
2707 | 2707 |
2708 web_frame->executeScript(WebScriptSource(WideToUTF16Hack(script))); | 2708 web_frame->executeScript(WebScriptSource(WideToUTF16Hack(script))); |
2709 } | 2709 } |
2710 | 2710 |
2711 void RenderView::InsertCSS(const std::wstring& frame_xpath, | 2711 void RenderView::InsertCSS(const std::wstring& frame_xpath, |
2712 const std::string& css) { | 2712 const std::string& css, |
| 2713 const std::string& id) { |
2713 WebFrame* web_frame = GetChildFrame(frame_xpath); | 2714 WebFrame* web_frame = GetChildFrame(frame_xpath); |
2714 if (!web_frame) | 2715 if (!web_frame) |
2715 return; | 2716 return; |
2716 | 2717 |
2717 web_frame->insertStyleText(WebString::fromUTF8(css)); | 2718 web_frame->insertStyleText(WebString::fromUTF8(css), WebString::fromUTF8(id)); |
2718 } | 2719 } |
2719 | 2720 |
2720 void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath, | 2721 void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath, |
2721 const std::wstring& jscript) { | 2722 const std::wstring& jscript) { |
2722 EvaluateScript(frame_xpath, jscript); | 2723 EvaluateScript(frame_xpath, jscript); |
2723 } | 2724 } |
2724 | 2725 |
2725 void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath, | 2726 void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath, |
2726 const std::string& css) { | 2727 const std::string& css, |
2727 InsertCSS(frame_xpath, css); | 2728 const std::string& id) { |
| 2729 InsertCSS(frame_xpath, css, id); |
2728 | 2730 |
2729 // Notify RenderViewHost that css has been inserted into the frame. | 2731 // Notify RenderViewHost that css has been inserted into the frame. |
2730 Send(new ViewHostMsg_OnCSSInserted(routing_id_)); | 2732 Send(new ViewHostMsg_OnCSSInserted(routing_id_)); |
2731 } | 2733 } |
2732 | 2734 |
2733 void RenderView::OnAddMessageToConsole( | 2735 void RenderView::OnAddMessageToConsole( |
2734 const string16& frame_xpath, | 2736 const string16& frame_xpath, |
2735 const string16& message, | 2737 const string16& message, |
2736 const WebConsoleMessage::Level& level) { | 2738 const WebConsoleMessage::Level& level) { |
2737 WebFrame* web_frame = GetChildFrame(UTF16ToWideHack(frame_xpath)); | 2739 WebFrame* web_frame = GetChildFrame(UTF16ToWideHack(frame_xpath)); |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3457 EditCommands::iterator end = edit_commands_.end(); | 3459 EditCommands::iterator end = edit_commands_.end(); |
3458 | 3460 |
3459 for (; it != end; ++it) { | 3461 for (; it != end; ++it) { |
3460 if (!frame->executeCommand(WebString::fromUTF8(it->name), | 3462 if (!frame->executeCommand(WebString::fromUTF8(it->name), |
3461 WebString::fromUTF8(it->value))) | 3463 WebString::fromUTF8(it->value))) |
3462 break; | 3464 break; |
3463 } | 3465 } |
3464 | 3466 |
3465 return true; | 3467 return true; |
3466 } | 3468 } |
OLD | NEW |