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

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

Issue 2734943003: Device Service: Decouple Wake Lock from //content (Closed)
Patch Set: Rebase Created 3 years, 8 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 #include "content/public/common/browser_side_navigation_policy.h" 119 #include "content/public/common/browser_side_navigation_policy.h"
120 #include "content/public/common/child_process_host.h" 120 #include "content/public/common/child_process_host.h"
121 #include "content/public/common/content_constants.h" 121 #include "content/public/common/content_constants.h"
122 #include "content/public/common/content_switches.h" 122 #include "content/public/common/content_switches.h"
123 #include "content/public/common/page_zoom.h" 123 #include "content/public/common/page_zoom.h"
124 #include "content/public/common/result_codes.h" 124 #include "content/public/common/result_codes.h"
125 #include "content/public/common/url_utils.h" 125 #include "content/public/common/url_utils.h"
126 #include "content/public/common/web_preferences.h" 126 #include "content/public/common/web_preferences.h"
127 #include "device/geolocation/geolocation_service_context.h" 127 #include "device/geolocation/geolocation_service_context.h"
128 #include "device/nfc/nfc.mojom.h" 128 #include "device/nfc/nfc.mojom.h"
129 #include "device/wake_lock/wake_lock_service_context.h"
130 #include "net/base/url_util.h" 129 #include "net/base/url_util.h"
131 #include "net/http/http_cache.h" 130 #include "net/http/http_cache.h"
132 #include "net/http/http_transaction_factory.h" 131 #include "net/http/http_transaction_factory.h"
133 #include "net/url_request/url_request_context.h" 132 #include "net/url_request/url_request_context.h"
134 #include "net/url_request/url_request_context_getter.h" 133 #include "net/url_request/url_request_context_getter.h"
135 #include "ppapi/features/features.h" 134 #include "ppapi/features/features.h"
136 #include "services/service_manager/public/cpp/interface_provider.h" 135 #include "services/service_manager/public/cpp/interface_provider.h"
137 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" 136 #include "third_party/WebKit/public/platform/WebSecurityStyle.h"
138 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 137 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
139 #include "third_party/skia/include/core/SkBitmap.h" 138 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 base::Bind(&WebContentsImpl::OnFrameRemoved, 473 base::Bind(&WebContentsImpl::OnFrameRemoved,
475 base::Unretained(this))); 474 base::Unretained(this)));
476 #if defined(OS_ANDROID) 475 #if defined(OS_ANDROID)
477 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); 476 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this));
478 #else 477 #else
479 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); 478 media_web_contents_observer_.reset(new MediaWebContentsObserver(this));
480 #endif 479 #endif
481 #if BUILDFLAG(ENABLE_PLUGINS) 480 #if BUILDFLAG(ENABLE_PLUGINS)
482 pepper_playback_observer_.reset(new PepperPlaybackObserver(this)); 481 pepper_playback_observer_.reset(new PepperPlaybackObserver(this));
483 #endif 482 #endif
483
484 wake_lock_context_host_.reset(new WakeLockContextHost(this));
484 loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this)); 485 loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this));
485 wake_lock_service_context_.reset(new device::WakeLockServiceContext(
486 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
487 base::Bind(&WebContentsImpl::GetNativeView, base::Unretained(this))));
488 host_zoom_map_observer_.reset(new HostZoomMapObserver(this)); 486 host_zoom_map_observer_.reset(new HostZoomMapObserver(this));
489 } 487 }
490 488
491 WebContentsImpl::~WebContentsImpl() { 489 WebContentsImpl::~WebContentsImpl() {
492 is_being_destroyed_ = true; 490 is_being_destroyed_ = true;
493 491
494 // A WebContents should never be deleted while it is notifying observers, 492 // A WebContents should never be deleted while it is notifying observers,
495 // since this will lead to a use-after-free as it continues to notfiy later 493 // since this will lead to a use-after-free as it continues to notfiy later
496 // observers. 494 // observers.
497 CHECK(!is_notifying_observers_); 495 CHECK(!is_notifying_observers_);
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after
2478 return nullptr; 2476 return nullptr;
2479 2477
2480 return guest->GetMainFrame(); 2478 return guest->GetMainFrame();
2481 } 2479 }
2482 2480
2483 device::GeolocationServiceContext* 2481 device::GeolocationServiceContext*
2484 WebContentsImpl::GetGeolocationServiceContext() { 2482 WebContentsImpl::GetGeolocationServiceContext() {
2485 return geolocation_service_context_.get(); 2483 return geolocation_service_context_.get();
2486 } 2484 }
2487 2485
2488 device::WakeLockServiceContext* WebContentsImpl::GetWakeLockServiceContext() { 2486 device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockServiceContext() {
2489 return wake_lock_service_context_.get(); 2487 return wake_lock_context_host_->GetWakeLockContext();
2490 } 2488 }
2491 2489
2492 void WebContentsImpl::OnShowValidationMessage( 2490 void WebContentsImpl::OnShowValidationMessage(
2493 RenderViewHostImpl* source, 2491 RenderViewHostImpl* source,
2494 const gfx::Rect& anchor_in_root_view, 2492 const gfx::Rect& anchor_in_root_view,
2495 const base::string16& main_text, 2493 const base::string16& main_text,
2496 const base::string16& sub_text) { 2494 const base::string16& sub_text) {
2497 // TODO(nick): Should we consider |source| here or pass it to the delegate? 2495 // TODO(nick): Should we consider |source| here or pass it to the delegate?
2498 if (delegate_) 2496 if (delegate_)
2499 delegate_->ShowValidationMessage( 2497 delegate_->ShowValidationMessage(
(...skipping 2900 matching lines...) Expand 10 before | Expand all | Expand 10 after
5400 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); 5398 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5401 if (!render_view_host) 5399 if (!render_view_host)
5402 continue; 5400 continue;
5403 render_view_host_set.insert(render_view_host); 5401 render_view_host_set.insert(render_view_host);
5404 } 5402 }
5405 for (RenderViewHost* render_view_host : render_view_host_set) 5403 for (RenderViewHost* render_view_host : render_view_host_set)
5406 render_view_host->OnWebkitPreferencesChanged(); 5404 render_view_host->OnWebkitPreferencesChanged();
5407 } 5405 }
5408 5406
5409 } // namespace content 5407 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/app/mojo/content_browser_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698