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

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: One more rebase 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/child/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 OnBrowserPluginMessage(render_frame_host, 648 OnBrowserPluginMessage(render_frame_host,
646 message)) 649 message))
647 #endif 650 #endif
648 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) 651 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL)
649 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, 652 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage,
650 OnShowValidationMessage) 653 OnShowValidationMessage)
651 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, 654 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage,
652 OnHideValidationMessage) 655 OnHideValidationMessage)
653 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, 656 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage,
654 OnMoveValidationMessage) 657 OnMoveValidationMessage)
655 #if defined(OS_ANDROID) 658 #if defined(OS_ANDROID) && !defined(USE_AURA)
656 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, 659 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply,
657 OnFindMatchRectsReply) 660 OnFindMatchRectsReply)
658 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, 661 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog,
659 OnOpenDateTimeDialog) 662 OnOpenDateTimeDialog)
660 #endif 663 #endif
661 IPC_MESSAGE_UNHANDLED(handled = false) 664 IPC_MESSAGE_UNHANDLED(handled = false)
662 IPC_END_MESSAGE_MAP() 665 IPC_END_MESSAGE_MAP()
663 render_view_message_source_ = NULL; 666 render_view_message_source_ = NULL;
664 render_frame_message_source_ = NULL; 667 render_frame_message_source_ = NULL;
665 668
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 1383
1381 registrar_.Add(this, 1384 registrar_.Add(this,
1382 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 1385 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
1383 NotificationService::AllBrowserContextsAndSources()); 1386 NotificationService::AllBrowserContextsAndSources());
1384 1387
1385 screen_orientation_dispatcher_host_.reset( 1388 screen_orientation_dispatcher_host_.reset(
1386 new ScreenOrientationDispatcherHostImpl(this)); 1389 new ScreenOrientationDispatcherHostImpl(this));
1387 1390
1388 manifest_manager_host_.reset(new ManifestManagerHost(this)); 1391 manifest_manager_host_.reset(new ManifestManagerHost(this));
1389 1392
1390 #if defined(OS_ANDROID) 1393 #if defined(OS_ANDROID) && !defined(USE_AURA)
1391 date_time_chooser_.reset(new DateTimeChooserAndroid()); 1394 date_time_chooser_.reset(new DateTimeChooserAndroid());
1392 #endif 1395 #endif
1393 1396
1394 // BrowserPluginGuest::Init needs to be called after this WebContents has 1397 // BrowserPluginGuest::Init needs to be called after this WebContents has
1395 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above. 1398 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above.
1396 if (browser_plugin_guest_) 1399 if (browser_plugin_guest_)
1397 browser_plugin_guest_->Init(); 1400 browser_plugin_guest_->Init();
1398 1401
1399 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) 1402 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
1400 g_created_callbacks.Get().at(i).Run(this); 1403 g_created_callbacks.Get().at(i).Run(this);
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
3188 int number_of_matches, 3191 int number_of_matches,
3189 const gfx::Rect& selection_rect, 3192 const gfx::Rect& selection_rect,
3190 int active_match_ordinal, 3193 int active_match_ordinal,
3191 bool final_update) { 3194 bool final_update) {
3192 if (delegate_) { 3195 if (delegate_) {
3193 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, 3196 delegate_->FindReply(this, request_id, number_of_matches, selection_rect,
3194 active_match_ordinal, final_update); 3197 active_match_ordinal, final_update);
3195 } 3198 }
3196 } 3199 }
3197 3200
3198 #if defined(OS_ANDROID) 3201 #if defined(OS_ANDROID) && !defined(USE_AURA)
3199 void WebContentsImpl::OnFindMatchRectsReply( 3202 void WebContentsImpl::OnFindMatchRectsReply(
3200 int version, 3203 int version,
3201 const std::vector<gfx::RectF>& rects, 3204 const std::vector<gfx::RectF>& rects,
3202 const gfx::RectF& active_rect) { 3205 const gfx::RectF& active_rect) {
3203 if (delegate_) 3206 if (delegate_)
3204 delegate_->FindMatchRectsReply(this, version, rects, active_rect); 3207 delegate_->FindMatchRectsReply(this, version, rects, active_rect);
3205 } 3208 }
3206 3209
3207 void WebContentsImpl::OnOpenDateTimeDialog( 3210 void WebContentsImpl::OnOpenDateTimeDialog(
3208 const ViewHostMsg_DateTimeDialogValue_Params& value) { 3211 const ViewHostMsg_DateTimeDialogValue_Params& value) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3351 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 3354 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
3352 PowerSaveBlocker::kReasonAudioPlayback, "Playing audio"); 3355 PowerSaveBlocker::kReasonAudioPlayback, "Playing audio");
3353 } 3356 }
3354 3357
3355 void WebContentsImpl::CreateVideoPowerSaveBlocker() { 3358 void WebContentsImpl::CreateVideoPowerSaveBlocker() {
3356 DCHECK(!video_power_save_blocker_); 3359 DCHECK(!video_power_save_blocker_);
3357 DCHECK(!active_video_players_.empty()); 3360 DCHECK(!active_video_players_.empty());
3358 video_power_save_blocker_ = PowerSaveBlocker::Create( 3361 video_power_save_blocker_ = PowerSaveBlocker::Create(
3359 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, 3362 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
3360 PowerSaveBlocker::kReasonVideoPlayback, "Playing video"); 3363 PowerSaveBlocker::kReasonVideoPlayback, "Playing video");
3361 #if defined(OS_ANDROID) 3364 //TODO(mfomitchev): Support PowerSaveBlocker on Aura - crbug.com/546718.
3362 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get()) 3365 #if defined(OS_ANDROID) && !defined(USE_AURA)
3366 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get())
3363 ->InitDisplaySleepBlocker(this); 3367 ->InitDisplaySleepBlocker(this);
3364 #endif 3368 #endif
3365 } 3369 }
3366 3370
3367 void WebContentsImpl::MaybeReleasePowerSaveBlockers() { 3371 void WebContentsImpl::MaybeReleasePowerSaveBlockers() {
3368 // If there are no more audio players and we don't have audio stream 3372 // If there are no more audio players and we don't have audio stream
3369 // monitoring, release the audio power save blocker here instead of during 3373 // monitoring, release the audio power save blocker here instead of during
3370 // NotifyNavigationStateChanged(). 3374 // NotifyNavigationStateChanged().
3371 if (active_audio_players_.empty() && 3375 if (active_audio_players_.empty() &&
3372 !AudioStreamMonitor::monitoring_available()) { 3376 !AudioStreamMonitor::monitoring_available()) {
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
4461 parent_routing_id, previous_sibling_routing_id)) 4465 parent_routing_id, previous_sibling_routing_id))
4462 return false; 4466 return false;
4463 4467
4464 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed 4468 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed
4465 // RenderFrameHost will have to be associated with the appropriate 4469 // RenderFrameHost will have to be associated with the appropriate
4466 // RenderWidgetHostView or a new one should be created here. 4470 // RenderWidgetHostView or a new one should be created here.
4467 4471
4468 return true; 4472 return true;
4469 } 4473 }
4470 4474
4471 #if defined(OS_ANDROID) 4475 #if defined(OS_ANDROID) && !defined(USE_AURA)
4472 4476
4473 base::android::ScopedJavaLocalRef<jobject> 4477 base::android::ScopedJavaLocalRef<jobject>
4474 WebContentsImpl::GetJavaWebContents() { 4478 WebContentsImpl::GetJavaWebContents() {
4475 DCHECK_CURRENTLY_ON(BrowserThread::UI); 4479 DCHECK_CURRENTLY_ON(BrowserThread::UI);
4476 return GetWebContentsAndroid()->GetJavaObject(); 4480 return GetWebContentsAndroid()->GetJavaObject();
4477 } 4481 }
4478 4482
4479 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() { 4483 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() {
4480 WebContentsAndroid* web_contents_android = 4484 WebContentsAndroid* web_contents_android =
4481 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); 4485 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey));
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
4686 return NULL; 4690 return NULL;
4687 } 4691 }
4688 4692
4689 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4693 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4690 force_disable_overscroll_content_ = force_disable; 4694 force_disable_overscroll_content_ = force_disable;
4691 if (view_) 4695 if (view_)
4692 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4696 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4693 } 4697 }
4694 4698
4695 } // namespace content 4699 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/child/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698