| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 ACMatchClassification(0, ACMatchClassification::NONE)); | 488 ACMatchClassification(0, ACMatchClassification::NONE)); |
| 490 } | 489 } |
| 491 } | 490 } |
| 492 | 491 |
| 493 TemplateURLService* KeywordProvider::GetTemplateURLService() const { | 492 TemplateURLService* KeywordProvider::GetTemplateURLService() const { |
| 494 // Make sure the model is loaded. This is cheap and quickly bails out if | 493 // Make sure the model is loaded. This is cheap and quickly bails out if |
| 495 // the model is already loaded. | 494 // the model is already loaded. |
| 496 model_->Load(); | 495 model_->Load(); |
| 497 return model_; | 496 return model_; |
| 498 } | 497 } |
| OLD | NEW |