| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/keyword_provider.h" | 5 #include "components/omnibox/browser/keyword_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 if (extensions_delegate_ && !due_to_user_inactivity) | 352 if (extensions_delegate_ && !due_to_user_inactivity) |
| 353 extensions_delegate_->MaybeEndExtensionKeywordMode(); | 353 extensions_delegate_->MaybeEndExtensionKeywordMode(); |
| 354 } | 354 } |
| 355 | 355 |
| 356 KeywordProvider::~KeywordProvider() {} | 356 KeywordProvider::~KeywordProvider() {} |
| 357 | 357 |
| 358 // static | 358 // static |
| 359 bool KeywordProvider::ExtractKeywordFromInput(const AutocompleteInput& input, | 359 bool KeywordProvider::ExtractKeywordFromInput(const AutocompleteInput& input, |
| 360 base::string16* keyword, | 360 base::string16* keyword, |
| 361 base::string16* remaining_input) { | 361 base::string16* remaining_input) { |
| 362 if ((input.type() == metrics::OmniboxInputType::INVALID) || | 362 if ((input.type() == metrics::OmniboxInputType::INVALID)) |
| 363 (input.type() == metrics::OmniboxInputType::FORCED_QUERY)) | |
| 364 return false; | 363 return false; |
| 365 | 364 |
| 366 *keyword = TemplateURLService::CleanUserInputKeyword( | 365 *keyword = TemplateURLService::CleanUserInputKeyword( |
| 367 SplitKeywordFromInput(input.text(), true, remaining_input)); | 366 SplitKeywordFromInput(input.text(), true, remaining_input)); |
| 368 return !keyword->empty(); | 367 return !keyword->empty(); |
| 369 } | 368 } |
| 370 | 369 |
| 371 // static | 370 // static |
| 372 int KeywordProvider::CalculateRelevance(metrics::OmniboxInputType::Type type, | 371 int KeywordProvider::CalculateRelevance(metrics::OmniboxInputType::Type type, |
| 373 bool complete, | 372 bool complete, |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 ACMatchClassification::NONE, &match->contents_class); | 497 ACMatchClassification::NONE, &match->contents_class); |
| 499 } | 498 } |
| 500 } | 499 } |
| 501 | 500 |
| 502 TemplateURLService* KeywordProvider::GetTemplateURLService() const { | 501 TemplateURLService* KeywordProvider::GetTemplateURLService() const { |
| 503 // Make sure the model is loaded. This is cheap and quickly bails out if | 502 // Make sure the model is loaded. This is cheap and quickly bails out if |
| 504 // the model is already loaded. | 503 // the model is already loaded. |
| 505 model_->Load(); | 504 model_->Load(); |
| 506 return model_; | 505 return model_; |
| 507 } | 506 } |
| OLD | NEW |