OLD | NEW |
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 #include "content/public/common/browser_side_navigation_policy.h" | 118 #include "content/public/common/browser_side_navigation_policy.h" |
119 #include "content/public/common/child_process_host.h" | 119 #include "content/public/common/child_process_host.h" |
120 #include "content/public/common/content_constants.h" | 120 #include "content/public/common/content_constants.h" |
121 #include "content/public/common/content_switches.h" | 121 #include "content/public/common/content_switches.h" |
122 #include "content/public/common/page_zoom.h" | 122 #include "content/public/common/page_zoom.h" |
123 #include "content/public/common/result_codes.h" | 123 #include "content/public/common/result_codes.h" |
124 #include "content/public/common/url_utils.h" | 124 #include "content/public/common/url_utils.h" |
125 #include "content/public/common/web_preferences.h" | 125 #include "content/public/common/web_preferences.h" |
126 #include "device/geolocation/geolocation_service_context.h" | 126 #include "device/geolocation/geolocation_service_context.h" |
127 #include "device/nfc/nfc.mojom.h" | 127 #include "device/nfc/nfc.mojom.h" |
128 #include "device/wake_lock/wake_lock_service_context.h" | |
129 #include "net/base/url_util.h" | 128 #include "net/base/url_util.h" |
130 #include "net/http/http_cache.h" | 129 #include "net/http/http_cache.h" |
131 #include "net/http/http_transaction_factory.h" | 130 #include "net/http/http_transaction_factory.h" |
132 #include "net/url_request/url_request_context.h" | 131 #include "net/url_request/url_request_context.h" |
133 #include "net/url_request/url_request_context_getter.h" | 132 #include "net/url_request/url_request_context_getter.h" |
134 #include "ppapi/features/features.h" | 133 #include "ppapi/features/features.h" |
135 #include "services/service_manager/public/cpp/interface_provider.h" | 134 #include "services/service_manager/public/cpp/interface_provider.h" |
136 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" | 135 #include "third_party/WebKit/public/platform/WebSecurityStyle.h" |
137 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 136 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
138 #include "third_party/skia/include/core/SkBitmap.h" | 137 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 base::Bind(&WebContentsImpl::OnFrameRemoved, | 472 base::Bind(&WebContentsImpl::OnFrameRemoved, |
474 base::Unretained(this))); | 473 base::Unretained(this))); |
475 #if defined(OS_ANDROID) | 474 #if defined(OS_ANDROID) |
476 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); | 475 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); |
477 #else | 476 #else |
478 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 477 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
479 #endif | 478 #endif |
480 #if BUILDFLAG(ENABLE_PLUGINS) | 479 #if BUILDFLAG(ENABLE_PLUGINS) |
481 pepper_playback_observer_.reset(new PepperPlaybackObserver(this)); | 480 pepper_playback_observer_.reset(new PepperPlaybackObserver(this)); |
482 #endif | 481 #endif |
| 482 |
| 483 wake_lock_context_host_.reset(new WakeLockContextHost(this)); |
483 loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this)); | 484 loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this)); |
484 wake_lock_service_context_.reset(new device::WakeLockServiceContext( | |
485 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), | |
486 base::Bind(&WebContentsImpl::GetNativeView, base::Unretained(this)))); | |
487 host_zoom_map_observer_.reset(new HostZoomMapObserver(this)); | 485 host_zoom_map_observer_.reset(new HostZoomMapObserver(this)); |
488 } | 486 } |
489 | 487 |
490 WebContentsImpl::~WebContentsImpl() { | 488 WebContentsImpl::~WebContentsImpl() { |
491 is_being_destroyed_ = true; | 489 is_being_destroyed_ = true; |
492 | 490 |
493 // A WebContents should never be deleted while it is notifying observers, | 491 // A WebContents should never be deleted while it is notifying observers, |
494 // since this will lead to a use-after-free as it continues to notfiy later | 492 // since this will lead to a use-after-free as it continues to notfiy later |
495 // observers. | 493 // observers. |
496 CHECK(!is_notifying_observers_); | 494 CHECK(!is_notifying_observers_); |
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2468 return nullptr; | 2466 return nullptr; |
2469 | 2467 |
2470 return guest->GetMainFrame(); | 2468 return guest->GetMainFrame(); |
2471 } | 2469 } |
2472 | 2470 |
2473 device::GeolocationServiceContext* | 2471 device::GeolocationServiceContext* |
2474 WebContentsImpl::GetGeolocationServiceContext() { | 2472 WebContentsImpl::GetGeolocationServiceContext() { |
2475 return geolocation_service_context_.get(); | 2473 return geolocation_service_context_.get(); |
2476 } | 2474 } |
2477 | 2475 |
2478 device::WakeLockServiceContext* WebContentsImpl::GetWakeLockServiceContext() { | 2476 device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockServiceContext() { |
2479 return wake_lock_service_context_.get(); | 2477 return wake_lock_context_host_->GetWakeLockContext(); |
2480 } | 2478 } |
2481 | 2479 |
2482 void WebContentsImpl::OnShowValidationMessage( | 2480 void WebContentsImpl::OnShowValidationMessage( |
2483 RenderViewHostImpl* source, | 2481 RenderViewHostImpl* source, |
2484 const gfx::Rect& anchor_in_root_view, | 2482 const gfx::Rect& anchor_in_root_view, |
2485 const base::string16& main_text, | 2483 const base::string16& main_text, |
2486 const base::string16& sub_text) { | 2484 const base::string16& sub_text) { |
2487 // TODO(nick): Should we consider |source| here or pass it to the delegate? | 2485 // TODO(nick): Should we consider |source| here or pass it to the delegate? |
2488 if (delegate_) | 2486 if (delegate_) |
2489 delegate_->ShowValidationMessage( | 2487 delegate_->ShowValidationMessage( |
(...skipping 2913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5403 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5401 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
5404 if (!render_view_host) | 5402 if (!render_view_host) |
5405 continue; | 5403 continue; |
5406 render_view_host_set.insert(render_view_host); | 5404 render_view_host_set.insert(render_view_host); |
5407 } | 5405 } |
5408 for (RenderViewHost* render_view_host : render_view_host_set) | 5406 for (RenderViewHost* render_view_host : render_view_host_set) |
5409 render_view_host->OnWebkitPreferencesChanged(); | 5407 render_view_host->OnWebkitPreferencesChanged(); |
5410 } | 5408 } |
5411 | 5409 |
5412 } // namespace content | 5410 } // namespace content |
OLD | NEW |