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" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
15 #include "components/metrics/proto/omnibox_input_type.pb.h" | 15 #include "components/metrics/proto/omnibox_input_type.pb.h" |
16 #include "components/omnibox/browser/autocomplete_match.h" | 16 #include "components/omnibox/browser/autocomplete_match.h" |
17 #include "components/omnibox/browser/autocomplete_provider_client.h" | 17 #include "components/omnibox/browser/autocomplete_provider_client.h" |
18 #include "components/omnibox/browser/autocomplete_provider_listener.h" | 18 #include "components/omnibox/browser/autocomplete_provider_listener.h" |
19 #include "components/omnibox/browser/keyword_extensions_delegate.h" | 19 #include "components/omnibox/browser/keyword_extensions_delegate.h" |
20 #include "components/omnibox/browser/omnibox_field_trial.h" | 20 #include "components/omnibox/browser/omnibox_field_trial.h" |
21 #include "components/omnibox/browser/search_provider.h" | 21 #include "components/omnibox/browser/search_provider.h" |
22 #include "components/search_engines/template_url.h" | 22 #include "components/search_engines/template_url.h" |
23 #include "components/search_engines/template_url_service.h" | 23 #include "components/search_engines/template_url_service.h" |
24 #include "grit/components_strings.h" | 24 #include "components/strings/grit/components_strings.h" |
25 #include "net/base/escape.h" | 25 #include "net/base/escape.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 // Helper functor for Start(), for sorting keyword matches by quality. | 30 // Helper functor for Start(), for sorting keyword matches by quality. |
31 class CompareQuality { | 31 class CompareQuality { |
32 public: | 32 public: |
33 // A keyword is of higher quality when a greater fraction of the important | 33 // A keyword is of higher quality when a greater fraction of the important |
34 // part of it has been typed, that is, when the meaningful keyword length is | 34 // part of it has been typed, that is, when the meaningful keyword length is |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 ACMatchClassification(0, ACMatchClassification::NONE)); | 488 ACMatchClassification(0, ACMatchClassification::NONE)); |
489 } | 489 } |
490 } | 490 } |
491 | 491 |
492 TemplateURLService* KeywordProvider::GetTemplateURLService() const { | 492 TemplateURLService* KeywordProvider::GetTemplateURLService() const { |
493 // 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 |
494 // the model is already loaded. | 494 // the model is already loaded. |
495 model_->Load(); | 495 model_->Load(); |
496 return model_; | 496 return model_; |
497 } | 497 } |
OLD | NEW |