Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: ios/chrome/browser/ui/omnibox/omnibox_util.cc

Issue 2417693003: Upstream utilities to select icon to display in omnibox. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/ui/omnibox/omnibox_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ios/chrome/browser/ui/omnibox/omnibox_util.h"
6
7 #include "base/logging.h"
8 #include "ios/chrome/grit/ios_theme_resources.h"
9
10 int GetIconForAutocompleteMatchType(AutocompleteMatchType::Type type,
11 bool is_starred,
12 bool is_incognito) {
13 if (is_starred)
14 return is_incognito ? IDR_IOS_OMNIBOX_STAR_INCOGNITO : IDR_IOS_OMNIBOX_STAR;
15
16 switch (type) {
17 case AutocompleteMatchType::BOOKMARK_TITLE:
18 case AutocompleteMatchType::CLIPBOARD:
19 case AutocompleteMatchType::NAVSUGGEST:
20 case AutocompleteMatchType::NAVSUGGEST_PERSONALIZED:
21 case AutocompleteMatchType::PHYSICAL_WEB:
22 case AutocompleteMatchType::PHYSICAL_WEB_OVERFLOW:
23 case AutocompleteMatchType::URL_WHAT_YOU_TYPED:
24 return is_incognito ? IDR_IOS_OMNIBOX_HTTP_INCOGNITO
25 : IDR_IOS_OMNIBOX_HTTP;
26 case AutocompleteMatchType::HISTORY_BODY:
27 case AutocompleteMatchType::HISTORY_KEYWORD:
28 case AutocompleteMatchType::HISTORY_TITLE:
29 case AutocompleteMatchType::HISTORY_URL:
30 case AutocompleteMatchType::SEARCH_HISTORY:
31 return is_incognito ? IDR_IOS_OMNIBOX_HISTORY_INCOGNITO
32 : IDR_IOS_OMNIBOX_HISTORY;
33 case AutocompleteMatchType::CONTACT_DEPRECATED:
34 case AutocompleteMatchType::SEARCH_OTHER_ENGINE:
35 case AutocompleteMatchType::SEARCH_SUGGEST:
36 case AutocompleteMatchType::SEARCH_SUGGEST_ENTITY:
37 case AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED:
38 case AutocompleteMatchType::SEARCH_SUGGEST_PROFILE:
39 case AutocompleteMatchType::SEARCH_SUGGEST_TAIL:
40 case AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED:
41 case AutocompleteMatchType::VOICE_SUGGEST:
42 return is_incognito ? IDR_IOS_OMNIBOX_SEARCH_INCOGNITO
43 : IDR_IOS_OMNIBOX_SEARCH;
44 case AutocompleteMatchType::CALCULATOR:
45 case AutocompleteMatchType::EXTENSION_APP:
46 case AutocompleteMatchType::NUM_TYPES:
47 NOTREACHED();
48 return IDR_IOS_OMNIBOX_HTTP;
49 }
50 }
51
52 int GetIconForSecurityState(
53 security_state::SecurityStateModel::SecurityLevel security_level) {
54 switch (security_level) {
55 case security_state::SecurityStateModel::NONE:
56 case security_state::SecurityStateModel::HTTP_SHOW_WARNING:
57 return IDR_IOS_OMNIBOX_HTTP;
58 case security_state::SecurityStateModel::EV_SECURE:
59 case security_state::SecurityStateModel::SECURE:
60 return IDR_IOS_OMNIBOX_HTTPS_VALID;
61 case security_state::SecurityStateModel::SECURITY_WARNING:
62 // Surface Dubious as Neutral.
63 return IDR_IOS_OMNIBOX_HTTP;
64 case security_state::SecurityStateModel::SECURE_WITH_POLICY_INSTALLED_CERT:
65 return IDR_IOS_OMNIBOX_HTTPS_POLICY_WARNING;
66 case security_state::SecurityStateModel::DANGEROUS:
67 return IDR_IOS_OMNIBOX_HTTPS_INVALID;
68 }
69 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/omnibox/omnibox_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698