Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1411503005: Aura on Android: content/browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@auraclank_upstream_select_file
Patch Set: Addressing remaining feedback, cleaning up build files. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 #include "ui/gfx/display.h" 114 #include "ui/gfx/display.h"
115 #include "ui/gfx/screen.h" 115 #include "ui/gfx/screen.h"
116 #include "ui/gl/gl_switches.h" 116 #include "ui/gl/gl_switches.h"
117 117
118 #if defined(ENABLE_BROWSER_CDMS) 118 #if defined(ENABLE_BROWSER_CDMS)
119 #include "content/browser/media/media_web_contents_observer.h" 119 #include "content/browser/media/media_web_contents_observer.h"
120 #endif 120 #endif
121 121
122 #if defined(OS_ANDROID) 122 #if defined(OS_ANDROID)
123 #include "content/browser/android/content_video_view.h" 123 #include "content/browser/android/content_video_view.h"
124 #include "content/browser/media/android/media_session.h"
125 #endif // OS_ANDROID
126
127 #if defined(OS_ANDROID) && !defined(USE_AURA)
124 #include "content/browser/android/date_time_chooser_android.h" 128 #include "content/browser/android/date_time_chooser_android.h"
125 #include "content/browser/media/android/media_session.h"
126 #include "content/browser/web_contents/web_contents_android.h" 129 #include "content/browser/web_contents/web_contents_android.h"
127 #endif 130 #endif // OS_ANDROID && !USE_AURA
128 131
129 #if defined(OS_MACOSX) 132 #if defined(OS_MACOSX)
130 #include "base/mac/foundation_util.h" 133 #include "base/mac/foundation_util.h"
131 #endif 134 #endif
132 135
133 namespace content { 136 namespace content {
134 namespace { 137 namespace {
135 138
136 const int kMinimumDelayBetweenLoadingUpdatesMS = 100; 139 const int kMinimumDelayBetweenLoadingUpdatesMS = 100;
137 const char kDotGoogleDotCom[] = ".google.com"; 140 const char kDotGoogleDotCom[] = ".google.com";
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 OnBrowserPluginMessage(render_frame_host, 664 OnBrowserPluginMessage(render_frame_host,
662 message)) 665 message))
663 #endif 666 #endif
664 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) 667 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL)
665 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, 668 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage,
666 OnShowValidationMessage) 669 OnShowValidationMessage)
667 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, 670 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage,
668 OnHideValidationMessage) 671 OnHideValidationMessage)
669 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, 672 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage,
670 OnMoveValidationMessage) 673 OnMoveValidationMessage)
671 #if defined(OS_ANDROID) 674 #if defined(OS_ANDROID) && !defined(USE_AURA)
672 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, 675 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply,
673 OnFindMatchRectsReply) 676 OnFindMatchRectsReply)
674 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, 677 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog,
675 OnOpenDateTimeDialog) 678 OnOpenDateTimeDialog)
676 #endif 679 #endif
677 IPC_MESSAGE_UNHANDLED(handled = false) 680 IPC_MESSAGE_UNHANDLED(handled = false)
678 IPC_END_MESSAGE_MAP() 681 IPC_END_MESSAGE_MAP()
679 render_view_message_source_ = NULL; 682 render_view_message_source_ = NULL;
680 render_frame_message_source_ = NULL; 683 render_frame_message_source_ = NULL;
681 684
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 1407
1405 registrar_.Add(this, 1408 registrar_.Add(this,
1406 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 1409 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
1407 NotificationService::AllBrowserContextsAndSources()); 1410 NotificationService::AllBrowserContextsAndSources());
1408 1411
1409 screen_orientation_dispatcher_host_.reset( 1412 screen_orientation_dispatcher_host_.reset(
1410 new ScreenOrientationDispatcherHostImpl(this)); 1413 new ScreenOrientationDispatcherHostImpl(this));
1411 1414
1412 manifest_manager_host_.reset(new ManifestManagerHost(this)); 1415 manifest_manager_host_.reset(new ManifestManagerHost(this));
1413 1416
1414 #if defined(OS_ANDROID) 1417 #if defined(OS_ANDROID) && !defined(USE_AURA)
1415 date_time_chooser_.reset(new DateTimeChooserAndroid()); 1418 date_time_chooser_.reset(new DateTimeChooserAndroid());
1416 #endif 1419 #endif
1417 1420
1418 // BrowserPluginGuest::Init needs to be called after this WebContents has 1421 // BrowserPluginGuest::Init needs to be called after this WebContents has
1419 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above. 1422 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above.
1420 if (browser_plugin_guest_) 1423 if (browser_plugin_guest_)
1421 browser_plugin_guest_->Init(); 1424 browser_plugin_guest_->Init();
1422 1425
1423 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) 1426 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
1424 g_created_callbacks.Get().at(i).Run(this); 1427 g_created_callbacks.Get().at(i).Run(this);
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
3200 int number_of_matches, 3203 int number_of_matches,
3201 const gfx::Rect& selection_rect, 3204 const gfx::Rect& selection_rect,
3202 int active_match_ordinal, 3205 int active_match_ordinal,
3203 bool final_update) { 3206 bool final_update) {
3204 if (delegate_) { 3207 if (delegate_) {
3205 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, 3208 delegate_->FindReply(this, request_id, number_of_matches, selection_rect,
3206 active_match_ordinal, final_update); 3209 active_match_ordinal, final_update);
3207 } 3210 }
3208 } 3211 }
3209 3212
3210 #if defined(OS_ANDROID) 3213 #if defined(OS_ANDROID) && !defined(USE_AURA)
3211 void WebContentsImpl::OnFindMatchRectsReply( 3214 void WebContentsImpl::OnFindMatchRectsReply(
3212 int version, 3215 int version,
3213 const std::vector<gfx::RectF>& rects, 3216 const std::vector<gfx::RectF>& rects,
3214 const gfx::RectF& active_rect) { 3217 const gfx::RectF& active_rect) {
3215 if (delegate_) 3218 if (delegate_)
3216 delegate_->FindMatchRectsReply(this, version, rects, active_rect); 3219 delegate_->FindMatchRectsReply(this, version, rects, active_rect);
3217 } 3220 }
3218 3221
3219 void WebContentsImpl::OnOpenDateTimeDialog( 3222 void WebContentsImpl::OnOpenDateTimeDialog(
3220 const ViewHostMsg_DateTimeDialogValue_Params& value) { 3223 const ViewHostMsg_DateTimeDialogValue_Params& value) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3363 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 3366 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
3364 PowerSaveBlocker::kReasonAudioPlayback, "Playing audio"); 3367 PowerSaveBlocker::kReasonAudioPlayback, "Playing audio");
3365 } 3368 }
3366 3369
3367 void WebContentsImpl::CreateVideoPowerSaveBlocker() { 3370 void WebContentsImpl::CreateVideoPowerSaveBlocker() {
3368 DCHECK(!video_power_save_blocker_); 3371 DCHECK(!video_power_save_blocker_);
3369 DCHECK(!active_video_players_.empty()); 3372 DCHECK(!active_video_players_.empty());
3370 video_power_save_blocker_ = PowerSaveBlocker::Create( 3373 video_power_save_blocker_ = PowerSaveBlocker::Create(
3371 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, 3374 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
3372 PowerSaveBlocker::kReasonVideoPlayback, "Playing video"); 3375 PowerSaveBlocker::kReasonVideoPlayback, "Playing video");
3373 #if defined(OS_ANDROID) 3376 //TODO(mfomitchev): Support PowerSaveBlocker on Aura - crbug.com/546718.
3374 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get()) 3377 #if defined(OS_ANDROID) && !defined(USE_AURA)
3378 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get())
3375 ->InitDisplaySleepBlocker(this); 3379 ->InitDisplaySleepBlocker(this);
3376 #endif 3380 #endif
3377 } 3381 }
3378 3382
3379 void WebContentsImpl::MaybeReleasePowerSaveBlockers() { 3383 void WebContentsImpl::MaybeReleasePowerSaveBlockers() {
3380 // If there are no more audio players and we don't have audio stream 3384 // If there are no more audio players and we don't have audio stream
3381 // monitoring, release the audio power save blocker here instead of during 3385 // monitoring, release the audio power save blocker here instead of during
3382 // NotifyNavigationStateChanged(). 3386 // NotifyNavigationStateChanged().
3383 if (active_audio_players_.empty() && 3387 if (active_audio_players_.empty() &&
3384 !AudioStreamMonitor::monitoring_available()) { 3388 !AudioStreamMonitor::monitoring_available()) {
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
4454 parent_routing_id, previous_sibling_routing_id)) 4458 parent_routing_id, previous_sibling_routing_id))
4455 return false; 4459 return false;
4456 4460
4457 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed 4461 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed
4458 // RenderFrameHost will have to be associated with the appropriate 4462 // RenderFrameHost will have to be associated with the appropriate
4459 // RenderWidgetHostView or a new one should be created here. 4463 // RenderWidgetHostView or a new one should be created here.
4460 4464
4461 return true; 4465 return true;
4462 } 4466 }
4463 4467
4464 #if defined(OS_ANDROID) 4468 #if defined(OS_ANDROID) && !defined(USE_AURA)
4465 4469
4466 base::android::ScopedJavaLocalRef<jobject> 4470 base::android::ScopedJavaLocalRef<jobject>
4467 WebContentsImpl::GetJavaWebContents() { 4471 WebContentsImpl::GetJavaWebContents() {
4468 DCHECK_CURRENTLY_ON(BrowserThread::UI); 4472 DCHECK_CURRENTLY_ON(BrowserThread::UI);
4469 return GetWebContentsAndroid()->GetJavaObject(); 4473 return GetWebContentsAndroid()->GetJavaObject();
4470 } 4474 }
4471 4475
4472 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() { 4476 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() {
4473 WebContentsAndroid* web_contents_android = 4477 WebContentsAndroid* web_contents_android =
4474 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); 4478 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey));
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
4679 return NULL; 4683 return NULL;
4680 } 4684 }
4681 4685
4682 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4686 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4683 force_disable_overscroll_content_ = force_disable; 4687 force_disable_overscroll_content_ = force_disable;
4684 if (view_) 4688 if (view_)
4685 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4689 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4686 } 4690 }
4687 4691
4688 } // namespace content 4692 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698