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 "chrome/browser/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "content/public/browser/render_frame_host.h" | 32 #include "content/public/browser/render_frame_host.h" |
33 #include "content/public/browser/render_process_host.h" | 33 #include "content/public/browser/render_process_host.h" |
34 #include "content/public/browser/render_view_host.h" | 34 #include "content/public/browser/render_view_host.h" |
35 #include "content/public/browser/resource_request_details.h" | 35 #include "content/public/browser/resource_request_details.h" |
36 #include "content/public/browser/session_storage_namespace.h" | 36 #include "content/public/browser/session_storage_namespace.h" |
37 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
38 #include "content/public/browser/web_contents_delegate.h" | 38 #include "content/public/browser/web_contents_delegate.h" |
39 #include "content/public/browser/web_contents_view.h" | 39 #include "content/public/browser/web_contents_view.h" |
40 #include "content/public/common/frame_navigate_params.h" | 40 #include "content/public/common/frame_navigate_params.h" |
41 #include "content/public/common/page_transition_types.h" | 41 #include "content/public/common/page_transition_types.h" |
| 42 #include "ui/gfx/layout_util.h" |
42 #include "ui/gfx/rect.h" | 43 #include "ui/gfx/rect.h" |
43 | 44 |
44 using content::DownloadItem; | 45 using content::DownloadItem; |
45 using content::OpenURLParams; | 46 using content::OpenURLParams; |
46 using content::RenderViewHost; | 47 using content::RenderViewHost; |
47 using content::ResourceRedirectDetails; | 48 using content::ResourceRedirectDetails; |
48 using content::SessionStorageNamespace; | 49 using content::SessionStorageNamespace; |
49 using content::WebContents; | 50 using content::WebContents; |
50 | 51 |
51 namespace prerender { | 52 namespace prerender { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 321 |
321 alias_session_storage_namespace = session_storage_namespace->CreateAlias(); | 322 alias_session_storage_namespace = session_storage_namespace->CreateAlias(); |
322 prerender_contents_.reset( | 323 prerender_contents_.reset( |
323 CreateWebContents(alias_session_storage_namespace.get())); | 324 CreateWebContents(alias_session_storage_namespace.get())); |
324 TabHelpers::AttachTabHelpers(prerender_contents_.get()); | 325 TabHelpers::AttachTabHelpers(prerender_contents_.get()); |
325 content::WebContentsObserver::Observe(prerender_contents_.get()); | 326 content::WebContentsObserver::Observe(prerender_contents_.get()); |
326 | 327 |
327 web_contents_delegate_.reset(new WebContentsDelegateImpl(this)); | 328 web_contents_delegate_.reset(new WebContentsDelegateImpl(this)); |
328 prerender_contents_.get()->SetDelegate(web_contents_delegate_.get()); | 329 prerender_contents_.get()->SetDelegate(web_contents_delegate_.get()); |
329 // Set the size of the prerender WebContents. | 330 // Set the size of the prerender WebContents. |
330 prerender_contents_->GetView()->SizeContents(size_); | 331 gfx::ResizeWebContents(prerender_contents_, size_); |
331 | 332 |
332 child_id_ = GetRenderViewHost()->GetProcess()->GetID(); | 333 child_id_ = GetRenderViewHost()->GetProcess()->GetID(); |
333 route_id_ = GetRenderViewHost()->GetRoutingID(); | 334 route_id_ = GetRenderViewHost()->GetRoutingID(); |
334 | 335 |
335 // Log transactions to see if we could merge session storage namespaces in | 336 // Log transactions to see if we could merge session storage namespaces in |
336 // the event of a mismatch. | 337 // the event of a mismatch. |
337 alias_session_storage_namespace->AddTransactionLogProcessId(child_id_); | 338 alias_session_storage_namespace->AddTransactionLogProcessId(child_id_); |
338 | 339 |
339 NotifyPrerenderStart(); | 340 NotifyPrerenderStart(); |
340 | 341 |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 void PrerenderContents::AddResourceThrottle( | 876 void PrerenderContents::AddResourceThrottle( |
876 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { | 877 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { |
877 resource_throttles_.push_back(throttle); | 878 resource_throttles_.push_back(throttle); |
878 } | 879 } |
879 | 880 |
880 void PrerenderContents::AddNetworkBytes(int64 bytes) { | 881 void PrerenderContents::AddNetworkBytes(int64 bytes) { |
881 network_bytes_ += bytes; | 882 network_bytes_ += bytes; |
882 } | 883 } |
883 | 884 |
884 } // namespace prerender | 885 } // namespace prerender |
OLD | NEW |