OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 replace); | 1854 replace); |
1855 } | 1855 } |
1856 | 1856 |
1857 void RenderView::BindDOMAutomationController(WebFrame* frame) { | 1857 void RenderView::BindDOMAutomationController(WebFrame* frame) { |
1858 if (!dom_automation_controller_.get()) { | 1858 if (!dom_automation_controller_.get()) { |
1859 dom_automation_controller_.reset(new DomAutomationController()); | 1859 dom_automation_controller_.reset(new DomAutomationController()); |
1860 } | 1860 } |
1861 dom_automation_controller_->set_message_sender(this); | 1861 dom_automation_controller_->set_message_sender(this); |
1862 dom_automation_controller_->set_routing_id(routing_id_); | 1862 dom_automation_controller_->set_routing_id(routing_id_); |
1863 dom_automation_controller_->BindToJavascript(frame, | 1863 dom_automation_controller_->BindToJavascript(frame, |
1864 L"domAutomationController"); | 1864 "domAutomationController"); |
1865 } | 1865 } |
1866 | 1866 |
1867 bool RenderView::RunJavaScriptMessage(int type, | 1867 bool RenderView::RunJavaScriptMessage(int type, |
1868 const std::wstring& message, | 1868 const std::wstring& message, |
1869 const std::wstring& default_value, | 1869 const std::wstring& default_value, |
1870 const GURL& frame_url, | 1870 const GURL& frame_url, |
1871 std::wstring* result) { | 1871 std::wstring* result) { |
1872 bool success = false; | 1872 bool success = false; |
1873 std::wstring result_temp; | 1873 std::wstring result_temp; |
1874 if (!result) | 1874 if (!result) |
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3401 void RenderView::didClearWindowObject(WebFrame* frame) { | 3401 void RenderView::didClearWindowObject(WebFrame* frame) { |
3402 if (BindingsPolicy::is_dom_automation_enabled(enabled_bindings_)) | 3402 if (BindingsPolicy::is_dom_automation_enabled(enabled_bindings_)) |
3403 BindDOMAutomationController(frame); | 3403 BindDOMAutomationController(frame); |
3404 GURL frame_url = frame->url(); | 3404 GURL frame_url = frame->url(); |
3405 if (BindingsPolicy::is_dom_ui_enabled(enabled_bindings_) && | 3405 if (BindingsPolicy::is_dom_ui_enabled(enabled_bindings_) && |
3406 (frame_url.SchemeIs(chrome::kChromeUIScheme) || | 3406 (frame_url.SchemeIs(chrome::kChromeUIScheme) || |
3407 frame_url.SchemeIs(chrome::kGearsScheme) || | 3407 frame_url.SchemeIs(chrome::kGearsScheme) || |
3408 frame_url.SchemeIs(chrome::kDataScheme))) { | 3408 frame_url.SchemeIs(chrome::kDataScheme))) { |
3409 GetDOMUIBindings()->set_message_sender(this); | 3409 GetDOMUIBindings()->set_message_sender(this); |
3410 GetDOMUIBindings()->set_routing_id(routing_id_); | 3410 GetDOMUIBindings()->set_routing_id(routing_id_); |
3411 GetDOMUIBindings()->BindToJavascript(frame, L"chrome"); | 3411 GetDOMUIBindings()->BindToJavascript(frame, "chrome"); |
3412 } | 3412 } |
3413 if (BindingsPolicy::is_external_host_enabled(enabled_bindings_)) { | 3413 if (BindingsPolicy::is_external_host_enabled(enabled_bindings_)) { |
3414 GetExternalHostBindings()->set_message_sender(this); | 3414 GetExternalHostBindings()->set_message_sender(this); |
3415 GetExternalHostBindings()->set_routing_id(routing_id_); | 3415 GetExternalHostBindings()->set_routing_id(routing_id_); |
3416 GetExternalHostBindings()->BindToJavascript(frame, L"externalHost"); | 3416 GetExternalHostBindings()->BindToJavascript(frame, "externalHost"); |
3417 } | 3417 } |
3418 } | 3418 } |
3419 | 3419 |
3420 void RenderView::didCreateDocumentElement(WebFrame* frame) { | 3420 void RenderView::didCreateDocumentElement(WebFrame* frame) { |
3421 if (RenderThread::current()) { // Will be NULL during unit tests. | 3421 if (RenderThread::current()) { // Will be NULL during unit tests. |
3422 RenderThread::current()->user_script_slave()->InjectScripts( | 3422 RenderThread::current()->user_script_slave()->InjectScripts( |
3423 frame, UserScript::DOCUMENT_START); | 3423 frame, UserScript::DOCUMENT_START); |
3424 } | 3424 } |
3425 | 3425 |
3426 // Notify the browser about non-blank documents loading in the top frame. | 3426 // Notify the browser about non-blank documents loading in the top frame. |
(...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5666 external_popup_menu_.reset(); | 5666 external_popup_menu_.reset(); |
5667 } | 5667 } |
5668 #endif | 5668 #endif |
5669 | 5669 |
5670 void RenderView::AddErrorToRootConsole(const string16& message) { | 5670 void RenderView::AddErrorToRootConsole(const string16& message) { |
5671 if (webview() && webview()->mainFrame()) { | 5671 if (webview() && webview()->mainFrame()) { |
5672 webview()->mainFrame()->addMessageToConsole( | 5672 webview()->mainFrame()->addMessageToConsole( |
5673 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 5673 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
5674 } | 5674 } |
5675 } | 5675 } |
OLD | NEW |