| 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 20 matching lines...) Expand all Loading... |
| 31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
| 32 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/render_frame_host.h" | 33 #include "content/public/browser/render_frame_host.h" |
| 34 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
| 35 #include "content/public/browser/render_view_host.h" | 35 #include "content/public/browser/render_view_host.h" |
| 36 #include "content/public/browser/resource_request_details.h" | 36 #include "content/public/browser/resource_request_details.h" |
| 37 #include "content/public/browser/session_storage_namespace.h" | 37 #include "content/public/browser/session_storage_namespace.h" |
| 38 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 39 #include "content/public/browser/web_contents_delegate.h" | 39 #include "content/public/browser/web_contents_delegate.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" | |
| 42 #include "net/url_request/url_request_context_getter.h" | 41 #include "net/url_request/url_request_context_getter.h" |
| 42 #include "ui/base/page_transition_types.h" |
| 43 #include "ui/gfx/rect.h" | 43 #include "ui/gfx/rect.h" |
| 44 | 44 |
| 45 using content::BrowserThread; | 45 using content::BrowserThread; |
| 46 using content::DownloadItem; | 46 using content::DownloadItem; |
| 47 using content::OpenURLParams; | 47 using content::OpenURLParams; |
| 48 using content::RenderViewHost; | 48 using content::RenderViewHost; |
| 49 using content::ResourceRedirectDetails; | 49 using content::ResourceRedirectDetails; |
| 50 using content::ResourceType; | 50 using content::ResourceType; |
| 51 using content::SessionStorageNamespace; | 51 using content::SessionStorageNamespace; |
| 52 using content::WebContents; | 52 using content::WebContents; |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 this, content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, | 375 this, content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, |
| 376 content::Source<WebContents>(prerender_contents_.get())); | 376 content::Source<WebContents>(prerender_contents_.get())); |
| 377 | 377 |
| 378 // Transfer over the user agent override. | 378 // Transfer over the user agent override. |
| 379 prerender_contents_.get()->SetUserAgentOverride( | 379 prerender_contents_.get()->SetUserAgentOverride( |
| 380 prerender_manager_->config().user_agent_override); | 380 prerender_manager_->config().user_agent_override); |
| 381 | 381 |
| 382 content::NavigationController::LoadURLParams load_url_params( | 382 content::NavigationController::LoadURLParams load_url_params( |
| 383 prerender_url_); | 383 prerender_url_); |
| 384 load_url_params.referrer = referrer_; | 384 load_url_params.referrer = referrer_; |
| 385 load_url_params.transition_type = content::PAGE_TRANSITION_LINK; | 385 load_url_params.transition_type = ui::PAGE_TRANSITION_LINK; |
| 386 if (origin_ == ORIGIN_OMNIBOX) { | 386 if (origin_ == ORIGIN_OMNIBOX) { |
| 387 load_url_params.transition_type = content::PageTransitionFromInt( | 387 load_url_params.transition_type = ui::PageTransitionFromInt( |
| 388 content::PAGE_TRANSITION_TYPED | | 388 ui::PAGE_TRANSITION_TYPED | |
| 389 content::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 389 ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
| 390 } else if (origin_ == ORIGIN_INSTANT) { | 390 } else if (origin_ == ORIGIN_INSTANT) { |
| 391 load_url_params.transition_type = content::PageTransitionFromInt( | 391 load_url_params.transition_type = ui::PageTransitionFromInt( |
| 392 content::PAGE_TRANSITION_GENERATED | | 392 ui::PAGE_TRANSITION_GENERATED | |
| 393 content::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 393 ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
| 394 } | 394 } |
| 395 load_url_params.override_user_agent = | 395 load_url_params.override_user_agent = |
| 396 prerender_manager_->config().is_overriding_user_agent ? | 396 prerender_manager_->config().is_overriding_user_agent ? |
| 397 content::NavigationController::UA_OVERRIDE_TRUE : | 397 content::NavigationController::UA_OVERRIDE_TRUE : |
| 398 content::NavigationController::UA_OVERRIDE_FALSE; | 398 content::NavigationController::UA_OVERRIDE_FALSE; |
| 399 prerender_contents_.get()->GetController().LoadURLWithParams(load_url_params); | 399 prerender_contents_.get()->GetController().LoadURLWithParams(load_url_params); |
| 400 } | 400 } |
| 401 | 401 |
| 402 bool PrerenderContents::GetChildId(int* child_id) const { | 402 bool PrerenderContents::GetChildId(int* child_id) const { |
| 403 CHECK(child_id); | 403 CHECK(child_id); |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 void PrerenderContents::AddResourceThrottle( | 886 void PrerenderContents::AddResourceThrottle( |
| 887 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { | 887 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { |
| 888 resource_throttles_.push_back(throttle); | 888 resource_throttles_.push_back(throttle); |
| 889 } | 889 } |
| 890 | 890 |
| 891 void PrerenderContents::AddNetworkBytes(int64 bytes) { | 891 void PrerenderContents::AddNetworkBytes(int64 bytes) { |
| 892 network_bytes_ += bytes; | 892 network_bytes_ += bytes; |
| 893 } | 893 } |
| 894 | 894 |
| 895 } // namespace prerender | 895 } // namespace prerender |
| OLD | NEW |