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

Side by Side Diff: chrome/common/search/search_types.h

Issue 2269933002: Instant cleanup: remove MODE_SEARCH_RESULTS and ORIGIN_SEARCH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_url_replacement
Patch Set: rebase Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_COMMON_SEARCH_SEARCH_TYPES_H_ 5 #ifndef CHROME_COMMON_SEARCH_SEARCH_TYPES_H_
6 #define CHROME_COMMON_SEARCH_SEARCH_TYPES_H_ 6 #define CHROME_COMMON_SEARCH_SEARCH_TYPES_H_
7 7
8 // The Mode structure encodes the visual states encountered when interacting 8 // The Mode structure encodes the visual states encountered when interacting
9 // with the NTP and the Omnibox. 9 // with the NTP and the Omnibox.
10 struct SearchMode { 10 struct SearchMode {
11 // The visual state that applies to the current interaction. 11 // The visual state that applies to the current interaction.
12 enum Type { 12 enum Type {
13 // The default state means anything but the following states. 13 // The default state means anything but the following states.
14 MODE_DEFAULT, 14 MODE_DEFAULT,
15 15
16 // On the NTP page and the NTP is ready to be displayed. 16 // On the NTP page and the NTP is ready to be displayed.
17 MODE_NTP, 17 MODE_NTP,
18 18
19 // The Omnibox is modified in some way, either on the NTP or not. 19 // The Omnibox is modified in some way, either on the NTP or not.
20 MODE_SEARCH_SUGGESTIONS, 20 MODE_SEARCH_SUGGESTIONS,
21
22 // On a search results page.
23 // TODO(treib): Remove this; it's not used anymore. crbug.com/627747
24 MODE_SEARCH_RESULTS,
25 }; 21 };
26 22
27 // The kind of page from which the user initiated the current search. 23 // The kind of page from which the user initiated the current search.
28 enum Origin { 24 enum Origin {
29 // The user is searching from some random page. 25 // The user is searching from some random page.
30 ORIGIN_DEFAULT = 0, 26 ORIGIN_DEFAULT = 0,
31 27
32 // The user is searching from the NTP. 28 // The user is searching from the NTP.
33 ORIGIN_NTP, 29 ORIGIN_NTP,
34
35 // The user is searching from a search results page.
36 // TODO(treib): Remove this; it's not used anymore. crbug.com/627747
37 ORIGIN_SEARCH,
38 }; 30 };
39 31
40 SearchMode() : mode(MODE_DEFAULT), origin(ORIGIN_DEFAULT) { 32 SearchMode() : mode(MODE_DEFAULT), origin(ORIGIN_DEFAULT) {
41 } 33 }
42 34
43 SearchMode(Type in_mode, Origin in_origin) 35 SearchMode(Type in_mode, Origin in_origin)
44 : mode(in_mode), 36 : mode(in_mode),
45 origin(in_origin) { 37 origin(in_origin) {
46 } 38 }
47 39
48 bool operator==(const SearchMode& rhs) const { 40 bool operator==(const SearchMode& rhs) const {
49 return mode == rhs.mode && origin == rhs.origin; 41 return mode == rhs.mode && origin == rhs.origin;
50 } 42 }
51 43
52 bool operator!=(const SearchMode& rhs) const { 44 bool operator!=(const SearchMode& rhs) const {
53 return !(*this == rhs); 45 return !(*this == rhs);
54 } 46 }
55 47
56 bool is_default() const { 48 bool is_default() const {
Peter Kasting 2016/09/02 20:40:59 Nit: Suggestion for followup: Now that no remainin
Marc Treib 2016/09/05 12:11:16 I think we can get rid of Origin completely (ORIGI
57 return mode == MODE_DEFAULT; 49 return mode == MODE_DEFAULT;
58 } 50 }
59 51
60 bool is_ntp() const { 52 bool is_ntp() const {
61 return mode == MODE_NTP; 53 return mode == MODE_NTP;
62 } 54 }
63 55
64 bool is_search() const {
65 return mode == MODE_SEARCH_SUGGESTIONS || mode == MODE_SEARCH_RESULTS;
66 }
67
68 bool is_search_results() const {
69 return mode == MODE_SEARCH_RESULTS;
70 }
71
72 bool is_search_suggestions() const { 56 bool is_search_suggestions() const {
73 return mode == MODE_SEARCH_SUGGESTIONS; 57 return mode == MODE_SEARCH_SUGGESTIONS;
74 } 58 }
75 59
76 bool is_origin_default() const { 60 bool is_origin_default() const {
77 return origin == ORIGIN_DEFAULT; 61 return origin == ORIGIN_DEFAULT;
78 } 62 }
79 63
80 bool is_origin_search() const {
81 return origin == ORIGIN_SEARCH;
82 }
83
84 bool is_origin_ntp() const { 64 bool is_origin_ntp() const {
85 return origin == ORIGIN_NTP; 65 return origin == ORIGIN_NTP;
86 } 66 }
87 67
88 Type mode; 68 Type mode;
89 Origin origin; 69 Origin origin;
90 }; 70 };
91 71
92 #endif // CHROME_COMMON_SEARCH_SEARCH_TYPES_H_ 72 #endif // CHROME_COMMON_SEARCH_SEARCH_TYPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698