| 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/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/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" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 content::WebContents* InstantLoader::ReleaseContents() { | 221 content::WebContents* InstantLoader::ReleaseContents() { |
| 222 CleanupPreviewContents(); | 222 CleanupPreviewContents(); |
| 223 return contents_.release(); | 223 return contents_.release(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void InstantLoader::DidNavigate( | 226 void InstantLoader::DidNavigate( |
| 227 const history::HistoryAddPageArgs& add_page_args) { | 227 const history::HistoryAddPageArgs& add_page_args) { |
| 228 last_navigation_ = add_page_args; | 228 last_navigation_ = add_page_args; |
| 229 } | 229 } |
| 230 | 230 |
| 231 bool InstantLoader::IsUsingLocalPreview() const { |
| 232 return instant_url_ == InstantController::kLocalOmniboxPopupURL; |
| 233 } |
| 234 |
| 231 void InstantLoader::Update(const string16& text, | 235 void InstantLoader::Update(const string16& text, |
| 232 size_t selection_start, | 236 size_t selection_start, |
| 233 size_t selection_end, | 237 size_t selection_end, |
| 234 bool verbatim) { | 238 bool verbatim) { |
| 235 last_navigation_ = history::HistoryAddPageArgs(); | 239 last_navigation_ = history::HistoryAddPageArgs(); |
| 236 client_.Update(text, selection_start, selection_end, verbatim); | 240 client_.Update(text, selection_start, selection_end, verbatim); |
| 237 } | 241 } |
| 238 | 242 |
| 239 void InstantLoader::Submit(const string16& text) { | 243 void InstantLoader::Submit(const string16& text) { |
| 240 client_.Submit(text); | 244 client_.Submit(text); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 content::WebContents* new_contents) { | 427 content::WebContents* new_contents) { |
| 424 DCHECK_EQ(old_contents, contents()); | 428 DCHECK_EQ(old_contents, contents()); |
| 425 CleanupPreviewContents(); | 429 CleanupPreviewContents(); |
| 426 // We release here without deleting so that the caller still has the | 430 // We release here without deleting so that the caller still has the |
| 427 // responsibility for deleting the WebContents. | 431 // responsibility for deleting the WebContents. |
| 428 ignore_result(contents_.release()); | 432 ignore_result(contents_.release()); |
| 429 contents_.reset(new_contents); | 433 contents_.reset(new_contents); |
| 430 SetupPreviewContents(); | 434 SetupPreviewContents(); |
| 431 controller_->SwappedWebContents(); | 435 controller_->SwappedWebContents(); |
| 432 } | 436 } |
| OLD | NEW |