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

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

Issue 1393203004: Reland of Wake Lock API implementation (Chromium part) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix presubmit errors 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/common/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_input_event_router.h" 57 #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
58 #include "content/browser/renderer_host/render_widget_host_view_base.h" 58 #include "content/browser/renderer_host/render_widget_host_view_base.h"
59 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_ impl.h" 59 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_ impl.h"
60 #include "content/browser/site_instance_impl.h" 60 #include "content/browser/site_instance_impl.h"
61 #include "content/browser/wake_lock/wake_lock_service_context.h"
61 #include "content/browser/web_contents/web_contents_view_guest.h" 62 #include "content/browser/web_contents/web_contents_view_guest.h"
62 #include "content/browser/webui/generic_handler.h" 63 #include "content/browser/webui/generic_handler.h"
63 #include "content/browser/webui/web_ui_controller_factory_registry.h" 64 #include "content/browser/webui/web_ui_controller_factory_registry.h"
64 #include "content/browser/webui/web_ui_impl.h" 65 #include "content/browser/webui/web_ui_impl.h"
65 #include "content/common/browser_plugin/browser_plugin_constants.h" 66 #include "content/common/browser_plugin/browser_plugin_constants.h"
66 #include "content/common/browser_plugin/browser_plugin_messages.h" 67 #include "content/common/browser_plugin/browser_plugin_messages.h"
67 #include "content/common/frame_messages.h" 68 #include "content/common/frame_messages.h"
68 #include "content/common/input_messages.h" 69 #include "content/common/input_messages.h"
69 #include "content/common/site_isolation_policy.h" 70 #include "content/common/site_isolation_policy.h"
70 #include "content/common/ssl_status_serialization.h" 71 #include "content/common/ssl_status_serialization.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), 414 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()),
414 audio_stream_monitor_(this), 415 audio_stream_monitor_(this),
415 virtual_keyboard_requested_(false), 416 virtual_keyboard_requested_(false),
416 loading_weak_factory_(this) { 417 loading_weak_factory_(this) {
417 frame_tree_.SetFrameRemoveListener( 418 frame_tree_.SetFrameRemoveListener(
418 base::Bind(&WebContentsImpl::OnFrameRemoved, 419 base::Bind(&WebContentsImpl::OnFrameRemoved,
419 base::Unretained(this))); 420 base::Unretained(this)));
420 #if defined(ENABLE_BROWSER_CDMS) 421 #if defined(ENABLE_BROWSER_CDMS)
421 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); 422 media_web_contents_observer_.reset(new MediaWebContentsObserver(this));
422 #endif 423 #endif
424
425 wake_lock_service_context_.reset(new WakeLockServiceContext(this));
423 } 426 }
424 427
425 WebContentsImpl::~WebContentsImpl() { 428 WebContentsImpl::~WebContentsImpl() {
426 is_being_destroyed_ = true; 429 is_being_destroyed_ = true;
427 430
428 rwh_input_event_router_.reset(); 431 rwh_input_event_router_.reset();
429 432
430 // Delete all RFH pending shutdown, which will lead the corresponding RVH to 433 // Delete all RFH pending shutdown, which will lead the corresponding RVH to
431 // shutdown and be deleted as well. 434 // shutdown and be deleted as well.
432 frame_tree_.ForEach( 435 frame_tree_.ForEach(
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 if (!guest) 2063 if (!guest)
2061 return nullptr; 2064 return nullptr;
2062 2065
2063 return guest->GetMainFrame(); 2066 return guest->GetMainFrame();
2064 } 2067 }
2065 2068
2066 GeolocationServiceContext* WebContentsImpl::GetGeolocationServiceContext() { 2069 GeolocationServiceContext* WebContentsImpl::GetGeolocationServiceContext() {
2067 return geolocation_service_context_.get(); 2070 return geolocation_service_context_.get();
2068 } 2071 }
2069 2072
2073 WakeLockServiceContext* WebContentsImpl::GetWakeLockServiceContext() {
2074 return wake_lock_service_context_.get();
2075 }
2076
2070 void WebContentsImpl::OnShowValidationMessage( 2077 void WebContentsImpl::OnShowValidationMessage(
2071 const gfx::Rect& anchor_in_root_view, 2078 const gfx::Rect& anchor_in_root_view,
2072 const base::string16& main_text, 2079 const base::string16& main_text,
2073 const base::string16& sub_text) { 2080 const base::string16& sub_text) {
2074 if (delegate_) 2081 if (delegate_)
2075 delegate_->ShowValidationMessage( 2082 delegate_->ShowValidationMessage(
2076 this, anchor_in_root_view, main_text, sub_text); 2083 this, anchor_in_root_view, main_text, sub_text);
2077 } 2084 }
2078 2085
2079 void WebContentsImpl::OnHideValidationMessage() { 2086 void WebContentsImpl::OnHideValidationMessage() {
(...skipping 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after
4639 return NULL; 4646 return NULL;
4640 } 4647 }
4641 4648
4642 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4649 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4643 force_disable_overscroll_content_ = force_disable; 4650 force_disable_overscroll_content_ = force_disable;
4644 if (view_) 4651 if (view_)
4645 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4652 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4646 } 4653 }
4647 4654
4648 } // namespace content 4655 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698