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

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

Issue 6274: Greasemonkey support. (Closed)
Patch Set: Created 12 years, 2 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
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
11 #include "v8/include/v8.h"
M-A Ruel 2008/10/06 17:30:44 You need this?
12
11 #include "base/command_line.h" 13 #include "base/command_line.h"
12 #include "base/gfx/bitmap_header.h" 14 #include "base/gfx/bitmap_header.h"
13 #include "base/gfx/bitmap_platform_device_win.h" 15 #include "base/gfx/bitmap_platform_device_win.h"
14 #include "base/gfx/image_operations.h" 16 #include "base/gfx/image_operations.h"
15 #include "base/gfx/native_theme.h" 17 #include "base/gfx/native_theme.h"
16 #include "base/gfx/vector_canvas.h" 18 #include "base/gfx/vector_canvas.h"
17 #include "base/gfx/png_encoder.h" 19 #include "base/gfx/png_encoder.h"
18 #include "base/string_piece.h" 20 #include "base/string_piece.h"
19 #include "base/string_util.h" 21 #include "base/string_util.h"
20 #include "chrome/app/theme/theme_resources.h" 22 #include "chrome/app/theme/theme_resources.h"
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 WebFrame* web_frame; 2223 WebFrame* web_frame;
2222 if (frame_xpath.empty()) { 2224 if (frame_xpath.empty()) {
2223 web_frame = webview()->GetMainFrame(); 2225 web_frame = webview()->GetMainFrame();
2224 } else { 2226 } else {
2225 web_frame = webview()->GetMainFrame()->GetChildFrame(frame_xpath); 2227 web_frame = webview()->GetMainFrame()->GetChildFrame(frame_xpath);
2226 } 2228 }
2227 2229
2228 return web_frame; 2230 return web_frame;
2229 } 2231 }
2230 2232
2231 void RenderView::EvaluateScriptUrl(const std::wstring& frame_xpath, 2233 void RenderView::EvaluateScript(const std::wstring& frame_xpath,
2232 const std::wstring& js_url) { 2234 const std::wstring& script,
2235 const std::wstring& filename) {
2233 WebFrame* web_frame = GetChildFrame(frame_xpath); 2236 WebFrame* web_frame = GetChildFrame(frame_xpath);
2234 if (!web_frame) 2237 if (!web_frame)
2235 return; 2238 return;
2236 2239
2237 scoped_ptr<WebRequest> request(WebRequest::Create(GURL(js_url))); 2240 web_frame->ExecuteJavaScript(script, filename);
2238 web_frame->LoadRequest(request.get());
2239 } 2241 }
2240 2242
2241 void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath, 2243 void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath,
2242 const std::wstring& jscript) { 2244 const std::wstring& jscript,
2243 EvaluateScriptUrl(frame_xpath, jscript); 2245 const std::wstring& filename) {
2246 EvaluateScript(frame_xpath, jscript, filename);
2244 } 2247 }
2245 2248
2246 void RenderView::OnAddMessageToConsole(const std::wstring& frame_xpath, 2249 void RenderView::OnAddMessageToConsole(const std::wstring& frame_xpath,
2247 const std::wstring& msg, 2250 const std::wstring& msg,
2248 ConsoleMessageLevel level) { 2251 ConsoleMessageLevel level) {
2249 WebFrame* web_frame = GetChildFrame(frame_xpath); 2252 WebFrame* web_frame = GetChildFrame(frame_xpath);
2250 if (!web_frame) 2253 if (!web_frame)
2251 return; 2254 return;
2252 2255
2253 web_frame->AddMessageToConsole(msg, level); 2256 web_frame->AddMessageToConsole(msg, level);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2563 2566
2564 if (template_html.empty()) { 2567 if (template_html.empty()) {
2565 NOTREACHED() << "unable to load template. ID: " << template_resource_id; 2568 NOTREACHED() << "unable to load template. ID: " << template_resource_id;
2566 return ""; 2569 return "";
2567 } 2570 }
2568 // "t" is the id of the templates root node. 2571 // "t" is the id of the templates root node.
2569 return jstemplate_builder::GetTemplateHtml( 2572 return jstemplate_builder::GetTemplateHtml(
2570 template_html, &error_strings, "t"); 2573 template_html, &error_strings, "t");
2571 } 2574 }
2572 2575
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698