| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_controller.h" | 5 #include "chrome/browser/instant/instant_controller.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 TabContentsWrapper* InstantController::GetPreviewContents() { | 330 TabContentsWrapper* InstantController::GetPreviewContents() { |
| 331 return loader_manager_.get() && loader_manager_->current_loader() ? | 331 return loader_manager_.get() && loader_manager_->current_loader() ? |
| 332 loader_manager_->current_loader()->preview_contents() : NULL; | 332 loader_manager_->current_loader()->preview_contents() : NULL; |
| 333 } | 333 } |
| 334 | 334 |
| 335 bool InstantController::IsShowingInstant() { | 335 bool InstantController::IsShowingInstant() { |
| 336 return loader_manager_.get() && loader_manager_->current_loader() && | 336 return loader_manager_.get() && loader_manager_->current_loader() && |
| 337 loader_manager_->current_loader()->is_showing_instant(); | 337 loader_manager_->current_loader()->is_showing_instant(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 string16 InstantController::GetCompleteSuggestedText() { |
| 341 return loader_manager_.get() && loader_manager_->active_loader() ? |
| 342 loader_manager_->active_loader()->complete_suggested_text() : string16(); |
| 343 } |
| 344 |
| 340 bool InstantController::MightSupportInstant() { | 345 bool InstantController::MightSupportInstant() { |
| 341 return loader_manager_.get() && loader_manager_->active_loader() && | 346 return loader_manager_.get() && loader_manager_->active_loader() && |
| 342 loader_manager_->active_loader()->is_showing_instant(); | 347 loader_manager_->active_loader()->is_showing_instant(); |
| 343 } | 348 } |
| 344 | 349 |
| 345 void InstantController::ShowInstantLoader(InstantLoader* loader) { | 350 void InstantController::ShowInstantLoader(InstantLoader* loader) { |
| 346 DCHECK(loader_manager_.get()); | 351 DCHECK(loader_manager_.get()); |
| 347 if (loader_manager_->current_loader() == loader) { | 352 if (loader_manager_->current_loader() == loader) { |
| 348 is_displayable_ = true; | 353 is_displayable_ = true; |
| 349 delegate_->ShowInstant(loader->preview_contents()); | 354 delegate_->ShowInstant(loader->preview_contents()); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 return "Predictive"; | 641 return "Predictive"; |
| 637 case VERBATIM_TYPE: | 642 case VERBATIM_TYPE: |
| 638 return "Verbatim"; | 643 return "Verbatim"; |
| 639 case PREDICTIVE_NO_AUTO_COMPLETE_TYPE: | 644 case PREDICTIVE_NO_AUTO_COMPLETE_TYPE: |
| 640 return "PredictiveNoAutoComplete"; | 645 return "PredictiveNoAutoComplete"; |
| 641 default: | 646 default: |
| 642 NOTREACHED(); | 647 NOTREACHED(); |
| 643 return std::string(); | 648 return std::string(); |
| 644 } | 649 } |
| 645 } | 650 } |
| OLD | NEW |