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

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

Issue 1107333002: Wake Lock API implementation (Chromium part) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "content/browser/message_port_message_filter.h" 50 #include "content/browser/message_port_message_filter.h"
51 #include "content/browser/plugin_content_origin_whitelist.h" 51 #include "content/browser/plugin_content_origin_whitelist.h"
52 #include "content/browser/power_save_blocker_impl.h" 52 #include "content/browser/power_save_blocker_impl.h"
53 #include "content/browser/renderer_host/render_process_host_impl.h" 53 #include "content/browser/renderer_host/render_process_host_impl.h"
54 #include "content/browser/renderer_host/render_view_host_delegate_view.h" 54 #include "content/browser/renderer_host/render_view_host_delegate_view.h"
55 #include "content/browser/renderer_host/render_view_host_impl.h" 55 #include "content/browser/renderer_host/render_view_host_impl.h"
56 #include "content/browser/renderer_host/render_widget_host_impl.h" 56 #include "content/browser/renderer_host/render_widget_host_impl.h"
57 #include "content/browser/renderer_host/render_widget_host_view_base.h" 57 #include "content/browser/renderer_host/render_widget_host_view_base.h"
58 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_ impl.h" 58 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_ impl.h"
59 #include "content/browser/site_instance_impl.h" 59 #include "content/browser/site_instance_impl.h"
60 #include "content/browser/wake_lock/wake_lock_service_context.h"
60 #include "content/browser/web_contents/web_contents_view_guest.h" 61 #include "content/browser/web_contents/web_contents_view_guest.h"
61 #include "content/browser/webui/generic_handler.h" 62 #include "content/browser/webui/generic_handler.h"
62 #include "content/browser/webui/web_ui_controller_factory_registry.h" 63 #include "content/browser/webui/web_ui_controller_factory_registry.h"
63 #include "content/browser/webui/web_ui_impl.h" 64 #include "content/browser/webui/web_ui_impl.h"
64 #include "content/common/browser_plugin/browser_plugin_constants.h" 65 #include "content/common/browser_plugin/browser_plugin_constants.h"
65 #include "content/common/browser_plugin/browser_plugin_messages.h" 66 #include "content/common/browser_plugin/browser_plugin_messages.h"
66 #include "content/common/frame_messages.h" 67 #include "content/common/frame_messages.h"
67 #include "content/common/input_messages.h" 68 #include "content/common/input_messages.h"
68 #include "content/common/site_isolation_policy.h" 69 #include "content/common/site_isolation_policy.h"
69 #include "content/common/ssl_status_serialization.h" 70 #include "content/common/ssl_status_serialization.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 base::Unretained(this))); 411 base::Unretained(this)));
411 #if defined(ENABLE_BROWSER_CDMS) 412 #if defined(ENABLE_BROWSER_CDMS)
412 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); 413 media_web_contents_observer_.reset(new MediaWebContentsObserver(this));
413 #endif 414 #endif
414 415
415 #if defined(OS_ANDROID) 416 #if defined(OS_ANDROID)
416 audio_state_provider_.reset(new MediaPlayersObserver(this)); 417 audio_state_provider_.reset(new MediaPlayersObserver(this));
417 #else 418 #else
418 audio_state_provider_.reset(new AudioStreamMonitor(this)); 419 audio_state_provider_.reset(new AudioStreamMonitor(this));
419 #endif 420 #endif
421
422 wake_lock_service_context_.reset(new WakeLockServiceContext(this));
420 } 423 }
421 424
422 WebContentsImpl::~WebContentsImpl() { 425 WebContentsImpl::~WebContentsImpl() {
423 is_being_destroyed_ = true; 426 is_being_destroyed_ = true;
424 427
425 // Delete all RFH pending shutdown, which will lead the corresponding RVH to 428 // Delete all RFH pending shutdown, which will lead the corresponding RVH to
426 // shutdown and be deleted as well. 429 // shutdown and be deleted as well.
427 frame_tree_.ForEach( 430 frame_tree_.ForEach(
428 base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown)); 431 base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown));
429 432
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 if (!guest) 2053 if (!guest)
2051 return nullptr; 2054 return nullptr;
2052 2055
2053 return guest->GetMainFrame(); 2056 return guest->GetMainFrame();
2054 } 2057 }
2055 2058
2056 GeolocationServiceContext* WebContentsImpl::GetGeolocationServiceContext() { 2059 GeolocationServiceContext* WebContentsImpl::GetGeolocationServiceContext() {
2057 return geolocation_service_context_.get(); 2060 return geolocation_service_context_.get();
2058 } 2061 }
2059 2062
2063 WakeLockServiceContext* WebContentsImpl::GetWakeLockServiceContext() {
2064 return wake_lock_service_context_.get();
2065 }
2066
2060 void WebContentsImpl::OnShowValidationMessage( 2067 void WebContentsImpl::OnShowValidationMessage(
2061 const gfx::Rect& anchor_in_root_view, 2068 const gfx::Rect& anchor_in_root_view,
2062 const base::string16& main_text, 2069 const base::string16& main_text,
2063 const base::string16& sub_text) { 2070 const base::string16& sub_text) {
2064 if (delegate_) 2071 if (delegate_)
2065 delegate_->ShowValidationMessage( 2072 delegate_->ShowValidationMessage(
2066 this, anchor_in_root_view, main_text, sub_text); 2073 this, anchor_in_root_view, main_text, sub_text);
2067 } 2074 }
2068 2075
2069 void WebContentsImpl::OnHideValidationMessage() { 2076 void WebContentsImpl::OnHideValidationMessage() {
(...skipping 2545 matching lines...) Expand 10 before | Expand all | Expand 10 after
4615 player_map->erase(it); 4622 player_map->erase(it);
4616 } 4623 }
4617 4624
4618 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4625 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4619 force_disable_overscroll_content_ = force_disable; 4626 force_disable_overscroll_content_ = force_disable;
4620 if (view_) 4627 if (view_)
4621 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4628 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4622 } 4629 }
4623 4630
4624 } // namespace content 4631 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698