| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/omnibox/browser/zero_suggest_provider.h" | 5 #include "components/omnibox/browser/zero_suggest_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void ZeroSuggestProvider::RegisterProfilePrefs( | 97 void ZeroSuggestProvider::RegisterProfilePrefs( |
| 98 user_prefs::PrefRegistrySyncable* registry) { | 98 user_prefs::PrefRegistrySyncable* registry) { |
| 99 registry->RegisterStringPref(omnibox::kZeroSuggestCachedResults, | 99 registry->RegisterStringPref(omnibox::kZeroSuggestCachedResults, |
| 100 std::string()); | 100 std::string()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void ZeroSuggestProvider::Start(const AutocompleteInput& input, | 103 void ZeroSuggestProvider::Start(const AutocompleteInput& input, |
| 104 bool minimal_changes) { | 104 bool minimal_changes) { |
| 105 TRACE_EVENT0("omnibox", "ZeroSuggestProvider::Start"); | 105 TRACE_EVENT0("omnibox", "ZeroSuggestProvider::Start"); |
| 106 matches_.clear(); | 106 matches_.clear(); |
| 107 if (!input.from_omnibox_focus() || | 107 if (!input.from_omnibox_focus() || client()->IsOffTheRecord() || |
| 108 input.type() == metrics::OmniboxInputType::INVALID) | 108 input.type() == metrics::OmniboxInputType::INVALID) |
| 109 return; | 109 return; |
| 110 | 110 |
| 111 Stop(true, false); | 111 Stop(true, false); |
| 112 set_field_trial_triggered(false); | 112 set_field_trial_triggered(false); |
| 113 set_field_trial_triggered_in_session(false); | 113 set_field_trial_triggered_in_session(false); |
| 114 results_from_cache_ = false; | 114 results_from_cache_ = false; |
| 115 permanent_text_ = input.text(); | 115 permanent_text_ = input.text(); |
| 116 current_query_ = input.current_url().spec(); | 116 current_query_ = input.current_url().spec(); |
| 117 current_page_classification_ = input.current_page_classification(); | 117 current_page_classification_ = input.current_page_classification(); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 if (!json_data.empty()) { | 548 if (!json_data.empty()) { |
| 549 std::unique_ptr<base::Value> data( | 549 std::unique_ptr<base::Value> data( |
| 550 SearchSuggestionParser::DeserializeJsonData(json_data)); | 550 SearchSuggestionParser::DeserializeJsonData(json_data)); |
| 551 if (data && ParseSuggestResults( | 551 if (data && ParseSuggestResults( |
| 552 *data, kDefaultZeroSuggestRelevance, false, &results_)) { | 552 *data, kDefaultZeroSuggestRelevance, false, &results_)) { |
| 553 ConvertResultsToAutocompleteMatches(); | 553 ConvertResultsToAutocompleteMatches(); |
| 554 results_from_cache_ = !matches_.empty(); | 554 results_from_cache_ = !matches_.empty(); |
| 555 } | 555 } |
| 556 } | 556 } |
| 557 } | 557 } |
| OLD | NEW |