OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 return; | 493 return; |
494 | 494 |
495 // Because of the state of the stack we can't destroy the loader now. | 495 // Because of the state of the stack we can't destroy the loader now. |
496 ScheduleDestroy(loader); | 496 ScheduleDestroy(loader); |
497 | 497 |
498 loader_manager_->ReleaseLoader(loader); | 498 loader_manager_->ReleaseLoader(loader); |
499 | 499 |
500 UpdateDisplayableLoader(); | 500 UpdateDisplayableLoader(); |
501 } | 501 } |
502 | 502 |
| 503 void InstantController::SwappedTabContents(InstantLoader* loader) { |
| 504 if (displayable_loader_ == loader) |
| 505 delegate_->ShowInstant(displayable_loader_->preview_contents()); |
| 506 } |
| 507 |
503 void InstantController::UpdateDisplayableLoader() { | 508 void InstantController::UpdateDisplayableLoader() { |
504 InstantLoader* loader = NULL; | 509 InstantLoader* loader = NULL; |
505 // As soon as the pending loader is displayable it becomes the current loader, | 510 // As soon as the pending loader is displayable it becomes the current loader, |
506 // so we need only concern ourselves with the current loader here. | 511 // so we need only concern ourselves with the current loader here. |
507 if (loader_manager_.get() && loader_manager_->current_loader() && | 512 if (loader_manager_.get() && loader_manager_->current_loader() && |
508 loader_manager_->current_loader()->ready() && | 513 loader_manager_->current_loader()->ready() && |
509 (!show_timer_.IsRunning() || | 514 (!show_timer_.IsRunning() || |
510 loader_manager_->current_loader()->http_status_ok())) { | 515 loader_manager_->current_loader()->http_status_ok())) { |
511 loader = loader_manager_->current_loader(); | 516 loader = loader_manager_->current_loader(); |
512 } | 517 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 const AutocompleteMatch& match) { | 699 const AutocompleteMatch& match) { |
695 const TemplateURL* template_url = match.template_url; | 700 const TemplateURL* template_url = match.template_url; |
696 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || | 701 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || |
697 match.type == AutocompleteMatch::SEARCH_HISTORY || | 702 match.type == AutocompleteMatch::SEARCH_HISTORY || |
698 match.type == AutocompleteMatch::SEARCH_SUGGEST) { | 703 match.type == AutocompleteMatch::SEARCH_SUGGEST) { |
699 TemplateURLModel* model = tab_contents_->profile()->GetTemplateURLModel(); | 704 TemplateURLModel* model = tab_contents_->profile()->GetTemplateURLModel(); |
700 template_url = model ? model->GetDefaultSearchProvider() : NULL; | 705 template_url = model ? model->GetDefaultSearchProvider() : NULL; |
701 } | 706 } |
702 return template_url; | 707 return template_url; |
703 } | 708 } |
OLD | NEW |