| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 return; | 363 return; |
| 364 | 364 |
| 365 if (is_active_) | 365 if (is_active_) |
| 366 return; | 366 return; |
| 367 | 367 |
| 368 TemplateURLModel* model = tab_contents->profile()->GetTemplateURLModel(); | 368 TemplateURLModel* model = tab_contents->profile()->GetTemplateURLModel(); |
| 369 if (!model) | 369 if (!model) |
| 370 return; | 370 return; |
| 371 | 371 |
| 372 const TemplateURL* template_url = model->GetDefaultSearchProvider(); | 372 const TemplateURL* template_url = model->GetDefaultSearchProvider(); |
| 373 if (!template_url) | 373 if (!template_url || !template_url->instant_url()) |
| 374 return; | 374 return; |
| 375 | 375 |
| 376 if (tab_contents != tab_contents_) | 376 if (tab_contents != tab_contents_) |
| 377 DestroyPreviewContents(); | 377 DestroyPreviewContents(); |
| 378 tab_contents_ = tab_contents; | 378 tab_contents_ = tab_contents; |
| 379 | 379 |
| 380 if (!loader_manager_.get()) | 380 if (!loader_manager_.get()) |
| 381 loader_manager_.reset(new InstantLoaderManager(this)); | 381 loader_manager_.reset(new InstantLoaderManager(this)); |
| 382 loader_manager_->GetInstantLoader(template_url->id()) | 382 loader_manager_->GetInstantLoader(template_url->id()) |
| 383 ->MaybeLoadInstantURL(tab_contents, template_url); | 383 ->MaybeLoadInstantURL(tab_contents, template_url); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 const AutocompleteMatch& match) { | 726 const AutocompleteMatch& match) { |
| 727 const TemplateURL* template_url = match.template_url; | 727 const TemplateURL* template_url = match.template_url; |
| 728 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || | 728 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || |
| 729 match.type == AutocompleteMatch::SEARCH_HISTORY || | 729 match.type == AutocompleteMatch::SEARCH_HISTORY || |
| 730 match.type == AutocompleteMatch::SEARCH_SUGGEST) { | 730 match.type == AutocompleteMatch::SEARCH_SUGGEST) { |
| 731 TemplateURLModel* model = tab_contents_->profile()->GetTemplateURLModel(); | 731 TemplateURLModel* model = tab_contents_->profile()->GetTemplateURLModel(); |
| 732 template_url = model ? model->GetDefaultSearchProvider() : NULL; | 732 template_url = model ? model->GetDefaultSearchProvider() : NULL; |
| 733 } | 733 } |
| 734 return template_url; | 734 return template_url; |
| 735 } | 735 } |
| OLD | NEW |