OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1937 dom_automation_controller_->set_message_sender(this); | 1937 dom_automation_controller_->set_message_sender(this); |
1938 dom_automation_controller_->set_routing_id(routing_id_); | 1938 dom_automation_controller_->set_routing_id(routing_id_); |
1939 dom_automation_controller_->BindToJavascript(frame, | 1939 dom_automation_controller_->BindToJavascript(frame, |
1940 "domAutomationController"); | 1940 "domAutomationController"); |
1941 } | 1941 } |
1942 | 1942 |
1943 bool RenderView::RunJavaScriptMessage(int type, | 1943 bool RenderView::RunJavaScriptMessage(int type, |
1944 const std::wstring& message, | 1944 const std::wstring& message, |
1945 const std::wstring& default_value, | 1945 const std::wstring& default_value, |
1946 const GURL& frame_url, | 1946 const GURL& frame_url, |
| 1947 const bool unload_handler_being_run, |
1947 std::wstring* result) { | 1948 std::wstring* result) { |
1948 bool success = false; | 1949 bool success = false; |
1949 std::wstring result_temp; | 1950 std::wstring result_temp; |
1950 if (!result) | 1951 if (!result) |
1951 result = &result_temp; | 1952 result = &result_temp; |
1952 | 1953 |
1953 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( | 1954 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( |
1954 routing_id_, message, default_value, frame_url, type, &success, result)); | 1955 routing_id_, message, default_value, frame_url, type, |
| 1956 unload_handler_being_run, &success, result)); |
1955 return success; | 1957 return success; |
1956 } | 1958 } |
1957 | 1959 |
1958 bool RenderView::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { | 1960 bool RenderView::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { |
1959 // Before WebKit asks us to show an alert (etc.), it takes care of doing the | 1961 // Before WebKit asks us to show an alert (etc.), it takes care of doing the |
1960 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog | 1962 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog |
1961 // it is particularly important that we do not call willEnterModalLoop as | 1963 // it is particularly important that we do not call willEnterModalLoop as |
1962 // that would defer resource loads for the dialog itself. | 1964 // that would defer resource loads for the dialog itself. |
1963 if (RenderThread::current()) // Will be NULL during unit tests. | 1965 if (RenderThread::current()) // Will be NULL during unit tests. |
1964 RenderThread::current()->DoNotNotifyWebKitOfModalLoop(); | 1966 RenderThread::current()->DoNotNotifyWebKitOfModalLoop(); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2385 | 2387 |
2386 return ScheduleFileChooser(ipc_params, chooser_completion); | 2388 return ScheduleFileChooser(ipc_params, chooser_completion); |
2387 } | 2389 } |
2388 | 2390 |
2389 void RenderView::runModalAlertDialog( | 2391 void RenderView::runModalAlertDialog( |
2390 WebFrame* frame, const WebString& message) { | 2392 WebFrame* frame, const WebString& message) { |
2391 RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptAlert, | 2393 RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptAlert, |
2392 UTF16ToWideHack(message), | 2394 UTF16ToWideHack(message), |
2393 std::wstring(), | 2395 std::wstring(), |
2394 frame->url(), | 2396 frame->url(), |
| 2397 frame->pageDismissalEventBeingDispatched(), |
2395 NULL); | 2398 NULL); |
2396 } | 2399 } |
2397 | 2400 |
2398 bool RenderView::runModalConfirmDialog( | 2401 bool RenderView::runModalConfirmDialog( |
2399 WebFrame* frame, const WebString& message) { | 2402 WebFrame* frame, const WebString& message) { |
2400 return RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptConfirm, | 2403 return RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptConfirm, |
2401 UTF16ToWideHack(message), | 2404 UTF16ToWideHack(message), |
2402 std::wstring(), | 2405 std::wstring(), |
2403 frame->url(), | 2406 frame->url(), |
| 2407 frame->pageDismissalEventBeingDispatched(), |
2404 NULL); | 2408 NULL); |
2405 } | 2409 } |
2406 | 2410 |
2407 bool RenderView::runModalPromptDialog( | 2411 bool RenderView::runModalPromptDialog( |
2408 WebFrame* frame, const WebString& message, const WebString& default_value, | 2412 WebFrame* frame, const WebString& message, const WebString& default_value, |
2409 WebString* actual_value) { | 2413 WebString* actual_value) { |
2410 std::wstring result; | 2414 std::wstring result; |
2411 bool ok = RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptPrompt, | 2415 bool ok = RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptPrompt, |
2412 UTF16ToWideHack(message), | 2416 UTF16ToWideHack(message), |
2413 UTF16ToWideHack(default_value), | 2417 UTF16ToWideHack(default_value), |
2414 frame->url(), | 2418 frame->url(), |
| 2419 frame->pageDismissalEventBeingDispatched(), |
2415 &result); | 2420 &result); |
2416 if (ok) | 2421 if (ok) |
2417 actual_value->assign(WideToUTF16Hack(result)); | 2422 actual_value->assign(WideToUTF16Hack(result)); |
2418 return ok; | 2423 return ok; |
2419 } | 2424 } |
2420 | 2425 |
2421 bool RenderView::runModalBeforeUnloadDialog( | 2426 bool RenderView::runModalBeforeUnloadDialog( |
2422 WebFrame* frame, const WebString& message) { | 2427 WebFrame* frame, const WebString& message) { |
2423 bool success = false; | 2428 bool success = false; |
2424 // This is an ignored return value, but is included so we can accept the same | 2429 // This is an ignored return value, but is included so we can accept the same |
(...skipping 3180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5605 const webkit_glue::CustomContextMenuContext& custom_context) { | 5610 const webkit_glue::CustomContextMenuContext& custom_context) { |
5606 if (custom_context.is_pepper_menu) | 5611 if (custom_context.is_pepper_menu) |
5607 pepper_delegate_.OnContextMenuClosed(custom_context); | 5612 pepper_delegate_.OnContextMenuClosed(custom_context); |
5608 else | 5613 else |
5609 context_menu_node_.reset(); | 5614 context_menu_node_.reset(); |
5610 } | 5615 } |
5611 | 5616 |
5612 void RenderView::OnNetworkStateChanged(bool online) { | 5617 void RenderView::OnNetworkStateChanged(bool online) { |
5613 WebNetworkStateNotifier::setOnLine(online); | 5618 WebNetworkStateNotifier::setOnLine(online); |
5614 } | 5619 } |
OLD | NEW |