| 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 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 session_storage_namespace); | 1419 session_storage_namespace); |
| 1420 CreateParams create_params(GetBrowserContext(), site_instance.get()); | 1420 CreateParams create_params(GetBrowserContext(), site_instance.get()); |
| 1421 create_params.routing_id = route_id; | 1421 create_params.routing_id = route_id; |
| 1422 create_params.main_frame_routing_id = main_frame_route_id; | 1422 create_params.main_frame_routing_id = main_frame_route_id; |
| 1423 if (!is_guest) { | 1423 if (!is_guest) { |
| 1424 create_params.context = view_->GetNativeView(); | 1424 create_params.context = view_->GetNativeView(); |
| 1425 create_params.initial_size = GetContainerBounds().size(); | 1425 create_params.initial_size = GetContainerBounds().size(); |
| 1426 } else { | 1426 } else { |
| 1427 // This makes |new_contents| act as a guest. | 1427 // This makes |new_contents| act as a guest. |
| 1428 // For more info, see comment above class BrowserPluginGuest. | 1428 // For more info, see comment above class BrowserPluginGuest. |
| 1429 int instance_id = GetBrowserPluginGuestManager()->get_next_instance_id(); | 1429 int instance_id = |
| 1430 BrowserPluginGuestManager::FromBrowserContext(GetBrowserContext())-> |
| 1431 GetNextInstanceID(); |
| 1430 WebContentsImpl* new_contents_impl = | 1432 WebContentsImpl* new_contents_impl = |
| 1431 static_cast<WebContentsImpl*>(new_contents); | 1433 static_cast<WebContentsImpl*>(new_contents); |
| 1432 BrowserPluginGuest::CreateWithOpener(instance_id, | 1434 BrowserPluginGuest::CreateWithOpener(instance_id, |
| 1433 new_contents_impl->opener() != NULL, | 1435 new_contents_impl->opener() != NULL, |
| 1434 new_contents_impl, | 1436 new_contents_impl, |
| 1435 GetBrowserPluginGuest()); | 1437 GetBrowserPluginGuest()); |
| 1436 } | 1438 } |
| 1437 if (params.disposition == NEW_BACKGROUND_TAB) | 1439 if (params.disposition == NEW_BACKGROUND_TAB) |
| 1438 create_params.initially_hidden = true; | 1440 create_params.initially_hidden = true; |
| 1439 new_contents->Init(create_params); | 1441 new_contents->Init(create_params); |
| (...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3942 | 3944 |
| 3943 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { | 3945 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { |
| 3944 CHECK(!browser_plugin_guest_); | 3946 CHECK(!browser_plugin_guest_); |
| 3945 browser_plugin_guest_.reset(guest); | 3947 browser_plugin_guest_.reset(guest); |
| 3946 } | 3948 } |
| 3947 | 3949 |
| 3948 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { | 3950 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { |
| 3949 return browser_plugin_embedder_.get(); | 3951 return browser_plugin_embedder_.get(); |
| 3950 } | 3952 } |
| 3951 | 3953 |
| 3952 BrowserPluginGuestManager* | |
| 3953 WebContentsImpl::GetBrowserPluginGuestManager() const { | |
| 3954 return static_cast<BrowserPluginGuestManager*>( | |
| 3955 GetBrowserContext()->GetUserData( | |
| 3956 browser_plugin::kBrowserPluginGuestManagerKeyName)); | |
| 3957 } | |
| 3958 | |
| 3959 void WebContentsImpl::ClearPowerSaveBlockers( | 3954 void WebContentsImpl::ClearPowerSaveBlockers( |
| 3960 RenderFrameHost* render_frame_host) { | 3955 RenderFrameHost* render_frame_host) { |
| 3961 STLDeleteValues(&power_save_blockers_[render_frame_host]); | 3956 STLDeleteValues(&power_save_blockers_[render_frame_host]); |
| 3962 power_save_blockers_.erase(render_frame_host); | 3957 power_save_blockers_.erase(render_frame_host); |
| 3963 } | 3958 } |
| 3964 | 3959 |
| 3965 void WebContentsImpl::ClearAllPowerSaveBlockers() { | 3960 void WebContentsImpl::ClearAllPowerSaveBlockers() { |
| 3966 for (PowerSaveBlockerMap::iterator i(power_save_blockers_.begin()); | 3961 for (PowerSaveBlockerMap::iterator i(power_save_blockers_.begin()); |
| 3967 i != power_save_blockers_.end(); ++i) | 3962 i != power_save_blockers_.end(); ++i) |
| 3968 STLDeleteValues(&power_save_blockers_[i->first]); | 3963 STLDeleteValues(&power_save_blockers_[i->first]); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3987 | 3982 |
| 3988 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3983 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 3989 if (!delegate_) | 3984 if (!delegate_) |
| 3990 return; | 3985 return; |
| 3991 const gfx::Size new_size = GetPreferredSize(); | 3986 const gfx::Size new_size = GetPreferredSize(); |
| 3992 if (new_size != old_size) | 3987 if (new_size != old_size) |
| 3993 delegate_->UpdatePreferredSize(this, new_size); | 3988 delegate_->UpdatePreferredSize(this, new_size); |
| 3994 } | 3989 } |
| 3995 | 3990 |
| 3996 } // namespace content | 3991 } // namespace content |
| OLD | NEW |