| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 #include "skia/public/type_converters.h" | 116 #include "skia/public/type_converters.h" |
| 117 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 117 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
| 118 #include "third_party/skia/include/core/SkBitmap.h" | 118 #include "third_party/skia/include/core/SkBitmap.h" |
| 119 #include "ui/base/layout.h" | 119 #include "ui/base/layout.h" |
| 120 #include "ui/gfx/display.h" | 120 #include "ui/gfx/display.h" |
| 121 #include "ui/gfx/screen.h" | 121 #include "ui/gfx/screen.h" |
| 122 #include "ui/gl/gl_switches.h" | 122 #include "ui/gl/gl_switches.h" |
| 123 | 123 |
| 124 #if defined(OS_ANDROID) | 124 #if defined(OS_ANDROID) |
| 125 #include "content/browser/android/content_video_view.h" | 125 #include "content/browser/android/content_video_view.h" |
| 126 #include "content/browser/android/date_time_chooser_android.h" |
| 126 #include "content/browser/media/android/media_session.h" | 127 #include "content/browser/media/android/media_session.h" |
| 127 #include "content/browser/media/android/media_web_contents_observer_android.h" | 128 #include "content/browser/media/android/media_web_contents_observer_android.h" |
| 129 #include "content/browser/web_contents/web_contents_android.h" |
| 128 #endif // OS_ANDROID | 130 #endif // OS_ANDROID |
| 129 | 131 |
| 130 #if defined(OS_ANDROID) && !defined(USE_AURA) | |
| 131 #include "content/browser/android/date_time_chooser_android.h" | |
| 132 #include "content/browser/web_contents/web_contents_android.h" | |
| 133 #endif // OS_ANDROID && !USE_AURA | |
| 134 | |
| 135 #if defined(OS_MACOSX) | 132 #if defined(OS_MACOSX) |
| 136 #include "base/mac/foundation_util.h" | 133 #include "base/mac/foundation_util.h" |
| 137 #endif | 134 #endif |
| 138 | 135 |
| 139 #if defined(MOJO_SHELL_CLIENT) | 136 #if defined(MOJO_SHELL_CLIENT) |
| 140 #include "content/browser/web_contents/web_contents_view_mus.h" | 137 #include "content/browser/web_contents/web_contents_view_mus.h" |
| 141 #include "content/public/common/mojo_shell_connection.h" | 138 #include "content/public/common/mojo_shell_connection.h" |
| 142 #include "ui/aura/mus/mus_util.h" | 139 #include "ui/aura/mus/mus_util.h" |
| 143 #endif | 140 #endif |
| 144 | 141 |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 OnBrowserPluginMessage(render_frame_host, | 670 OnBrowserPluginMessage(render_frame_host, |
| 674 message)) | 671 message)) |
| 675 #endif | 672 #endif |
| 676 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 673 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
| 677 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, | 674 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, |
| 678 OnShowValidationMessage) | 675 OnShowValidationMessage) |
| 679 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, | 676 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, |
| 680 OnHideValidationMessage) | 677 OnHideValidationMessage) |
| 681 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, | 678 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, |
| 682 OnMoveValidationMessage) | 679 OnMoveValidationMessage) |
| 683 #if defined(OS_ANDROID) && !defined(USE_AURA) | 680 #if defined(OS_ANDROID) |
| 684 IPC_MESSAGE_HANDLER(FrameHostMsg_FindMatchRects_Reply, | 681 IPC_MESSAGE_HANDLER(FrameHostMsg_FindMatchRects_Reply, |
| 685 OnFindMatchRectsReply) | 682 OnFindMatchRectsReply) |
| 686 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, | 683 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, |
| 687 OnOpenDateTimeDialog) | 684 OnOpenDateTimeDialog) |
| 688 #endif | 685 #endif |
| 689 IPC_MESSAGE_UNHANDLED(handled = false) | 686 IPC_MESSAGE_UNHANDLED(handled = false) |
| 690 IPC_END_MESSAGE_MAP() | 687 IPC_END_MESSAGE_MAP() |
| 691 render_view_message_source_ = NULL; | 688 render_view_message_source_ = NULL; |
| 692 render_frame_message_source_ = NULL; | 689 render_frame_message_source_ = NULL; |
| 693 | 690 |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 | 1424 |
| 1428 registrar_.Add(this, | 1425 registrar_.Add(this, |
| 1429 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 1426 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
| 1430 NotificationService::AllBrowserContextsAndSources()); | 1427 NotificationService::AllBrowserContextsAndSources()); |
| 1431 | 1428 |
| 1432 screen_orientation_dispatcher_host_.reset( | 1429 screen_orientation_dispatcher_host_.reset( |
| 1433 new ScreenOrientationDispatcherHostImpl(this)); | 1430 new ScreenOrientationDispatcherHostImpl(this)); |
| 1434 | 1431 |
| 1435 manifest_manager_host_.reset(new ManifestManagerHost(this)); | 1432 manifest_manager_host_.reset(new ManifestManagerHost(this)); |
| 1436 | 1433 |
| 1437 #if defined(OS_ANDROID) && !defined(USE_AURA) | 1434 #if defined(OS_ANDROID) |
| 1438 date_time_chooser_.reset(new DateTimeChooserAndroid()); | 1435 date_time_chooser_.reset(new DateTimeChooserAndroid()); |
| 1439 #endif | 1436 #endif |
| 1440 | 1437 |
| 1441 // BrowserPluginGuest::Init needs to be called after this WebContents has | 1438 // BrowserPluginGuest::Init needs to be called after this WebContents has |
| 1442 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above. | 1439 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above. |
| 1443 if (browser_plugin_guest_) | 1440 if (browser_plugin_guest_) |
| 1444 browser_plugin_guest_->Init(); | 1441 browser_plugin_guest_->Init(); |
| 1445 | 1442 |
| 1446 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 1443 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
| 1447 g_created_callbacks.Get().at(i).Run(this); | 1444 g_created_callbacks.Get().at(i).Run(this); |
| (...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3358 int number_of_matches, | 3355 int number_of_matches, |
| 3359 const gfx::Rect& selection_rect, | 3356 const gfx::Rect& selection_rect, |
| 3360 int active_match_ordinal, | 3357 int active_match_ordinal, |
| 3361 bool final_update) { | 3358 bool final_update) { |
| 3362 if (delegate_) { | 3359 if (delegate_) { |
| 3363 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, | 3360 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, |
| 3364 active_match_ordinal, final_update); | 3361 active_match_ordinal, final_update); |
| 3365 } | 3362 } |
| 3366 } | 3363 } |
| 3367 | 3364 |
| 3368 #if defined(OS_ANDROID) && !defined(USE_AURA) | 3365 #if defined(OS_ANDROID) |
| 3369 void WebContentsImpl::OnFindMatchRectsReply( | 3366 void WebContentsImpl::OnFindMatchRectsReply( |
| 3370 int version, | 3367 int version, |
| 3371 const std::vector<gfx::RectF>& rects, | 3368 const std::vector<gfx::RectF>& rects, |
| 3372 const gfx::RectF& active_rect) { | 3369 const gfx::RectF& active_rect) { |
| 3373 if (delegate_) | 3370 if (delegate_) |
| 3374 delegate_->FindMatchRectsReply(this, version, rects, active_rect); | 3371 delegate_->FindMatchRectsReply(this, version, rects, active_rect); |
| 3375 } | 3372 } |
| 3376 | 3373 |
| 3377 void WebContentsImpl::OnOpenDateTimeDialog( | 3374 void WebContentsImpl::OnOpenDateTimeDialog( |
| 3378 const ViewHostMsg_DateTimeDialogValue_Params& value) { | 3375 const ViewHostMsg_DateTimeDialogValue_Params& value) { |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4570 parent_routing_id, previous_sibling_routing_id)) | 4567 parent_routing_id, previous_sibling_routing_id)) |
| 4571 return false; | 4568 return false; |
| 4572 | 4569 |
| 4573 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed | 4570 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed |
| 4574 // RenderFrameHost will have to be associated with the appropriate | 4571 // RenderFrameHost will have to be associated with the appropriate |
| 4575 // RenderWidgetHostView or a new one should be created here. | 4572 // RenderWidgetHostView or a new one should be created here. |
| 4576 | 4573 |
| 4577 return true; | 4574 return true; |
| 4578 } | 4575 } |
| 4579 | 4576 |
| 4580 #if defined(OS_ANDROID) && !defined(USE_AURA) | 4577 #if defined(OS_ANDROID) |
| 4581 | 4578 |
| 4582 base::android::ScopedJavaLocalRef<jobject> | 4579 base::android::ScopedJavaLocalRef<jobject> |
| 4583 WebContentsImpl::GetJavaWebContents() { | 4580 WebContentsImpl::GetJavaWebContents() { |
| 4584 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 4581 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 4585 return GetWebContentsAndroid()->GetJavaObject(); | 4582 return GetWebContentsAndroid()->GetJavaObject(); |
| 4586 } | 4583 } |
| 4587 | 4584 |
| 4588 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() { | 4585 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() { |
| 4589 WebContentsAndroid* web_contents_android = | 4586 WebContentsAndroid* web_contents_android = |
| 4590 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); | 4587 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4746 const WebContentsObserver::MediaPlayerId& id) { | 4743 const WebContentsObserver::MediaPlayerId& id) { |
| 4747 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); | 4744 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); |
| 4748 } | 4745 } |
| 4749 | 4746 |
| 4750 void WebContentsImpl::MediaStoppedPlaying( | 4747 void WebContentsImpl::MediaStoppedPlaying( |
| 4751 const WebContentsObserver::MediaPlayerId& id) { | 4748 const WebContentsObserver::MediaPlayerId& id) { |
| 4752 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); | 4749 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); |
| 4753 } | 4750 } |
| 4754 | 4751 |
| 4755 } // namespace content | 4752 } // namespace content |
| OLD | NEW |