| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba
cks.h" | 123 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba
cks.h" |
| 124 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 124 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 125 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 125 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| 126 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" | 126 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" |
| 127 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 127 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| 128 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" | 128 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" |
| 129 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" | 129 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" |
| 130 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 130 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 131 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" | 131 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" |
| 132 #include "third_party/skia/include/core/SkBitmap.h" | 132 #include "third_party/skia/include/core/SkBitmap.h" |
| 133 #include "ui/base/message_box_flags.h" | 133 #include "ui/base/javascript_message_type.h" |
| 134 #include "ui/gfx/native_widget_types.h" | 134 #include "ui/gfx/native_widget_types.h" |
| 135 #include "ui/gfx/point.h" | 135 #include "ui/gfx/point.h" |
| 136 #include "ui/gfx/rect.h" | 136 #include "ui/gfx/rect.h" |
| 137 #include "v8/include/v8.h" | 137 #include "v8/include/v8.h" |
| 138 #include "webkit/appcache/web_application_cache_host_impl.h" | 138 #include "webkit/appcache/web_application_cache_host_impl.h" |
| 139 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 139 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
| 140 #include "webkit/glue/context_menu.h" | 140 #include "webkit/glue/context_menu.h" |
| 141 #include "webkit/glue/dom_operations.h" | 141 #include "webkit/glue/dom_operations.h" |
| 142 #include "webkit/glue/form_data.h" | 142 #include "webkit/glue/form_data.h" |
| 143 #include "webkit/glue/form_field.h" | 143 #include "webkit/glue/form_field.h" |
| (...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 failed_request, error, &alt_html, NULL); | 1264 failed_request, error, &alt_html, NULL); |
| 1265 error_html = &alt_html; | 1265 error_html = &alt_html; |
| 1266 } | 1266 } |
| 1267 | 1267 |
| 1268 frame->loadHTMLString(*error_html, | 1268 frame->loadHTMLString(*error_html, |
| 1269 GURL(chrome::kUnreachableWebDataURL), | 1269 GURL(chrome::kUnreachableWebDataURL), |
| 1270 error.unreachableURL, | 1270 error.unreachableURL, |
| 1271 replace); | 1271 replace); |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 bool RenderViewImpl::RunJavaScriptMessage(int type, | 1274 bool RenderViewImpl::RunJavaScriptMessage(ui::JavascriptMessageType type, |
| 1275 const string16& message, | 1275 const string16& message, |
| 1276 const string16& default_value, | 1276 const string16& default_value, |
| 1277 const GURL& frame_url, | 1277 const GURL& frame_url, |
| 1278 string16* result) { | 1278 string16* result) { |
| 1279 bool success = false; | 1279 bool success = false; |
| 1280 string16 result_temp; | 1280 string16 result_temp; |
| 1281 if (!result) | 1281 if (!result) |
| 1282 result = &result_temp; | 1282 result = &result_temp; |
| 1283 | 1283 |
| 1284 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( | 1284 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 ipc_params.title = params.title; | 1565 ipc_params.title = params.title; |
| 1566 ipc_params.default_file_name = | 1566 ipc_params.default_file_name = |
| 1567 webkit_glue::WebStringToFilePath(params.initialValue); | 1567 webkit_glue::WebStringToFilePath(params.initialValue); |
| 1568 ipc_params.accept_types.reserve(params.acceptMIMETypes.size()); | 1568 ipc_params.accept_types.reserve(params.acceptMIMETypes.size()); |
| 1569 for (size_t i = 0; i < params.acceptMIMETypes.size(); ++i) | 1569 for (size_t i = 0; i < params.acceptMIMETypes.size(); ++i) |
| 1570 ipc_params.accept_types.push_back(params.acceptMIMETypes[i]); | 1570 ipc_params.accept_types.push_back(params.acceptMIMETypes[i]); |
| 1571 | 1571 |
| 1572 return ScheduleFileChooser(ipc_params, chooser_completion); | 1572 return ScheduleFileChooser(ipc_params, chooser_completion); |
| 1573 } | 1573 } |
| 1574 | 1574 |
| 1575 void RenderViewImpl::runModalAlertDialog( | 1575 void RenderViewImpl::runModalAlertDialog(WebFrame* frame, |
| 1576 WebFrame* frame, const WebString& message) { | 1576 const WebString& message) { |
| 1577 RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptAlert, | 1577 RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_ALERT, |
| 1578 message, | 1578 message, |
| 1579 string16(), | 1579 string16(), |
| 1580 frame->document().url(), | 1580 frame->document().url(), |
| 1581 NULL); | 1581 NULL); |
| 1582 } | 1582 } |
| 1583 | 1583 |
| 1584 bool RenderViewImpl::runModalConfirmDialog( | 1584 bool RenderViewImpl::runModalConfirmDialog(WebFrame* frame, |
| 1585 WebFrame* frame, const WebString& message) { | 1585 const WebString& message) { |
| 1586 return RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptConfirm, | 1586 return RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, |
| 1587 message, | 1587 message, |
| 1588 string16(), | 1588 string16(), |
| 1589 frame->document().url(), | 1589 frame->document().url(), |
| 1590 NULL); | 1590 NULL); |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 bool RenderViewImpl::runModalPromptDialog( | 1593 bool RenderViewImpl::runModalPromptDialog(WebFrame* frame, |
| 1594 WebFrame* frame, const WebString& message, const WebString& default_value, | 1594 const WebString& message, |
| 1595 WebString* actual_value) { | 1595 const WebString& default_value, |
| 1596 WebString* actual_value) { |
| 1596 string16 result; | 1597 string16 result; |
| 1597 bool ok = RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptPrompt, | 1598 bool ok = RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT, |
| 1598 message, | 1599 message, |
| 1599 default_value, | 1600 default_value, |
| 1600 frame->document().url(), | 1601 frame->document().url(), |
| 1601 &result); | 1602 &result); |
| 1602 if (ok) | 1603 if (ok) |
| 1603 actual_value->assign(result); | 1604 actual_value->assign(result); |
| 1604 return ok; | 1605 return ok; |
| 1605 } | 1606 } |
| 1606 | 1607 |
| 1607 bool RenderViewImpl::runModalBeforeUnloadDialog( | 1608 bool RenderViewImpl::runModalBeforeUnloadDialog( |
| (...skipping 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4752 return !!RenderThreadImpl::current()->compositor_thread(); | 4753 return !!RenderThreadImpl::current()->compositor_thread(); |
| 4753 } | 4754 } |
| 4754 | 4755 |
| 4755 void RenderViewImpl::OnJavaBridgeInit( | 4756 void RenderViewImpl::OnJavaBridgeInit( |
| 4756 const IPC::ChannelHandle& channel_handle) { | 4757 const IPC::ChannelHandle& channel_handle) { |
| 4757 DCHECK(!java_bridge_dispatcher_.get()); | 4758 DCHECK(!java_bridge_dispatcher_.get()); |
| 4758 #if defined(ENABLE_JAVA_BRIDGE) | 4759 #if defined(ENABLE_JAVA_BRIDGE) |
| 4759 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4760 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
| 4760 #endif | 4761 #endif |
| 4761 } | 4762 } |
| OLD | NEW |