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 "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba
cks.h" | 124 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba
cks.h" |
125 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 125 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
126 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 126 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
127 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" | 127 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" |
128 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 128 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
129 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" | 129 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" |
130 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 130 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
131 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 131 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
132 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" | 132 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" |
133 #include "third_party/skia/include/core/SkBitmap.h" | 133 #include "third_party/skia/include/core/SkBitmap.h" |
134 #include "ui/base/message_box_flags.h" | 134 #include "ui/base/javascript_message_type.h" |
135 #include "ui/gfx/native_widget_types.h" | 135 #include "ui/gfx/native_widget_types.h" |
136 #include "ui/gfx/point.h" | 136 #include "ui/gfx/point.h" |
137 #include "ui/gfx/rect.h" | 137 #include "ui/gfx/rect.h" |
138 #include "v8/include/v8.h" | 138 #include "v8/include/v8.h" |
139 #include "webkit/appcache/web_application_cache_host_impl.h" | 139 #include "webkit/appcache/web_application_cache_host_impl.h" |
140 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 140 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
141 #include "webkit/glue/context_menu.h" | 141 #include "webkit/glue/context_menu.h" |
142 #include "webkit/glue/dom_operations.h" | 142 #include "webkit/glue/dom_operations.h" |
143 #include "webkit/glue/form_data.h" | 143 #include "webkit/glue/form_data.h" |
144 #include "webkit/glue/form_field.h" | 144 #include "webkit/glue/form_field.h" |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 failed_request, error, &alt_html, NULL); | 1276 failed_request, error, &alt_html, NULL); |
1277 error_html = &alt_html; | 1277 error_html = &alt_html; |
1278 } | 1278 } |
1279 | 1279 |
1280 frame->loadHTMLString(*error_html, | 1280 frame->loadHTMLString(*error_html, |
1281 GURL(chrome::kUnreachableWebDataURL), | 1281 GURL(chrome::kUnreachableWebDataURL), |
1282 error.unreachableURL, | 1282 error.unreachableURL, |
1283 replace); | 1283 replace); |
1284 } | 1284 } |
1285 | 1285 |
1286 bool RenderViewImpl::RunJavaScriptMessage(int type, | 1286 bool RenderViewImpl::RunJavaScriptMessage(ui::JavascriptMessageType type, |
1287 const string16& message, | 1287 const string16& message, |
1288 const string16& default_value, | 1288 const string16& default_value, |
1289 const GURL& frame_url, | 1289 const GURL& frame_url, |
1290 string16* result) { | 1290 string16* result) { |
1291 bool success = false; | 1291 bool success = false; |
1292 string16 result_temp; | 1292 string16 result_temp; |
1293 if (!result) | 1293 if (!result) |
1294 result = &result_temp; | 1294 result = &result_temp; |
1295 | 1295 |
1296 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( | 1296 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 ipc_params.title = params.title; | 1577 ipc_params.title = params.title; |
1578 ipc_params.default_file_name = | 1578 ipc_params.default_file_name = |
1579 webkit_glue::WebStringToFilePath(params.initialValue); | 1579 webkit_glue::WebStringToFilePath(params.initialValue); |
1580 ipc_params.accept_types.reserve(params.acceptMIMETypes.size()); | 1580 ipc_params.accept_types.reserve(params.acceptMIMETypes.size()); |
1581 for (size_t i = 0; i < params.acceptMIMETypes.size(); ++i) | 1581 for (size_t i = 0; i < params.acceptMIMETypes.size(); ++i) |
1582 ipc_params.accept_types.push_back(params.acceptMIMETypes[i]); | 1582 ipc_params.accept_types.push_back(params.acceptMIMETypes[i]); |
1583 | 1583 |
1584 return ScheduleFileChooser(ipc_params, chooser_completion); | 1584 return ScheduleFileChooser(ipc_params, chooser_completion); |
1585 } | 1585 } |
1586 | 1586 |
1587 void RenderViewImpl::runModalAlertDialog( | 1587 void RenderViewImpl::runModalAlertDialog(WebFrame* frame, |
1588 WebFrame* frame, const WebString& message) { | 1588 const WebString& message) { |
1589 RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptAlert, | 1589 RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_ALERT, |
1590 message, | 1590 message, |
1591 string16(), | 1591 string16(), |
1592 frame->document().url(), | 1592 frame->document().url(), |
1593 NULL); | 1593 NULL); |
1594 } | 1594 } |
1595 | 1595 |
1596 bool RenderViewImpl::runModalConfirmDialog( | 1596 bool RenderViewImpl::runModalConfirmDialog(WebFrame* frame, |
1597 WebFrame* frame, const WebString& message) { | 1597 const WebString& message) { |
1598 return RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptConfirm, | 1598 return RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, |
1599 message, | 1599 message, |
1600 string16(), | 1600 string16(), |
1601 frame->document().url(), | 1601 frame->document().url(), |
1602 NULL); | 1602 NULL); |
1603 } | 1603 } |
1604 | 1604 |
1605 bool RenderViewImpl::runModalPromptDialog( | 1605 bool RenderViewImpl::runModalPromptDialog(WebFrame* frame, |
1606 WebFrame* frame, const WebString& message, const WebString& default_value, | 1606 const WebString& message, |
1607 WebString* actual_value) { | 1607 const WebString& default_value, |
| 1608 WebString* actual_value) { |
1608 string16 result; | 1609 string16 result; |
1609 bool ok = RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptPrompt, | 1610 bool ok = RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT, |
1610 message, | 1611 message, |
1611 default_value, | 1612 default_value, |
1612 frame->document().url(), | 1613 frame->document().url(), |
1613 &result); | 1614 &result); |
1614 if (ok) | 1615 if (ok) |
1615 actual_value->assign(result); | 1616 actual_value->assign(result); |
1616 return ok; | 1617 return ok; |
1617 } | 1618 } |
1618 | 1619 |
1619 bool RenderViewImpl::runModalBeforeUnloadDialog( | 1620 bool RenderViewImpl::runModalBeforeUnloadDialog( |
(...skipping 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4792 return !!RenderThreadImpl::current()->compositor_thread(); | 4793 return !!RenderThreadImpl::current()->compositor_thread(); |
4793 } | 4794 } |
4794 | 4795 |
4795 void RenderViewImpl::OnJavaBridgeInit( | 4796 void RenderViewImpl::OnJavaBridgeInit( |
4796 const IPC::ChannelHandle& channel_handle) { | 4797 const IPC::ChannelHandle& channel_handle) { |
4797 DCHECK(!java_bridge_dispatcher_.get()); | 4798 DCHECK(!java_bridge_dispatcher_.get()); |
4798 #if defined(ENABLE_JAVA_BRIDGE) | 4799 #if defined(ENABLE_JAVA_BRIDGE) |
4799 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4800 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
4800 #endif | 4801 #endif |
4801 } | 4802 } |
OLD | NEW |