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 2716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 void RenderView::EvaluateScript(const std::wstring& frame_xpath, | 2727 void RenderView::EvaluateScript(const std::wstring& frame_xpath, |
2728 const std::wstring& script) { | 2728 const std::wstring& script) { |
2729 WebFrame* web_frame = GetChildFrame(frame_xpath); | 2729 WebFrame* web_frame = GetChildFrame(frame_xpath); |
2730 if (!web_frame) | 2730 if (!web_frame) |
2731 return; | 2731 return; |
2732 | 2732 |
2733 web_frame->executeScript(WebScriptSource(WideToUTF16Hack(script))); | 2733 web_frame->executeScript(WebScriptSource(WideToUTF16Hack(script))); |
2734 } | 2734 } |
2735 | 2735 |
2736 void RenderView::InsertCSS(const std::wstring& frame_xpath, | 2736 void RenderView::InsertCSS(const std::wstring& frame_xpath, |
2737 const std::string& css) { | 2737 const std::string& css, |
| 2738 const std::string& id) { |
2738 WebFrame* web_frame = GetChildFrame(frame_xpath); | 2739 WebFrame* web_frame = GetChildFrame(frame_xpath); |
2739 if (!web_frame) | 2740 if (!web_frame) |
2740 return; | 2741 return; |
2741 | 2742 |
2742 web_frame->insertStyleText(WebString::fromUTF8(css)); | 2743 web_frame->insertStyleText(WebString::fromUTF8(css), WebString::fromUTF8(id)); |
2743 } | 2744 } |
2744 | 2745 |
2745 void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath, | 2746 void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath, |
2746 const std::wstring& jscript) { | 2747 const std::wstring& jscript) { |
2747 EvaluateScript(frame_xpath, jscript); | 2748 EvaluateScript(frame_xpath, jscript); |
2748 } | 2749 } |
2749 | 2750 |
2750 void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath, | 2751 void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath, |
2751 const std::string& css) { | 2752 const std::string& css, |
2752 InsertCSS(frame_xpath, css); | 2753 const std::string& id) { |
| 2754 InsertCSS(frame_xpath, css, id); |
2753 | 2755 |
2754 // Notify RenderViewHost that css has been inserted into the frame. | 2756 // Notify RenderViewHost that css has been inserted into the frame. |
2755 Send(new ViewHostMsg_OnCSSInserted(routing_id_)); | 2757 Send(new ViewHostMsg_OnCSSInserted(routing_id_)); |
2756 } | 2758 } |
2757 | 2759 |
2758 void RenderView::OnAddMessageToConsole( | 2760 void RenderView::OnAddMessageToConsole( |
2759 const string16& frame_xpath, | 2761 const string16& frame_xpath, |
2760 const string16& message, | 2762 const string16& message, |
2761 const WebConsoleMessage::Level& level) { | 2763 const WebConsoleMessage::Level& level) { |
2762 WebFrame* web_frame = GetChildFrame(UTF16ToWideHack(frame_xpath)); | 2764 WebFrame* web_frame = GetChildFrame(UTF16ToWideHack(frame_xpath)); |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3493 // TODO(darin): There's actually no reason for this to be here. We should | 3495 // TODO(darin): There's actually no reason for this to be here. We should |
3494 // have the browser side manage the document tag. | 3496 // have the browser side manage the document tag. |
3495 #if defined(OS_MACOSX) | 3497 #if defined(OS_MACOSX) |
3496 if (!has_document_tag_) { | 3498 if (!has_document_tag_) { |
3497 // Make the call to get the tag. | 3499 // Make the call to get the tag. |
3498 Send(new ViewHostMsg_GetDocumentTag(routing_id_, &document_tag_)); | 3500 Send(new ViewHostMsg_GetDocumentTag(routing_id_, &document_tag_)); |
3499 has_document_tag_ = true; | 3501 has_document_tag_ = true; |
3500 } | 3502 } |
3501 #endif | 3503 #endif |
3502 } | 3504 } |
OLD | NEW |