| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 499 void RenderViewHost::ReservePageIDRange(int size) { | 499 void RenderViewHost::ReservePageIDRange(int size) { | 
| 500   Send(new ViewMsg_ReservePageIDRange(routing_id(), size)); | 500   Send(new ViewMsg_ReservePageIDRange(routing_id(), size)); | 
| 501 } | 501 } | 
| 502 | 502 | 
| 503 void RenderViewHost::ExecuteJavascriptInWebFrame( | 503 void RenderViewHost::ExecuteJavascriptInWebFrame( | 
| 504     const std::wstring& frame_xpath, const std::wstring& jscript) { | 504     const std::wstring& frame_xpath, const std::wstring& jscript) { | 
| 505   Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript)); | 505   Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript)); | 
| 506 } | 506 } | 
| 507 | 507 | 
| 508 void RenderViewHost::InsertCSSInWebFrame( | 508 void RenderViewHost::InsertCSSInWebFrame( | 
| 509     const std::wstring& frame_xpath, const std::string& css) { | 509     const std::wstring& frame_xpath, | 
| 510   Send(new ViewMsg_CSSInsertRequest(routing_id(), frame_xpath, css)); | 510     const std::string& css, | 
|  | 511     const std::string& id) { | 
|  | 512   Send(new ViewMsg_CSSInsertRequest(routing_id(), frame_xpath, css, id)); | 
| 511 } | 513 } | 
| 512 | 514 | 
| 513 void RenderViewHost::AddMessageToConsole( | 515 void RenderViewHost::AddMessageToConsole( | 
| 514     const string16& frame_xpath, | 516     const string16& frame_xpath, | 
| 515     const string16& message, | 517     const string16& message, | 
| 516     const WebConsoleMessage::Level& level) { | 518     const WebConsoleMessage::Level& level) { | 
| 517   Send(new ViewMsg_AddMessageToConsole( | 519   Send(new ViewMsg_AddMessageToConsole( | 
| 518       routing_id(), frame_xpath, message, level)); | 520       routing_id(), frame_xpath, message, level)); | 
| 519 } | 521 } | 
| 520 | 522 | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 593 | 595 | 
| 594     StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 596     StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 
| 595   } | 597   } | 
| 596 | 598 | 
| 597   ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, | 599   ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, | 
| 598                                                      success, prompt); | 600                                                      success, prompt); | 
| 599   Send(reply_msg); | 601   Send(reply_msg); | 
| 600 } | 602 } | 
| 601 | 603 | 
| 602 void RenderViewHost::JavaScriptMessageBoxWindowDestroyed() { | 604 void RenderViewHost::JavaScriptMessageBoxWindowDestroyed() { | 
| 603  ResetModalDialogEvent(); | 605   ResetModalDialogEvent(); | 
| 604 } | 606 } | 
| 605 | 607 | 
| 606 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, | 608 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, | 
| 607                                            const std::string& json_retval) { | 609                                            const std::string& json_retval) { | 
| 608   if (is_waiting_for_unload_ack_) | 610   if (is_waiting_for_unload_ack_) | 
| 609     StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 611     StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 
| 610 | 612 | 
| 611   ResetModalDialogEvent(); | 613   ResetModalDialogEvent(); | 
| 612 | 614 | 
| 613   ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); | 615   ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); | 
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1093   // results from the scoping effort of the Find operation. The FindInPage | 1095   // results from the scoping effort of the Find operation. The FindInPage | 
| 1094   // scoping is asynchronous and periodically sends results back up to the | 1096   // scoping is asynchronous and periodically sends results back up to the | 
| 1095   // browser using IPC. In an effort to not spam the browser we have the | 1097   // browser using IPC. In an effort to not spam the browser we have the | 
| 1096   // browser send an ACK for each FindReply message and have the renderer | 1098   // browser send an ACK for each FindReply message and have the renderer | 
| 1097   // queue up the latest status message while waiting for this ACK. | 1099   // queue up the latest status message while waiting for this ACK. | 
| 1098   Send(new ViewMsg_FindReplyACK(routing_id())); | 1100   Send(new ViewMsg_FindReplyACK(routing_id())); | 
| 1099 } | 1101 } | 
| 1100 | 1102 | 
| 1101 void RenderViewHost::OnDeterminePageTextReply( | 1103 void RenderViewHost::OnDeterminePageTextReply( | 
| 1102     const std::wstring& page_text) { | 1104     const std::wstring& page_text) { | 
| 1103 #if defined(OS_WIN) // Only for windows. | 1105 #if defined(OS_WIN)  // Only for windows. | 
| 1104     int num_languages = 0; | 1106     int num_languages = 0; | 
| 1105     bool is_reliable = false; | 1107     bool is_reliable = false; | 
| 1106     const char* language_iso_code = LanguageCodeISO639_1( | 1108     const char* language_iso_code = LanguageCodeISO639_1( | 
| 1107         DetectLanguageOfUnicodeText(page_text.c_str(), true, &is_reliable, | 1109         DetectLanguageOfUnicodeText(page_text.c_str(), true, &is_reliable, | 
| 1108                                     &num_languages, NULL)); | 1110                                     &num_languages, NULL)); | 
| 1109     std::string language(language_iso_code); | 1111     std::string language(language_iso_code); | 
| 1110     NotificationService::current()->Notify( | 1112     NotificationService::current()->Notify( | 
| 1111         NotificationType::TAB_LANGUAGE_DETERMINED, | 1113         NotificationType::TAB_LANGUAGE_DETERMINED, | 
| 1112         Source<RenderViewHost>(this), | 1114         Source<RenderViewHost>(this), | 
| 1113         Details<std::string>(&language)); | 1115         Details<std::string>(&language)); | 
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1653 void RenderViewHost::OnCSSInserted() { | 1655 void RenderViewHost::OnCSSInserted() { | 
| 1654   delegate_->DidInsertCSS(); | 1656   delegate_->DidInsertCSS(); | 
| 1655 } | 1657 } | 
| 1656 | 1658 | 
| 1657 void RenderViewHost::SignalModalDialogEvent() { | 1659 void RenderViewHost::SignalModalDialogEvent() { | 
| 1658   if (modal_dialog_count_++ == 0) | 1660   if (modal_dialog_count_++ == 0) | 
| 1659     modal_dialog_event_->Signal(); | 1661     modal_dialog_event_->Signal(); | 
| 1660 } | 1662 } | 
| 1661 | 1663 | 
| 1662 void RenderViewHost::ResetModalDialogEvent() { | 1664 void RenderViewHost::ResetModalDialogEvent() { | 
| 1663  if (--modal_dialog_count_ == 0) | 1665   if (--modal_dialog_count_ == 0) | 
| 1664    modal_dialog_event_->Reset(); | 1666     modal_dialog_event_->Reset(); | 
| 1665 } | 1667 } | 
| 1666 | 1668 | 
| 1667 void RenderViewHost::UpdateBrowserWindowId(int window_id) { | 1669 void RenderViewHost::UpdateBrowserWindowId(int window_id) { | 
| 1668   Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); | 1670   Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); | 
| 1669 } | 1671 } | 
| OLD | NEW | 
|---|