| 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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 return false; | 642 return false; |
| 643 | 643 |
| 644 // Was the host blacklisted? | 644 // Was the host blacklisted? |
| 645 if (host_blacklist_ && host_blacklist_->count(match.destination_url.host())) | 645 if (host_blacklist_ && host_blacklist_->count(match.destination_url.host())) |
| 646 return false; | 646 return false; |
| 647 | 647 |
| 648 const CommandLine* cl = CommandLine::ForCurrentProcess(); | 648 const CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 649 if (cl->HasSwitch(switches::kRestrictInstantToSearch) && | 649 if (cl->HasSwitch(switches::kRestrictInstantToSearch) && |
| 650 match.type != AutocompleteMatch::SEARCH_WHAT_YOU_TYPED && | 650 match.type != AutocompleteMatch::SEARCH_WHAT_YOU_TYPED && |
| 651 match.type != AutocompleteMatch::SEARCH_HISTORY && | 651 match.type != AutocompleteMatch::SEARCH_HISTORY && |
| 652 match.type != AutocompleteMatch::SEARCH_SUGGEST) { | 652 match.type != AutocompleteMatch::SEARCH_SUGGEST && |
| 653 match.type != AutocompleteMatch::SEARCH_OTHER_ENGINE) { |
| 653 return false; | 654 return false; |
| 654 } | 655 } |
| 655 | 656 |
| 656 return true; | 657 return true; |
| 657 } | 658 } |
| 658 | 659 |
| 659 void InstantController::BlacklistFromInstant(TemplateURLID id) { | 660 void InstantController::BlacklistFromInstant(TemplateURLID id) { |
| 660 blacklisted_ids_.insert(id); | 661 blacklisted_ids_.insert(id); |
| 661 } | 662 } |
| 662 | 663 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 685 const AutocompleteMatch& match) { | 686 const AutocompleteMatch& match) { |
| 686 const TemplateURL* template_url = match.template_url; | 687 const TemplateURL* template_url = match.template_url; |
| 687 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || | 688 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || |
| 688 match.type == AutocompleteMatch::SEARCH_HISTORY || | 689 match.type == AutocompleteMatch::SEARCH_HISTORY || |
| 689 match.type == AutocompleteMatch::SEARCH_SUGGEST) { | 690 match.type == AutocompleteMatch::SEARCH_SUGGEST) { |
| 690 TemplateURLModel* model = tab_contents_->profile()->GetTemplateURLModel(); | 691 TemplateURLModel* model = tab_contents_->profile()->GetTemplateURLModel(); |
| 691 template_url = model ? model->GetDefaultSearchProvider() : NULL; | 692 template_url = model ? model->GetDefaultSearchProvider() : NULL; |
| 692 } | 693 } |
| 693 return template_url; | 694 return template_url; |
| 694 } | 695 } |
| OLD | NEW |