| 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/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 session_storage_namespace); | 1435 session_storage_namespace); |
| 1436 CreateParams create_params(GetBrowserContext(), site_instance.get()); | 1436 CreateParams create_params(GetBrowserContext(), site_instance.get()); |
| 1437 create_params.routing_id = route_id; | 1437 create_params.routing_id = route_id; |
| 1438 create_params.main_frame_routing_id = main_frame_route_id; | 1438 create_params.main_frame_routing_id = main_frame_route_id; |
| 1439 if (!is_guest) { | 1439 if (!is_guest) { |
| 1440 create_params.context = view_->GetNativeView(); | 1440 create_params.context = view_->GetNativeView(); |
| 1441 create_params.initial_size = view_->GetContainerSize(); | 1441 create_params.initial_size = view_->GetContainerSize(); |
| 1442 } else { | 1442 } else { |
| 1443 // This makes |new_contents| act as a guest. | 1443 // This makes |new_contents| act as a guest. |
| 1444 // For more info, see comment above class BrowserPluginGuest. | 1444 // For more info, see comment above class BrowserPluginGuest. |
| 1445 int instance_id = GetBrowserPluginGuestManager()->get_next_instance_id(); | 1445 int instance_id = |
| 1446 BrowserPluginGuestManager::FromBrowserContext(GetBrowserContext())-> |
| 1447 GetNextInstanceID(); |
| 1446 WebContentsImpl* new_contents_impl = | 1448 WebContentsImpl* new_contents_impl = |
| 1447 static_cast<WebContentsImpl*>(new_contents); | 1449 static_cast<WebContentsImpl*>(new_contents); |
| 1448 BrowserPluginGuest::CreateWithOpener(instance_id, | 1450 BrowserPluginGuest::CreateWithOpener(instance_id, |
| 1449 new_contents_impl->opener() != NULL, | 1451 new_contents_impl->opener() != NULL, |
| 1450 new_contents_impl, | 1452 new_contents_impl, |
| 1451 GetBrowserPluginGuest()); | 1453 GetBrowserPluginGuest()); |
| 1452 } | 1454 } |
| 1453 if (params.disposition == NEW_BACKGROUND_TAB) | 1455 if (params.disposition == NEW_BACKGROUND_TAB) |
| 1454 create_params.initially_hidden = true; | 1456 create_params.initially_hidden = true; |
| 1455 new_contents->Init(create_params); | 1457 new_contents->Init(create_params); |
| (...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3879 | 3881 |
| 3880 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { | 3882 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { |
| 3881 CHECK(!browser_plugin_guest_); | 3883 CHECK(!browser_plugin_guest_); |
| 3882 browser_plugin_guest_.reset(guest); | 3884 browser_plugin_guest_.reset(guest); |
| 3883 } | 3885 } |
| 3884 | 3886 |
| 3885 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { | 3887 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { |
| 3886 return browser_plugin_embedder_.get(); | 3888 return browser_plugin_embedder_.get(); |
| 3887 } | 3889 } |
| 3888 | 3890 |
| 3889 BrowserPluginGuestManager* | |
| 3890 WebContentsImpl::GetBrowserPluginGuestManager() const { | |
| 3891 return static_cast<BrowserPluginGuestManager*>( | |
| 3892 GetBrowserContext()->GetUserData( | |
| 3893 browser_plugin::kBrowserPluginGuestManagerKeyName)); | |
| 3894 } | |
| 3895 | |
| 3896 void WebContentsImpl::ClearPowerSaveBlockers( | 3891 void WebContentsImpl::ClearPowerSaveBlockers( |
| 3897 RenderViewHost* render_view_host) { | 3892 RenderViewHost* render_view_host) { |
| 3898 STLDeleteValues(&power_save_blockers_[render_view_host]); | 3893 STLDeleteValues(&power_save_blockers_[render_view_host]); |
| 3899 power_save_blockers_.erase(render_view_host); | 3894 power_save_blockers_.erase(render_view_host); |
| 3900 } | 3895 } |
| 3901 | 3896 |
| 3902 void WebContentsImpl::ClearAllPowerSaveBlockers() { | 3897 void WebContentsImpl::ClearAllPowerSaveBlockers() { |
| 3903 for (PowerSaveBlockerMap::iterator i(power_save_blockers_.begin()); | 3898 for (PowerSaveBlockerMap::iterator i(power_save_blockers_.begin()); |
| 3904 i != power_save_blockers_.end(); ++i) | 3899 i != power_save_blockers_.end(); ++i) |
| 3905 STLDeleteValues(&power_save_blockers_[i->first]); | 3900 STLDeleteValues(&power_save_blockers_[i->first]); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3924 | 3919 |
| 3925 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3920 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 3926 if (!delegate_) | 3921 if (!delegate_) |
| 3927 return; | 3922 return; |
| 3928 const gfx::Size new_size = GetPreferredSize(); | 3923 const gfx::Size new_size = GetPreferredSize(); |
| 3929 if (new_size != old_size) | 3924 if (new_size != old_size) |
| 3930 delegate_->UpdatePreferredSize(this, new_size); | 3925 delegate_->UpdatePreferredSize(this, new_size); |
| 3931 } | 3926 } |
| 3932 | 3927 |
| 3933 } // namespace content | 3928 } // namespace content |
| OLD | NEW |