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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/stack_trace.h" | |
Fady Samuel
2015/11/24 04:42:38
Delete this.
| |
10 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
11 #include "base/location.h" | 12 #include "base/location.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "base/process/process.h" | 15 #include "base/process/process.h" |
15 #include "base/profiler/scoped_tracker.h" | 16 #include "base/profiler/scoped_tracker.h" |
16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
17 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 page_scale_factor_is_one_(true), | 411 page_scale_factor_is_one_(true), |
411 loading_weak_factory_(this) { | 412 loading_weak_factory_(this) { |
412 frame_tree_.SetFrameRemoveListener( | 413 frame_tree_.SetFrameRemoveListener( |
413 base::Bind(&WebContentsImpl::OnFrameRemoved, | 414 base::Bind(&WebContentsImpl::OnFrameRemoved, |
414 base::Unretained(this))); | 415 base::Unretained(this))); |
415 #if defined(ENABLE_BROWSER_CDMS) | 416 #if defined(ENABLE_BROWSER_CDMS) |
416 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 417 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
417 #endif | 418 #endif |
418 | 419 |
419 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); | 420 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); |
421 // base::debug::StackTrace().Print(); | |
Fady Samuel
2015/11/24 04:42:38
Delete this.
| |
420 } | 422 } |
421 | 423 |
422 WebContentsImpl::~WebContentsImpl() { | 424 WebContentsImpl::~WebContentsImpl() { |
423 is_being_destroyed_ = true; | 425 is_being_destroyed_ = true; |
424 | 426 |
425 rwh_input_event_router_.reset(); | 427 rwh_input_event_router_.reset(); |
426 | 428 |
427 // Delete all RFH pending shutdown, which will lead the corresponding RVH to | 429 // Delete all RFH pending shutdown, which will lead the corresponding RVH to |
428 // shutdown and be deleted as well. | 430 // shutdown and be deleted as well. |
429 frame_tree_.ForEach( | 431 frame_tree_.ForEach( |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
527 new_contents->created_with_opener_ = true; | 529 new_contents->created_with_opener_ = true; |
528 | 530 |
529 if (params.guest_delegate) { | 531 if (params.guest_delegate) { |
530 // This makes |new_contents| act as a guest. | 532 // This makes |new_contents| act as a guest. |
531 // For more info, see comment above class BrowserPluginGuest. | 533 // For more info, see comment above class BrowserPluginGuest. |
532 BrowserPluginGuest::Create(new_contents, params.guest_delegate); | 534 BrowserPluginGuest::Create(new_contents, params.guest_delegate); |
533 // We are instantiating a WebContents for browser plugin. Set its subframe | 535 // We are instantiating a WebContents for browser plugin. Set its subframe |
534 // bit to true. | 536 // bit to true. |
535 new_contents->is_subframe_ = true; | 537 new_contents->is_subframe_ = true; |
536 } | 538 } |
539 | |
537 new_contents->Init(params); | 540 new_contents->Init(params); |
538 return new_contents; | 541 return new_contents; |
539 } | 542 } |
540 | 543 |
541 // static | 544 // static |
542 std::vector<WebContentsImpl*> WebContentsImpl::GetAllWebContents() { | 545 std::vector<WebContentsImpl*> WebContentsImpl::GetAllWebContents() { |
543 std::vector<WebContentsImpl*> result; | 546 std::vector<WebContentsImpl*> result; |
544 scoped_ptr<RenderWidgetHostIterator> widgets( | 547 scoped_ptr<RenderWidgetHostIterator> widgets( |
545 RenderWidgetHostImpl::GetRenderWidgetHosts()); | 548 RenderWidgetHostImpl::GetRenderWidgetHosts()); |
546 while (RenderWidgetHost* rwh = widgets->GetNextHost()) { | 549 while (RenderWidgetHost* rwh = widgets->GetNextHost()) { |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1371 if (browser_plugin_guest_ && | 1374 if (browser_plugin_guest_ && |
1372 !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 1375 !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { |
1373 view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), | 1376 view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), |
1374 view_.Pass(), | 1377 view_.Pass(), |
1375 &render_view_host_delegate_view_)); | 1378 &render_view_host_delegate_view_)); |
1376 } | 1379 } |
1377 | 1380 |
1378 #if defined(MOJO_SHELL_CLIENT) | 1381 #if defined(MOJO_SHELL_CLIENT) |
1379 if (MojoShellConnection::Get() && | 1382 if (MojoShellConnection::Get() && |
1380 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1383 base::CommandLine::ForCurrentProcess()->HasSwitch( |
1381 switches::kUseMusInRenderer)) { | 1384 switches::kUseMusInRenderer) && |
1382 view_.reset(new WebContentsViewMus(this, view_.Pass(), | 1385 params.mus_window) { |
1386 view_.reset(new WebContentsViewMus(this, params.mus_window, view_.Pass(), | |
1383 &render_view_host_delegate_view_)); | 1387 &render_view_host_delegate_view_)); |
1384 } | 1388 } |
1385 #endif | 1389 #endif |
1386 | 1390 |
1387 CHECK(render_view_host_delegate_view_); | 1391 CHECK(render_view_host_delegate_view_); |
1388 CHECK(view_.get()); | 1392 CHECK(view_.get()); |
1389 | 1393 |
1390 gfx::Size initial_size = params.initial_size; | 1394 gfx::Size initial_size = params.initial_size; |
1391 view_->CreateView(initial_size, params.context); | 1395 view_->CreateView(initial_size, params.context); |
1392 | 1396 |
(...skipping 3396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4789 return NULL; | 4793 return NULL; |
4790 } | 4794 } |
4791 | 4795 |
4792 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4796 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4793 force_disable_overscroll_content_ = force_disable; | 4797 force_disable_overscroll_content_ = force_disable; |
4794 if (view_) | 4798 if (view_) |
4795 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4799 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4796 } | 4800 } |
4797 | 4801 |
4798 } // namespace content | 4802 } // namespace content |
OLD | NEW |