| 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 base::Unretained(this))); | 474 base::Unretained(this))); |
| 475 #if defined(OS_ANDROID) | 475 #if defined(OS_ANDROID) |
| 476 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); | 476 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); |
| 477 #else | 477 #else |
| 478 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 478 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
| 479 #endif | 479 #endif |
| 480 #if BUILDFLAG(ENABLE_PLUGINS) | 480 #if BUILDFLAG(ENABLE_PLUGINS) |
| 481 pepper_playback_observer_.reset(new PepperPlaybackObserver(this)); | 481 pepper_playback_observer_.reset(new PepperPlaybackObserver(this)); |
| 482 #endif | 482 #endif |
| 483 | 483 |
| 484 wake_lock_context_host_.reset(new WakeLockContextHost(this)); | |
| 485 loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this)); | 484 loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this)); |
| 486 host_zoom_map_observer_.reset(new HostZoomMapObserver(this)); | 485 host_zoom_map_observer_.reset(new HostZoomMapObserver(this)); |
| 487 } | 486 } |
| 488 | 487 |
| 489 WebContentsImpl::~WebContentsImpl() { | 488 WebContentsImpl::~WebContentsImpl() { |
| 490 is_being_destroyed_ = true; | 489 is_being_destroyed_ = true; |
| 491 | 490 |
| 492 // A WebContents should never be deleted while it is notifying observers, | 491 // A WebContents should never be deleted while it is notifying observers, |
| 493 // 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 |
| 494 // observers. | 493 // observers. |
| (...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2477 | 2476 |
| 2478 return guest->GetMainFrame(); | 2477 return guest->GetMainFrame(); |
| 2479 } | 2478 } |
| 2480 | 2479 |
| 2481 device::GeolocationServiceContext* | 2480 device::GeolocationServiceContext* |
| 2482 WebContentsImpl::GetGeolocationServiceContext() { | 2481 WebContentsImpl::GetGeolocationServiceContext() { |
| 2483 return geolocation_service_context_.get(); | 2482 return geolocation_service_context_.get(); |
| 2484 } | 2483 } |
| 2485 | 2484 |
| 2486 device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockServiceContext() { | 2485 device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockServiceContext() { |
| 2486 if (!wake_lock_context_host_) |
| 2487 wake_lock_context_host_.reset(new WakeLockContextHost(this)); |
| 2487 return wake_lock_context_host_->GetWakeLockContext(); | 2488 return wake_lock_context_host_->GetWakeLockContext(); |
| 2488 } | 2489 } |
| 2489 | 2490 |
| 2490 void WebContentsImpl::OnShowValidationMessage( | 2491 void WebContentsImpl::OnShowValidationMessage( |
| 2491 RenderViewHostImpl* source, | 2492 RenderViewHostImpl* source, |
| 2492 const gfx::Rect& anchor_in_root_view, | 2493 const gfx::Rect& anchor_in_root_view, |
| 2493 const base::string16& main_text, | 2494 const base::string16& main_text, |
| 2494 const base::string16& sub_text) { | 2495 const base::string16& sub_text) { |
| 2495 // TODO(nick): Should we consider |source| here or pass it to the delegate? | 2496 // TODO(nick): Should we consider |source| here or pass it to the delegate? |
| 2496 if (delegate_) | 2497 if (delegate_) |
| (...skipping 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5398 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5399 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
| 5399 if (!render_view_host) | 5400 if (!render_view_host) |
| 5400 continue; | 5401 continue; |
| 5401 render_view_host_set.insert(render_view_host); | 5402 render_view_host_set.insert(render_view_host); |
| 5402 } | 5403 } |
| 5403 for (RenderViewHost* render_view_host : render_view_host_set) | 5404 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5404 render_view_host->OnWebkitPreferencesChanged(); | 5405 render_view_host->OnWebkitPreferencesChanged(); |
| 5405 } | 5406 } |
| 5406 | 5407 |
| 5407 } // namespace content | 5408 } // namespace content |
| OLD | NEW |