| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete_match.h" | 8 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 9 #include "chrome/browser/instant/instant_delegate.h" | 9 #include "chrome/browser/instant/instant_delegate.h" |
| 10 #include "chrome/browser/instant/instant_loader.h" | 10 #include "chrome/browser/instant/instant_loader.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 DestroyPreviewContents(); | 86 DestroyPreviewContents(); |
| 87 return; | 87 return; |
| 88 } | 88 } |
| 89 | 89 |
| 90 const TemplateURL* template_url = GetTemplateURL(match); | 90 const TemplateURL* template_url = GetTemplateURL(match); |
| 91 TemplateURLID template_url_id = template_url ? template_url->id() : 0; | 91 TemplateURLID template_url_id = template_url ? template_url->id() : 0; |
| 92 | 92 |
| 93 if (!loader_manager_.get()) | 93 if (!loader_manager_.get()) |
| 94 loader_manager_.reset(new InstantLoaderManager(this)); | 94 loader_manager_.reset(new InstantLoaderManager(this)); |
| 95 | 95 |
| 96 if (!is_active_) |
| 97 delegate_->PrepareForInstant(); |
| 98 |
| 96 if (ShouldUpdateNow(template_url_id, match.destination_url)) { | 99 if (ShouldUpdateNow(template_url_id, match.destination_url)) { |
| 97 UpdateLoader(template_url, match.destination_url, match.transition, | 100 UpdateLoader(template_url, match.destination_url, match.transition, |
| 98 user_text, suggested_text); | 101 user_text, suggested_text); |
| 99 } else { | 102 } else { |
| 100 ScheduleUpdate(match.destination_url); | 103 ScheduleUpdate(match.destination_url); |
| 101 } | 104 } |
| 102 | 105 |
| 103 NotificationService::current()->Notify( | 106 NotificationService::current()->Notify( |
| 104 NotificationType::INSTANT_CONTROLLER_UPDATED, | 107 NotificationType::INSTANT_CONTROLLER_UPDATED, |
| 105 Source<InstantController>(this), | 108 Source<InstantController>(this), |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 template_url = model ? model->GetDefaultSearchProvider() : NULL; | 412 template_url = model ? model->GetDefaultSearchProvider() : NULL; |
| 410 } | 413 } |
| 411 if (template_url && template_url->id() && | 414 if (template_url && template_url->id() && |
| 412 template_url->instant_url() && | 415 template_url->instant_url() && |
| 413 !IsBlacklistedFromInstant(template_url->id()) && | 416 !IsBlacklistedFromInstant(template_url->id()) && |
| 414 template_url->instant_url()->SupportsReplacement()) { | 417 template_url->instant_url()->SupportsReplacement()) { |
| 415 return template_url; | 418 return template_url; |
| 416 } | 419 } |
| 417 return NULL; | 420 return NULL; |
| 418 } | 421 } |
| OLD | NEW |