| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/search/instant_loader.h" | 5 #include "chrome/browser/ui/search/instant_loader.h" |
| 6 | 6 |
| 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 8 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 8 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
| 9 #include "chrome/browser/favicon/favicon_tab_helper.h" | 9 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 10 #include "chrome/browser/history/history_tab_helper.h" | 10 #include "chrome/browser/history/history_tab_helper.h" |
| 11 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" | 11 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" |
| 12 #include "chrome/browser/search/search.h" |
| 12 #include "chrome/browser/tab_contents/tab_util.h" | 13 #include "chrome/browser/tab_contents/tab_util.h" |
| 13 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 14 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 14 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 15 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 15 #include "chrome/browser/ui/search/search_tab_helper.h" | 16 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 16 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 17 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 17 #include "content/public/browser/navigation_entry.h" | 18 #include "content/public/browser/navigation_entry.h" |
| 18 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
| 19 #include "content/public/browser/notification_types.h" | 20 #include "content/public/browser/notification_types.h" |
| 20 #include "content/public/browser/render_widget_host_view.h" | 21 #include "content/public/browser/render_widget_host_view.h" |
| 21 #include "content/public/browser/site_instance.h" | 22 #include "content/public/browser/site_instance.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 41 | 42 |
| 42 InstantLoader::~InstantLoader() { | 43 InstantLoader::~InstantLoader() { |
| 43 } | 44 } |
| 44 | 45 |
| 45 void InstantLoader::Init(const GURL& instant_url, | 46 void InstantLoader::Init(const GURL& instant_url, |
| 46 Profile* profile, | 47 Profile* profile, |
| 47 const content::WebContents* active_tab, | 48 const content::WebContents* active_tab, |
| 48 const base::Closure& on_stale_callback) { | 49 const base::Closure& on_stale_callback) { |
| 49 content::WebContents::CreateParams create_params(profile); | 50 content::WebContents::CreateParams create_params(profile); |
| 50 create_params.site_instance = content::SiteInstance::CreateForURL( | 51 create_params.site_instance = content::SiteInstance::CreateForURL( |
| 51 profile, instant_url); | 52 profile, chrome::GetPrivilegedURLForInstant(instant_url, profile)); |
| 52 SetContents(scoped_ptr<content::WebContents>( | 53 SetContents(scoped_ptr<content::WebContents>( |
| 53 content::WebContents::Create(create_params))); | 54 content::WebContents::Create(create_params))); |
| 54 instant_url_ = instant_url; | 55 instant_url_ = instant_url; |
| 55 on_stale_callback_ = on_stale_callback; | 56 on_stale_callback_ = on_stale_callback; |
| 56 } | 57 } |
| 57 | 58 |
| 58 void InstantLoader::Load() { | 59 void InstantLoader::Load() { |
| 59 DVLOG(1) << "LoadURL: " << instant_url_; | 60 DVLOG(1) << "LoadURL: " << instant_url_; |
| 60 contents_->GetController().LoadURL( | 61 contents_->GetController().LoadURL( |
| 61 instant_url_, content::Referrer(), | 62 instant_url_, content::Referrer(), |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 230 |
| 230 bool InstantLoader::OnGoToEntryOffset(int /* offset */) { | 231 bool InstantLoader::OnGoToEntryOffset(int /* offset */) { |
| 231 return false; | 232 return false; |
| 232 } | 233 } |
| 233 | 234 |
| 234 content::WebContents* InstantLoader::OpenURLFromTab( | 235 content::WebContents* InstantLoader::OpenURLFromTab( |
| 235 content::WebContents* source, | 236 content::WebContents* source, |
| 236 const content::OpenURLParams& params) { | 237 const content::OpenURLParams& params) { |
| 237 return delegate_->OpenURLFromTab(source, params); | 238 return delegate_->OpenURLFromTab(source, params); |
| 238 } | 239 } |
| OLD | NEW |