| OLD | NEW |
| 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 | 21 |
| 22 // On a search results page. | 22 // On a search results page. |
| 23 // TODO(treib): Remove this; it's not used anymore. crbug.com/627747 |
| 23 MODE_SEARCH_RESULTS, | 24 MODE_SEARCH_RESULTS, |
| 24 }; | 25 }; |
| 25 | 26 |
| 26 // The kind of page from which the user initiated the current search. | 27 // The kind of page from which the user initiated the current search. |
| 27 enum Origin { | 28 enum Origin { |
| 28 // The user is searching from some random page. | 29 // The user is searching from some random page. |
| 29 ORIGIN_DEFAULT = 0, | 30 ORIGIN_DEFAULT = 0, |
| 30 | 31 |
| 31 // The user is searching from the NTP. | 32 // The user is searching from the NTP. |
| 32 ORIGIN_NTP, | 33 ORIGIN_NTP, |
| 33 | 34 |
| 34 // The user is searching from a search results page. | 35 // The user is searching from a search results page. |
| 36 // TODO(treib): Remove this; it's not used anymore. crbug.com/627747 |
| 35 ORIGIN_SEARCH, | 37 ORIGIN_SEARCH, |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 SearchMode() : mode(MODE_DEFAULT), origin(ORIGIN_DEFAULT) { | 40 SearchMode() : mode(MODE_DEFAULT), origin(ORIGIN_DEFAULT) { |
| 39 } | 41 } |
| 40 | 42 |
| 41 SearchMode(Type in_mode, Origin in_origin) | 43 SearchMode(Type in_mode, Origin in_origin) |
| 42 : mode(in_mode), | 44 : mode(in_mode), |
| 43 origin(in_origin) { | 45 origin(in_origin) { |
| 44 } | 46 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 83 |
| 82 bool is_origin_ntp() const { | 84 bool is_origin_ntp() const { |
| 83 return origin == ORIGIN_NTP; | 85 return origin == ORIGIN_NTP; |
| 84 } | 86 } |
| 85 | 87 |
| 86 Type mode; | 88 Type mode; |
| 87 Origin origin; | 89 Origin origin; |
| 88 }; | 90 }; |
| 89 | 91 |
| 90 #endif // CHROME_COMMON_SEARCH_SEARCH_TYPES_H_ | 92 #endif // CHROME_COMMON_SEARCH_SEARCH_TYPES_H_ |
| OLD | NEW |