| OLD | NEW |
| 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/browser/renderer_host/render_view_host.h" | 5 #include "chrome/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gfx/native_widget_types.h" | 10 #include "base/gfx/native_widget_types.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/common/bindings_policy.h" | 28 #include "chrome/common/bindings_policy.h" |
| 29 #include "chrome/common/render_messages.h" | 29 #include "chrome/common/render_messages.h" |
| 30 #include "chrome/common/resource_bundle.h" | 30 #include "chrome/common/resource_bundle.h" |
| 31 #include "chrome/common/notification_service.h" | 31 #include "chrome/common/notification_service.h" |
| 32 #include "chrome/common/notification_type.h" | 32 #include "chrome/common/notification_type.h" |
| 33 #include "chrome/common/result_codes.h" | 33 #include "chrome/common/result_codes.h" |
| 34 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
| 35 #include "chrome/common/thumbnail_score.h" | 35 #include "chrome/common/thumbnail_score.h" |
| 36 #include "net/base/net_util.h" | 36 #include "net/base/net_util.h" |
| 37 #include "skia/include/SkBitmap.h" | 37 #include "skia/include/SkBitmap.h" |
| 38 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | 38 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" |
| 39 #include "third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h" | |
| 40 #include "webkit/glue/autofill_form.h" | 39 #include "webkit/glue/autofill_form.h" |
| 41 | 40 |
| 42 using base::TimeDelta; | 41 using base::TimeDelta; |
| 43 using WebKit::WebConsoleMessage; | 42 using WebKit::WebConsoleMessage; |
| 44 using WebKit::WebFindInPageRequest; | 43 using WebKit::WebFindOptions; |
| 45 using WebKit::WebInputEvent; | 44 using WebKit::WebInputEvent; |
| 46 | 45 |
| 47 namespace { | 46 namespace { |
| 48 | 47 |
| 49 void FilterURL(RendererSecurityPolicy* policy, int renderer_id, GURL* url) { | 48 void FilterURL(RendererSecurityPolicy* policy, int renderer_id, GURL* url) { |
| 50 if (!url->is_valid()) | 49 if (!url->is_valid()) |
| 51 return; // We don't need to block invalid URLs. | 50 return; // We don't need to block invalid URLs. |
| 52 | 51 |
| 53 if (url->SchemeIs(chrome::kAboutScheme)) { | 52 if (url->SchemeIs(chrome::kAboutScheme)) { |
| 54 // The renderer treats all URLs in the about: scheme as being about:blank. | 53 // The renderer treats all URLs in the about: scheme as being about:blank. |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 341 |
| 343 void RenderViewHost::Stop() { | 342 void RenderViewHost::Stop() { |
| 344 Send(new ViewMsg_Stop(routing_id())); | 343 Send(new ViewMsg_Stop(routing_id())); |
| 345 } | 344 } |
| 346 | 345 |
| 347 bool RenderViewHost::PrintPages() { | 346 bool RenderViewHost::PrintPages() { |
| 348 return Send(new ViewMsg_PrintPages(routing_id())); | 347 return Send(new ViewMsg_PrintPages(routing_id())); |
| 349 } | 348 } |
| 350 | 349 |
| 351 void RenderViewHost::StartFinding(int request_id, | 350 void RenderViewHost::StartFinding(int request_id, |
| 352 const string16& search_string, | 351 const string16& search_text, |
| 353 bool forward, | 352 bool forward, |
| 354 bool match_case, | 353 bool match_case, |
| 355 bool find_next) { | 354 bool find_next) { |
| 356 if (search_string.empty()) | 355 if (search_text.empty()) |
| 357 return; | 356 return; |
| 358 | 357 |
| 359 WebFindInPageRequest request; | 358 WebFindOptions options; |
| 360 request.identifier = request_id; | 359 options.forward = forward; |
| 361 request.text = search_string; | 360 options.matchCase = match_case; |
| 362 request.forward = forward; | 361 options.findNext = find_next; |
| 363 request.matchCase = match_case; | 362 Send(new ViewMsg_Find(routing_id(), request_id, search_text, options)); |
| 364 request.findNext = find_next; | |
| 365 Send(new ViewMsg_Find(routing_id(), request)); | |
| 366 | 363 |
| 367 // This call is asynchronous and returns immediately. | 364 // This call is asynchronous and returns immediately. |
| 368 // The result of the search is sent as a notification message by the renderer. | 365 // The result of the search is sent as a notification message by the renderer. |
| 369 } | 366 } |
| 370 | 367 |
| 371 void RenderViewHost::StopFinding(bool clear_selection) { | 368 void RenderViewHost::StopFinding(bool clear_selection) { |
| 372 Send(new ViewMsg_StopFinding(routing_id(), clear_selection)); | 369 Send(new ViewMsg_StopFinding(routing_id(), clear_selection)); |
| 373 } | 370 } |
| 374 | 371 |
| 375 void RenderViewHost::Zoom(PageZoom::Function function) { | 372 void RenderViewHost::Zoom(PageZoom::Function function) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 const std::wstring& frame_xpath, const std::wstring& jscript) { | 427 const std::wstring& frame_xpath, const std::wstring& jscript) { |
| 431 Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript)); | 428 Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript)); |
| 432 } | 429 } |
| 433 | 430 |
| 434 void RenderViewHost::InsertCSSInWebFrame( | 431 void RenderViewHost::InsertCSSInWebFrame( |
| 435 const std::wstring& frame_xpath, const std::string& css) { | 432 const std::wstring& frame_xpath, const std::string& css) { |
| 436 Send(new ViewMsg_CSSInsertRequest(routing_id(), frame_xpath, css)); | 433 Send(new ViewMsg_CSSInsertRequest(routing_id(), frame_xpath, css)); |
| 437 } | 434 } |
| 438 | 435 |
| 439 void RenderViewHost::AddMessageToConsole( | 436 void RenderViewHost::AddMessageToConsole( |
| 440 const std::wstring& frame_xpath, const WebConsoleMessage& message) { | 437 const string16& frame_xpath, |
| 441 Send(new ViewMsg_AddMessageToConsole(routing_id(), frame_xpath, message)); | 438 const string16& message, |
| 439 const WebConsoleMessage::Level& level) { |
| 440 Send(new ViewMsg_AddMessageToConsole( |
| 441 routing_id(), frame_xpath, message, level)); |
| 442 } | 442 } |
| 443 | 443 |
| 444 void RenderViewHost::DebugCommand(const std::wstring& cmd) { | 444 void RenderViewHost::DebugCommand(const std::wstring& cmd) { |
| 445 Send(new ViewMsg_DebugCommand(routing_id(), cmd)); | 445 Send(new ViewMsg_DebugCommand(routing_id(), cmd)); |
| 446 } | 446 } |
| 447 | 447 |
| 448 void RenderViewHost::DebugAttach() { | 448 void RenderViewHost::DebugAttach() { |
| 449 if (!debugger_attached_) | 449 if (!debugger_attached_) |
| 450 Send(new ViewMsg_DebugAttach(routing_id())); | 450 Send(new ViewMsg_DebugAttach(routing_id())); |
| 451 } | 451 } |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 int callback_id) { | 1384 int callback_id) { |
| 1385 // TODO(aa): Here is where we can check that this renderer was supposed to be | 1385 // TODO(aa): Here is where we can check that this renderer was supposed to be |
| 1386 // able to call extension APIs. | 1386 // able to call extension APIs. |
| 1387 extension_function_dispatcher_.HandleRequest(name, args, callback_id); | 1387 extension_function_dispatcher_.HandleRequest(name, args, callback_id); |
| 1388 } | 1388 } |
| 1389 | 1389 |
| 1390 void RenderViewHost::SendExtensionResponse(int callback_id, | 1390 void RenderViewHost::SendExtensionResponse(int callback_id, |
| 1391 const std::string& response) { | 1391 const std::string& response) { |
| 1392 Send(new ViewMsg_ExtensionResponse(routing_id(), callback_id, response)); | 1392 Send(new ViewMsg_ExtensionResponse(routing_id(), callback_id, response)); |
| 1393 } | 1393 } |
| OLD | NEW |