| 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/instant/instant_loader.h" | 5 #include "chrome/browser/instant/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/history/history_types.h" | 8 #include "chrome/browser/history/history_types.h" |
| 9 #include "chrome/browser/instant/instant_loader_delegate.h" | 9 #include "chrome/browser/instant/instant_loader_delegate.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 if (!supports_instant) | 242 if (!supports_instant) |
| 243 loader_->preview_contents_->web_contents()->SetDelegate(NULL); | 243 loader_->preview_contents_->web_contents()->SetDelegate(NULL); |
| 244 } | 244 } |
| 245 | 245 |
| 246 // InstantLoader --------------------------------------------------------------- | 246 // InstantLoader --------------------------------------------------------------- |
| 247 | 247 |
| 248 InstantLoader::InstantLoader(InstantLoaderDelegate* delegate, | 248 InstantLoader::InstantLoader(InstantLoaderDelegate* delegate, |
| 249 const std::string& instant_url, | 249 const std::string& instant_url, |
| 250 const TabContents* tab_contents) | 250 const TabContents* tab_contents) |
| 251 : loader_delegate_(delegate), | 251 : loader_delegate_(delegate), |
| 252 preview_contents_(new TabContents(content::WebContents::Create( | 252 preview_contents_(new TabContents( |
| 253 tab_contents->profile(), NULL, MSG_ROUTING_NONE, | 253 content::WebContents::CreateWithSessionStorage( |
| 254 tab_contents->web_contents(), | 254 tab_contents->profile(), NULL, MSG_ROUTING_NONE, |
| 255 tab_contents->web_contents()->GetController(). | 255 tab_contents->web_contents(), |
| 256 GetSessionStorageNamespace()))), | 256 tab_contents->web_contents()->GetController(). |
| 257 GetSessionStorageNamespaceMap()))), |
| 257 preview_delegate_(new WebContentsDelegateImpl( | 258 preview_delegate_(new WebContentsDelegateImpl( |
| 258 ALLOW_THIS_IN_INITIALIZER_LIST(this))), | 259 ALLOW_THIS_IN_INITIALIZER_LIST(this))), |
| 259 supports_instant_(false), | 260 supports_instant_(false), |
| 260 instant_url_(instant_url) { | 261 instant_url_(instant_url) { |
| 261 } | 262 } |
| 262 | 263 |
| 263 InstantLoader::~InstantLoader() { | 264 InstantLoader::~InstantLoader() { |
| 264 if (preview_contents()) | 265 if (preview_contents()) |
| 265 preview_contents_->web_contents()->SetDelegate(NULL); | 266 preview_contents_->web_contents()->SetDelegate(NULL); |
| 266 } | 267 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 TabContents* new_tc) { | 377 TabContents* new_tc) { |
| 377 DCHECK(old_tc == preview_contents_); | 378 DCHECK(old_tc == preview_contents_); |
| 378 CleanupPreviewContents(); | 379 CleanupPreviewContents(); |
| 379 // We release here without deleting so that the caller still has the | 380 // We release here without deleting so that the caller still has the |
| 380 // responsibility for deleting the TabContents. | 381 // responsibility for deleting the TabContents. |
| 381 ignore_result(preview_contents_.release()); | 382 ignore_result(preview_contents_.release()); |
| 382 preview_contents_.reset(new_tc); | 383 preview_contents_.reset(new_tc); |
| 383 SetupPreviewContents(); | 384 SetupPreviewContents(); |
| 384 loader_delegate_->SwappedTabContents(this); | 385 loader_delegate_->SwappedTabContents(this); |
| 385 } | 386 } |
| OLD | NEW |