Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: chrome/renderer/render_view.cc

Issue 18183: First pass as implementing the greasemonkey API. This patch (Closed)
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/renderer/render_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 2407
2408 return web_frame; 2408 return web_frame;
2409 } 2409 }
2410 2410
2411 void RenderView::EvaluateScript(const std::wstring& frame_xpath, 2411 void RenderView::EvaluateScript(const std::wstring& frame_xpath,
2412 const std::wstring& script) { 2412 const std::wstring& script) {
2413 WebFrame* web_frame = GetChildFrame(frame_xpath); 2413 WebFrame* web_frame = GetChildFrame(frame_xpath);
2414 if (!web_frame) 2414 if (!web_frame)
2415 return; 2415 return;
2416 2416
2417 web_frame->ExecuteJavaScript(WideToUTF8(script), GURL()); 2417 web_frame->ExecuteJavaScript(WideToUTF8(script),
2418 GURL(), // script url
2419 1); // base line number
2418 } 2420 }
2419 2421
2420 void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath, 2422 void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath,
2421 const std::wstring& jscript) { 2423 const std::wstring& jscript) {
2422 EvaluateScript(frame_xpath, jscript); 2424 EvaluateScript(frame_xpath, jscript);
2423 } 2425 }
2424 2426
2425 void RenderView::OnAddMessageToConsole(const std::wstring& frame_xpath, 2427 void RenderView::OnAddMessageToConsole(const std::wstring& frame_xpath,
2426 const std::wstring& msg, 2428 const std::wstring& msg,
2427 ConsoleMessageLevel level) { 2429 ConsoleMessageLevel level) {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
2769 template_resource_id)); 2771 template_resource_id));
2770 2772
2771 if (template_html.empty()) { 2773 if (template_html.empty()) {
2772 NOTREACHED() << "unable to load template. ID: " << template_resource_id; 2774 NOTREACHED() << "unable to load template. ID: " << template_resource_id;
2773 return ""; 2775 return "";
2774 } 2776 }
2775 // "t" is the id of the templates root node. 2777 // "t" is the id of the templates root node.
2776 return jstemplate_builder::GetTemplateHtml( 2778 return jstemplate_builder::GetTemplateHtml(
2777 template_html, &error_strings, "t"); 2779 template_html, &error_strings, "t");
2778 } 2780 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/render_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698