| 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/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 "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 void RenderViewHost::ReservePageIDRange(int size) { | 503 void RenderViewHost::ReservePageIDRange(int size) { |
| 504 Send(new ViewMsg_ReservePageIDRange(routing_id(), size)); | 504 Send(new ViewMsg_ReservePageIDRange(routing_id(), size)); |
| 505 } | 505 } |
| 506 | 506 |
| 507 void RenderViewHost::ExecuteJavascriptInWebFrame( | 507 void RenderViewHost::ExecuteJavascriptInWebFrame( |
| 508 const std::wstring& frame_xpath, const std::wstring& jscript) { | 508 const std::wstring& frame_xpath, const std::wstring& jscript) { |
| 509 Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript)); | 509 Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript)); |
| 510 } | 510 } |
| 511 | 511 |
| 512 void RenderViewHost::InsertCSSInWebFrame( | 512 void RenderViewHost::InsertCSSInWebFrame( |
| 513 const std::wstring& frame_xpath, const std::string& css) { | 513 const std::wstring& frame_xpath, |
| 514 Send(new ViewMsg_CSSInsertRequest(routing_id(), frame_xpath, css)); | 514 const std::string& css, |
| 515 const std::string& id) { |
| 516 Send(new ViewMsg_CSSInsertRequest(routing_id(), frame_xpath, css, id)); |
| 515 } | 517 } |
| 516 | 518 |
| 517 void RenderViewHost::AddMessageToConsole( | 519 void RenderViewHost::AddMessageToConsole( |
| 518 const string16& frame_xpath, | 520 const string16& frame_xpath, |
| 519 const string16& message, | 521 const string16& message, |
| 520 const WebConsoleMessage::Level& level) { | 522 const WebConsoleMessage::Level& level) { |
| 521 Send(new ViewMsg_AddMessageToConsole( | 523 Send(new ViewMsg_AddMessageToConsole( |
| 522 routing_id(), frame_xpath, message, level)); | 524 routing_id(), frame_xpath, message, level)); |
| 523 } | 525 } |
| 524 | 526 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 606 |
| 605 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 607 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
| 606 } | 608 } |
| 607 | 609 |
| 608 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, | 610 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, |
| 609 success, prompt); | 611 success, prompt); |
| 610 Send(reply_msg); | 612 Send(reply_msg); |
| 611 } | 613 } |
| 612 | 614 |
| 613 void RenderViewHost::JavaScriptMessageBoxWindowDestroyed() { | 615 void RenderViewHost::JavaScriptMessageBoxWindowDestroyed() { |
| 614 ResetModalDialogEvent(); | 616 ResetModalDialogEvent(); |
| 615 } | 617 } |
| 616 | 618 |
| 617 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, | 619 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, |
| 618 const std::string& json_retval) { | 620 const std::string& json_retval) { |
| 619 if (is_waiting_for_unload_ack_) | 621 if (is_waiting_for_unload_ack_) |
| 620 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 622 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
| 621 | 623 |
| 622 ResetModalDialogEvent(); | 624 ResetModalDialogEvent(); |
| 623 | 625 |
| 624 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); | 626 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 // results from the scoping effort of the Find operation. The FindInPage | 1106 // results from the scoping effort of the Find operation. The FindInPage |
| 1105 // scoping is asynchronous and periodically sends results back up to the | 1107 // scoping is asynchronous and periodically sends results back up to the |
| 1106 // browser using IPC. In an effort to not spam the browser we have the | 1108 // browser using IPC. In an effort to not spam the browser we have the |
| 1107 // browser send an ACK for each FindReply message and have the renderer | 1109 // browser send an ACK for each FindReply message and have the renderer |
| 1108 // queue up the latest status message while waiting for this ACK. | 1110 // queue up the latest status message while waiting for this ACK. |
| 1109 Send(new ViewMsg_FindReplyACK(routing_id())); | 1111 Send(new ViewMsg_FindReplyACK(routing_id())); |
| 1110 } | 1112 } |
| 1111 | 1113 |
| 1112 void RenderViewHost::OnDeterminePageTextReply( | 1114 void RenderViewHost::OnDeterminePageTextReply( |
| 1113 const std::wstring& page_text) { | 1115 const std::wstring& page_text) { |
| 1114 #if defined(OS_WIN) // Only for windows. | 1116 #if defined(OS_WIN) // Only for windows. |
| 1115 int num_languages = 0; | 1117 int num_languages = 0; |
| 1116 bool is_reliable = false; | 1118 bool is_reliable = false; |
| 1117 const char* language_iso_code = LanguageCodeISO639_1( | 1119 const char* language_iso_code = LanguageCodeISO639_1( |
| 1118 DetectLanguageOfUnicodeText(page_text.c_str(), true, &is_reliable, | 1120 DetectLanguageOfUnicodeText(page_text.c_str(), true, &is_reliable, |
| 1119 &num_languages, NULL)); | 1121 &num_languages, NULL)); |
| 1120 std::string language(language_iso_code); | 1122 std::string language(language_iso_code); |
| 1121 NotificationService::current()->Notify( | 1123 NotificationService::current()->Notify( |
| 1122 NotificationType::TAB_LANGUAGE_DETERMINED, | 1124 NotificationType::TAB_LANGUAGE_DETERMINED, |
| 1123 Source<RenderViewHost>(this), | 1125 Source<RenderViewHost>(this), |
| 1124 Details<std::string>(&language)); | 1126 Details<std::string>(&language)); |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 void RenderViewHost::OnCSSInserted() { | 1666 void RenderViewHost::OnCSSInserted() { |
| 1665 delegate_->DidInsertCSS(); | 1667 delegate_->DidInsertCSS(); |
| 1666 } | 1668 } |
| 1667 | 1669 |
| 1668 void RenderViewHost::SignalModalDialogEvent() { | 1670 void RenderViewHost::SignalModalDialogEvent() { |
| 1669 if (modal_dialog_count_++ == 0) | 1671 if (modal_dialog_count_++ == 0) |
| 1670 modal_dialog_event_->Signal(); | 1672 modal_dialog_event_->Signal(); |
| 1671 } | 1673 } |
| 1672 | 1674 |
| 1673 void RenderViewHost::ResetModalDialogEvent() { | 1675 void RenderViewHost::ResetModalDialogEvent() { |
| 1674 if (--modal_dialog_count_ == 0) | 1676 if (--modal_dialog_count_ == 0) |
| 1675 modal_dialog_event_->Reset(); | 1677 modal_dialog_event_->Reset(); |
| 1676 } | 1678 } |
| 1677 | 1679 |
| 1678 void RenderViewHost::UpdateBrowserWindowId(int window_id) { | 1680 void RenderViewHost::UpdateBrowserWindowId(int window_id) { |
| 1679 Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); | 1681 Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); |
| 1680 } | 1682 } |
| OLD | NEW |