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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 #if defined(OS_ANDROID) && !defined(USE_AURA) | 127 #if defined(OS_ANDROID) && !defined(USE_AURA) |
128 #include "content/browser/android/date_time_chooser_android.h" | 128 #include "content/browser/android/date_time_chooser_android.h" |
129 #include "content/browser/web_contents/web_contents_android.h" | 129 #include "content/browser/web_contents/web_contents_android.h" |
130 #endif // OS_ANDROID && !USE_AURA | 130 #endif // OS_ANDROID && !USE_AURA |
131 | 131 |
132 #if defined(OS_MACOSX) | 132 #if defined(OS_MACOSX) |
133 #include "base/mac/foundation_util.h" | 133 #include "base/mac/foundation_util.h" |
134 #endif | 134 #endif |
135 | 135 |
136 #if defined(MOJO_SHELL_CLIENT) | 136 #if defined(MOJO_SHELL_CLIENT) |
| 137 #include "content/browser/mus_util.h" |
137 #include "content/browser/web_contents/web_contents_view_mus.h" | 138 #include "content/browser/web_contents/web_contents_view_mus.h" |
138 #include "content/public/common/mojo_shell_connection.h" | 139 #include "content/public/common/mojo_shell_connection.h" |
139 #endif | 140 #endif |
140 | 141 |
141 namespace content { | 142 namespace content { |
142 namespace { | 143 namespace { |
143 | 144 |
144 const int kMinimumDelayBetweenLoadingUpdatesMS = 100; | 145 const int kMinimumDelayBetweenLoadingUpdatesMS = 100; |
145 const char kDotGoogleDotCom[] = ".google.com"; | 146 const char kDotGoogleDotCom[] = ".google.com"; |
146 | 147 |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 new_contents->created_with_opener_ = true; | 528 new_contents->created_with_opener_ = true; |
528 | 529 |
529 if (params.guest_delegate) { | 530 if (params.guest_delegate) { |
530 // This makes |new_contents| act as a guest. | 531 // This makes |new_contents| act as a guest. |
531 // For more info, see comment above class BrowserPluginGuest. | 532 // For more info, see comment above class BrowserPluginGuest. |
532 BrowserPluginGuest::Create(new_contents, params.guest_delegate); | 533 BrowserPluginGuest::Create(new_contents, params.guest_delegate); |
533 // We are instantiating a WebContents for browser plugin. Set its subframe | 534 // We are instantiating a WebContents for browser plugin. Set its subframe |
534 // bit to true. | 535 // bit to true. |
535 new_contents->is_subframe_ = true; | 536 new_contents->is_subframe_ = true; |
536 } | 537 } |
| 538 |
537 new_contents->Init(params); | 539 new_contents->Init(params); |
538 return new_contents; | 540 return new_contents; |
539 } | 541 } |
540 | 542 |
541 // static | 543 // static |
542 std::vector<WebContentsImpl*> WebContentsImpl::GetAllWebContents() { | 544 std::vector<WebContentsImpl*> WebContentsImpl::GetAllWebContents() { |
543 std::vector<WebContentsImpl*> result; | 545 std::vector<WebContentsImpl*> result; |
544 scoped_ptr<RenderWidgetHostIterator> widgets( | 546 scoped_ptr<RenderWidgetHostIterator> widgets( |
545 RenderWidgetHostImpl::GetRenderWidgetHosts()); | 547 RenderWidgetHostImpl::GetRenderWidgetHosts()); |
546 while (RenderWidgetHost* rwh = widgets->GetNextHost()) { | 548 while (RenderWidgetHost* rwh = widgets->GetNextHost()) { |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 1374 !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { |
1373 view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), | 1375 view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), |
1374 view_.Pass(), | 1376 view_.Pass(), |
1375 &render_view_host_delegate_view_)); | 1377 &render_view_host_delegate_view_)); |
1376 } | 1378 } |
1377 | 1379 |
1378 #if defined(MOJO_SHELL_CLIENT) | 1380 #if defined(MOJO_SHELL_CLIENT) |
1379 if (MojoShellConnection::Get() && | 1381 if (MojoShellConnection::Get() && |
1380 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1382 base::CommandLine::ForCurrentProcess()->HasSwitch( |
1381 switches::kUseMusInRenderer)) { | 1383 switches::kUseMusInRenderer)) { |
1382 view_.reset(new WebContentsViewMus(this, view_.Pass(), | 1384 mus::Window* window = GetMusWindow(params.context); |
1383 &render_view_host_delegate_view_)); | 1385 if (window) { |
| 1386 view_.reset(new WebContentsViewMus(this, window, view_.Pass(), |
| 1387 &render_view_host_delegate_view_)); |
| 1388 } |
1384 } | 1389 } |
1385 #endif | 1390 #endif |
1386 | 1391 |
1387 CHECK(render_view_host_delegate_view_); | 1392 CHECK(render_view_host_delegate_view_); |
1388 CHECK(view_.get()); | 1393 CHECK(view_.get()); |
1389 | 1394 |
1390 gfx::Size initial_size = params.initial_size; | 1395 gfx::Size initial_size = params.initial_size; |
1391 view_->CreateView(initial_size, params.context); | 1396 view_->CreateView(initial_size, params.context); |
1392 | 1397 |
1393 #if defined(ENABLE_PLUGINS) | 1398 #if defined(ENABLE_PLUGINS) |
(...skipping 3395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4789 return NULL; | 4794 return NULL; |
4790 } | 4795 } |
4791 | 4796 |
4792 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4797 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4793 force_disable_overscroll_content_ = force_disable; | 4798 force_disable_overscroll_content_ = force_disable; |
4794 if (view_) | 4799 if (view_) |
4795 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4800 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4796 } | 4801 } |
4797 | 4802 |
4798 } // namespace content | 4803 } // namespace content |
OLD | NEW |