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 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 void WebContentsImpl::CreateNewWindow( | 1326 void WebContentsImpl::CreateNewWindow( |
1327 int render_process_id, | 1327 int render_process_id, |
1328 int route_id, | 1328 int route_id, |
1329 int main_frame_route_id, | 1329 int main_frame_route_id, |
1330 const ViewHostMsg_CreateWindow_Params& params, | 1330 const ViewHostMsg_CreateWindow_Params& params, |
1331 SessionStorageNamespace* session_storage_namespace) { | 1331 SessionStorageNamespace* session_storage_namespace) { |
1332 // We usually create the new window in the same BrowsingInstance (group of | 1332 // We usually create the new window in the same BrowsingInstance (group of |
1333 // script-related windows), by passing in the current SiteInstance. However, | 1333 // script-related windows), by passing in the current SiteInstance. However, |
1334 // if the opener is being suppressed (in a non-guest), we create a new | 1334 // if the opener is being suppressed (in a non-guest), we create a new |
1335 // SiteInstance in its own BrowsingInstance. | 1335 // SiteInstance in its own BrowsingInstance. |
1336 bool is_guest = GetRenderProcessHost()->IsGuest(); | 1336 bool is_guest = BrowserPluginGuest::IsGuest(this); |
1337 | 1337 |
1338 // If the opener is to be suppressed, the new window can be in any process. | 1338 // If the opener is to be suppressed, the new window can be in any process. |
1339 // Since routing ids are process specific, we must not have one passed in | 1339 // Since routing ids are process specific, we must not have one passed in |
1340 // as argument here. | 1340 // as argument here. |
1341 DCHECK(!params.opener_suppressed || route_id == MSG_ROUTING_NONE); | 1341 DCHECK(!params.opener_suppressed || route_id == MSG_ROUTING_NONE); |
1342 | 1342 |
1343 scoped_refptr<SiteInstance> site_instance = | 1343 scoped_refptr<SiteInstance> site_instance = |
1344 params.opener_suppressed && !is_guest ? | 1344 params.opener_suppressed && !is_guest ? |
1345 SiteInstance::CreateForURL(GetBrowserContext(), params.target_url) : | 1345 SiteInstance::CreateForURL(GetBrowserContext(), params.target_url) : |
1346 GetSiteInstance(); | 1346 GetSiteInstance(); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 // in creating one, just return NULL. | 1595 // in creating one, just return NULL. |
1596 if (iter == pending_contents_.end()) { | 1596 if (iter == pending_contents_.end()) { |
1597 return NULL; | 1597 return NULL; |
1598 } | 1598 } |
1599 | 1599 |
1600 WebContentsImpl* new_contents = iter->second; | 1600 WebContentsImpl* new_contents = iter->second; |
1601 pending_contents_.erase(route_id); | 1601 pending_contents_.erase(route_id); |
1602 RemoveDestructionObserver(new_contents); | 1602 RemoveDestructionObserver(new_contents); |
1603 | 1603 |
1604 // Don't initialize the guest WebContents immediately. | 1604 // Don't initialize the guest WebContents immediately. |
1605 if (new_contents->GetRenderProcessHost()->IsGuest()) | 1605 if (BrowserPluginGuest::IsGuest(new_contents)) |
1606 return new_contents; | 1606 return new_contents; |
1607 | 1607 |
1608 if (!new_contents->GetRenderProcessHost()->HasConnection() || | 1608 if (!new_contents->GetRenderProcessHost()->HasConnection() || |
1609 !new_contents->GetRenderViewHost()->GetView()) | 1609 !new_contents->GetRenderViewHost()->GetView()) |
1610 return NULL; | 1610 return NULL; |
1611 | 1611 |
1612 // TODO(brettw): It seems bogus to reach into here and initialize the host. | 1612 // TODO(brettw): It seems bogus to reach into here and initialize the host. |
1613 static_cast<RenderViewHostImpl*>(new_contents->GetRenderViewHost())->Init(); | 1613 static_cast<RenderViewHostImpl*>(new_contents->GetRenderViewHost())->Init(); |
1614 return new_contents; | 1614 return new_contents; |
1615 } | 1615 } |
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4075 | 4075 |
4076 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 4076 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
4077 if (!delegate_) | 4077 if (!delegate_) |
4078 return; | 4078 return; |
4079 const gfx::Size new_size = GetPreferredSize(); | 4079 const gfx::Size new_size = GetPreferredSize(); |
4080 if (new_size != old_size) | 4080 if (new_size != old_size) |
4081 delegate_->UpdatePreferredSize(this, new_size); | 4081 delegate_->UpdatePreferredSize(this, new_size); |
4082 } | 4082 } |
4083 | 4083 |
4084 } // namespace content | 4084 } // namespace content |
OLD | NEW |