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

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: Created 5 years, 2 months 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 #include "third_party/skia/include/core/SkBitmap.h" 111 #include "third_party/skia/include/core/SkBitmap.h"
112 #include "ui/base/layout.h" 112 #include "ui/base/layout.h"
113 #include "ui/gfx/display.h" 113 #include "ui/gfx/display.h"
114 #include "ui/gfx/screen.h" 114 #include "ui/gfx/screen.h"
115 #include "ui/gl/gl_switches.h" 115 #include "ui/gl/gl_switches.h"
116 116
117 #if defined(ENABLE_BROWSER_CDMS) 117 #if defined(ENABLE_BROWSER_CDMS)
118 #include "content/browser/media/media_web_contents_observer.h" 118 #include "content/browser/media/media_web_contents_observer.h"
119 #endif 119 #endif
120 120
121 #if defined(OS_ANDROID) 121 #if defined(OS_ANDROID) &&!defined(USE_AURA)
122 #include "content/browser/android/content_video_view.h" 122 #include "content/browser/android/content_video_view.h"
123 #include "content/browser/android/date_time_chooser_android.h" 123 #include "content/browser/android/date_time_chooser_android.h"
124 #include "content/browser/media/android/media_session.h" 124 #include "content/browser/media/android/media_session.h"
125 #include "content/browser/web_contents/web_contents_android.h" 125 #include "content/browser/web_contents/web_contents_android.h"
126 #endif 126 #endif
127 127
128 #if defined(OS_MACOSX) 128 #if defined(OS_MACOSX)
129 #include "base/mac/foundation_util.h" 129 #include "base/mac/foundation_util.h"
130 #endif 130 #endif
131 131
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 OnBrowserPluginMessage(render_frame_host, 660 OnBrowserPluginMessage(render_frame_host,
661 message)) 661 message))
662 #endif 662 #endif
663 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) 663 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL)
664 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, 664 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage,
665 OnShowValidationMessage) 665 OnShowValidationMessage)
666 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, 666 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage,
667 OnHideValidationMessage) 667 OnHideValidationMessage)
668 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, 668 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage,
669 OnMoveValidationMessage) 669 OnMoveValidationMessage)
670 #if defined(OS_ANDROID) 670 #if defined(OS_ANDROID) && !defined(USE_AURA)
671 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, 671 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply,
672 OnFindMatchRectsReply) 672 OnFindMatchRectsReply)
673 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, 673 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog,
674 OnOpenDateTimeDialog) 674 OnOpenDateTimeDialog)
675 #endif 675 #endif
676 IPC_MESSAGE_UNHANDLED(handled = false) 676 IPC_MESSAGE_UNHANDLED(handled = false)
677 IPC_END_MESSAGE_MAP() 677 IPC_END_MESSAGE_MAP()
678 render_view_message_source_ = NULL; 678 render_view_message_source_ = NULL;
679 render_frame_message_source_ = NULL; 679 render_frame_message_source_ = NULL;
680 680
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 1384
1385 registrar_.Add(this, 1385 registrar_.Add(this,
1386 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 1386 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
1387 NotificationService::AllBrowserContextsAndSources()); 1387 NotificationService::AllBrowserContextsAndSources());
1388 1388
1389 screen_orientation_dispatcher_host_.reset( 1389 screen_orientation_dispatcher_host_.reset(
1390 new ScreenOrientationDispatcherHostImpl(this)); 1390 new ScreenOrientationDispatcherHostImpl(this));
1391 1391
1392 manifest_manager_host_.reset(new ManifestManagerHost(this)); 1392 manifest_manager_host_.reset(new ManifestManagerHost(this));
1393 1393
1394 #if defined(OS_ANDROID) 1394 #if defined(OS_ANDROID) && !defined(USE_AURA)
1395 date_time_chooser_.reset(new DateTimeChooserAndroid()); 1395 date_time_chooser_.reset(new DateTimeChooserAndroid());
1396 #endif 1396 #endif
1397 1397
1398 // BrowserPluginGuest::Init needs to be called after this WebContents has 1398 // BrowserPluginGuest::Init needs to be called after this WebContents has
1399 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above. 1399 // a RenderWidgetHostViewGuest. That is, |view_->CreateView| above.
1400 if (browser_plugin_guest_) 1400 if (browser_plugin_guest_)
1401 browser_plugin_guest_->Init(); 1401 browser_plugin_guest_->Init();
1402 1402
1403 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) 1403 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
1404 g_created_callbacks.Get().at(i).Run(this); 1404 g_created_callbacks.Get().at(i).Run(this);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab())); 1599 DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab()));
1600 } 1600 }
1601 1601
1602 void WebContentsImpl::ExitFullscreenMode() { 1602 void WebContentsImpl::ExitFullscreenMode() {
1603 // This method is being called to leave renderer-initiated fullscreen mode. 1603 // This method is being called to leave renderer-initiated fullscreen mode.
1604 // Make sure any existing fullscreen widget is shut down first. 1604 // Make sure any existing fullscreen widget is shut down first.
1605 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); 1605 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView();
1606 if (widget_view) 1606 if (widget_view)
1607 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost())->Shutdown(); 1607 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost())->Shutdown();
1608 1608
1609 #if defined(OS_ANDROID) 1609 #if defined(OS_ANDROID) && !defined(USE_AURA)
1610 ContentVideoView* video_view = ContentVideoView::GetInstance(); 1610 ContentVideoView* video_view = ContentVideoView::GetInstance();
1611 if (video_view != NULL) 1611 if (video_view != NULL)
1612 video_view->OnExitFullscreen(); 1612 video_view->OnExitFullscreen();
1613 #endif 1613 #endif
1614 1614
1615 if (delegate_) 1615 if (delegate_)
1616 delegate_->ExitFullscreenModeForTab(this); 1616 delegate_->ExitFullscreenModeForTab(this);
1617 1617
1618 // Ensure web contents exit fullscreen state by sending a resize message, 1618 // Ensure web contents exit fullscreen state by sending a resize message,
1619 // which includes the fullscreen state. This is required for the situation 1619 // which includes the fullscreen state. This is required for the situation
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
3165 int number_of_matches, 3165 int number_of_matches,
3166 const gfx::Rect& selection_rect, 3166 const gfx::Rect& selection_rect,
3167 int active_match_ordinal, 3167 int active_match_ordinal,
3168 bool final_update) { 3168 bool final_update) {
3169 if (delegate_) { 3169 if (delegate_) {
3170 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, 3170 delegate_->FindReply(this, request_id, number_of_matches, selection_rect,
3171 active_match_ordinal, final_update); 3171 active_match_ordinal, final_update);
3172 } 3172 }
3173 } 3173 }
3174 3174
3175 #if defined(OS_ANDROID) 3175 #if defined(OS_ANDROID) && !defined(USE_AURA)
3176 void WebContentsImpl::OnFindMatchRectsReply( 3176 void WebContentsImpl::OnFindMatchRectsReply(
3177 int version, 3177 int version,
3178 const std::vector<gfx::RectF>& rects, 3178 const std::vector<gfx::RectF>& rects,
3179 const gfx::RectF& active_rect) { 3179 const gfx::RectF& active_rect) {
3180 if (delegate_) 3180 if (delegate_)
3181 delegate_->FindMatchRectsReply(this, version, rects, active_rect); 3181 delegate_->FindMatchRectsReply(this, version, rects, active_rect);
3182 } 3182 }
3183 3183
3184 void WebContentsImpl::OnOpenDateTimeDialog( 3184 void WebContentsImpl::OnOpenDateTimeDialog(
3185 const ViewHostMsg_DateTimeDialogValue_Params& value) { 3185 const ViewHostMsg_DateTimeDialogValue_Params& value) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3328 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 3328 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
3329 PowerSaveBlocker::kReasonAudioPlayback, "Playing audio"); 3329 PowerSaveBlocker::kReasonAudioPlayback, "Playing audio");
3330 } 3330 }
3331 3331
3332 void WebContentsImpl::CreateVideoPowerSaveBlocker() { 3332 void WebContentsImpl::CreateVideoPowerSaveBlocker() {
3333 DCHECK(!video_power_save_blocker_); 3333 DCHECK(!video_power_save_blocker_);
3334 DCHECK(!active_video_players_.empty()); 3334 DCHECK(!active_video_players_.empty());
3335 video_power_save_blocker_ = PowerSaveBlocker::Create( 3335 video_power_save_blocker_ = PowerSaveBlocker::Create(
3336 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, 3336 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
3337 PowerSaveBlocker::kReasonVideoPlayback, "Playing video"); 3337 PowerSaveBlocker::kReasonVideoPlayback, "Playing video");
3338 #if defined(OS_ANDROID) 3338 #if defined(OS_ANDROID) &&!defined(USE_AURA)
no sievers 2015/10/22 20:55:41 TODO(crbug.com/546718)
mfomitchev 2015/11/02 21:51:16 Done.
3339 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get()) 3339 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get())
3340 ->InitDisplaySleepBlocker(this); 3340 ->InitDisplaySleepBlocker(this);
3341 #endif 3341 #endif
3342 } 3342 }
3343 3343
3344 void WebContentsImpl::MaybeReleasePowerSaveBlockers() { 3344 void WebContentsImpl::MaybeReleasePowerSaveBlockers() {
3345 // If there are no more audio players and we don't have audio stream 3345 // If there are no more audio players and we don't have audio stream
3346 // monitoring, release the audio power save blocker here instead of during 3346 // monitoring, release the audio power save blocker here instead of during
3347 // NotifyNavigationStateChanged(). 3347 // NotifyNavigationStateChanged().
3348 if (active_audio_players_.empty() && 3348 if (active_audio_players_.empty() &&
3349 !AudioStreamMonitor::monitoring_available()) { 3349 !AudioStreamMonitor::monitoring_available()) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3386 } 3386 }
3387 3387
3388 void WebContentsImpl::OnMediaPausedNotification(int64 player_cookie) { 3388 void WebContentsImpl::OnMediaPausedNotification(int64 player_cookie) {
3389 RemoveMediaPlayerEntry(player_cookie, &active_audio_players_); 3389 RemoveMediaPlayerEntry(player_cookie, &active_audio_players_);
3390 RemoveMediaPlayerEntry(player_cookie, &active_video_players_); 3390 RemoveMediaPlayerEntry(player_cookie, &active_video_players_);
3391 MaybeReleasePowerSaveBlockers(); 3391 MaybeReleasePowerSaveBlockers();
3392 3392
3393 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaPaused()); 3393 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaPaused());
3394 } 3394 }
3395 3395
3396 #if defined(OS_ANDROID) 3396 #if defined(OS_ANDROID) && !defined(USE_AURA)
3397 3397
3398 void WebContentsImpl::OnMediaSessionStateChanged() { 3398 void WebContentsImpl::OnMediaSessionStateChanged() {
3399 MediaSession* session = MediaSession::Get(this); 3399 MediaSession* session = MediaSession::Get(this);
3400 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3400 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3401 MediaSessionStateChanged(session->IsControllable(), 3401 MediaSessionStateChanged(session->IsControllable(),
3402 session->IsSuspended())); 3402 session->IsSuspended()));
3403 } 3403 }
3404 3404
3405 void WebContentsImpl::ResumeMediaSession() { 3405 void WebContentsImpl::ResumeMediaSession() {
3406 MediaSession::Get(this)->Resume(); 3406 MediaSession::Get(this)->Resume();
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
4414 parent_routing_id, previous_sibling_routing_id)) 4414 parent_routing_id, previous_sibling_routing_id))
4415 return false; 4415 return false;
4416 4416
4417 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed 4417 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed
4418 // RenderFrameHost will have to be associated with the appropriate 4418 // RenderFrameHost will have to be associated with the appropriate
4419 // RenderWidgetHostView or a new one should be created here. 4419 // RenderWidgetHostView or a new one should be created here.
4420 4420
4421 return true; 4421 return true;
4422 } 4422 }
4423 4423
4424 #if defined(OS_ANDROID) 4424 #if defined(OS_ANDROID) && !defined(USE_AURA)
4425 4425
4426 base::android::ScopedJavaLocalRef<jobject> 4426 base::android::ScopedJavaLocalRef<jobject>
4427 WebContentsImpl::GetJavaWebContents() { 4427 WebContentsImpl::GetJavaWebContents() {
4428 DCHECK_CURRENTLY_ON(BrowserThread::UI); 4428 DCHECK_CURRENTLY_ON(BrowserThread::UI);
4429 return GetWebContentsAndroid()->GetJavaObject(); 4429 return GetWebContentsAndroid()->GetJavaObject();
4430 } 4430 }
4431 4431
4432 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() { 4432 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() {
4433 WebContentsAndroid* web_contents_android = 4433 WebContentsAndroid* web_contents_android =
4434 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); 4434 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey));
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
4639 return NULL; 4639 return NULL;
4640 } 4640 }
4641 4641
4642 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4642 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4643 force_disable_overscroll_content_ = force_disable; 4643 force_disable_overscroll_content_ = force_disable;
4644 if (view_) 4644 if (view_)
4645 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4645 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4646 } 4646 }
4647 4647
4648 } // namespace content 4648 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698