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/autocomplete_match.h" | 5 #include "components/omnibox/browser/autocomplete_match.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "components/omnibox/browser/autocomplete_provider.h" | 20 #include "components/omnibox/browser/autocomplete_provider.h" |
21 #include "components/omnibox/browser/suggestion_answer.h" | 21 #include "components/omnibox/browser/suggestion_answer.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 "components/url_formatter/url_formatter.h" | 24 #include "components/url_formatter/url_formatter.h" |
25 #include "ui/gfx/vector_icon_types.h" | 25 #include "ui/gfx/vector_icon_types.h" |
26 | 26 |
27 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 27 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
28 #include "components/omnibox/browser/vector_icons.h" // nogncheck | 28 #include "components/omnibox/browser/vector_icons.h" // nogncheck |
| 29 #include "ui/vector_icons/vector_icons.h" // nogncheck |
29 #endif | 30 #endif |
30 | 31 |
31 namespace { | 32 namespace { |
32 | 33 |
33 bool IsTrivialClassification(const ACMatchClassifications& classifications) { | 34 bool IsTrivialClassification(const ACMatchClassifications& classifications) { |
34 return classifications.empty() || | 35 return classifications.empty() || |
35 ((classifications.size() == 1) && | 36 ((classifications.size() == 1) && |
36 (classifications.back().style == ACMatchClassification::NONE)); | 37 (classifications.back().style == ACMatchClassification::NONE)); |
37 } | 38 } |
38 | 39 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 case Type::SEARCH_WHAT_YOU_TYPED: | 192 case Type::SEARCH_WHAT_YOU_TYPED: |
192 case Type::SEARCH_HISTORY: | 193 case Type::SEARCH_HISTORY: |
193 case Type::SEARCH_SUGGEST: | 194 case Type::SEARCH_SUGGEST: |
194 case Type::SEARCH_SUGGEST_ENTITY: | 195 case Type::SEARCH_SUGGEST_ENTITY: |
195 case Type::SEARCH_SUGGEST_TAIL: | 196 case Type::SEARCH_SUGGEST_TAIL: |
196 case Type::SEARCH_SUGGEST_PERSONALIZED: | 197 case Type::SEARCH_SUGGEST_PERSONALIZED: |
197 case Type::SEARCH_SUGGEST_PROFILE: | 198 case Type::SEARCH_SUGGEST_PROFILE: |
198 case Type::SEARCH_OTHER_ENGINE: | 199 case Type::SEARCH_OTHER_ENGINE: |
199 case Type::CONTACT_DEPRECATED: | 200 case Type::CONTACT_DEPRECATED: |
200 case Type::VOICE_SUGGEST: | 201 case Type::VOICE_SUGGEST: |
201 return omnibox::kSearchIcon; | 202 return ui::kSearchIcon; |
202 | 203 |
203 case Type::EXTENSION_APP: | 204 case Type::EXTENSION_APP: |
204 return omnibox::kExtensionAppIcon; | 205 return omnibox::kExtensionAppIcon; |
205 | 206 |
206 case Type::CALCULATOR: | 207 case Type::CALCULATOR: |
207 return omnibox::kCalculatorIcon; | 208 return omnibox::kCalculatorIcon; |
208 | 209 |
209 case Type::NUM_TYPES: | 210 case Type::NUM_TYPES: |
210 NOTREACHED(); | 211 NOTREACHED(); |
211 break; | 212 break; |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 << " is unsorted in relation to last offset of " << last_offset | 620 << " is unsorted in relation to last offset of " << last_offset |
620 << ". Provider: " << provider_name << "."; | 621 << ". Provider: " << provider_name << "."; |
621 DCHECK_LT(i->offset, text.length()) | 622 DCHECK_LT(i->offset, text.length()) |
622 << " Classification of [" << i->offset << "," << text.length() | 623 << " Classification of [" << i->offset << "," << text.length() |
623 << "] is out of bounds for \"" << text << "\". Provider: " | 624 << "] is out of bounds for \"" << text << "\". Provider: " |
624 << provider_name << "."; | 625 << provider_name << "."; |
625 last_offset = i->offset; | 626 last_offset = i->offset; |
626 } | 627 } |
627 } | 628 } |
628 #endif | 629 #endif |
OLD | NEW |