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

Unified Diff: chrome/browser/ui/search/search_types.h

Issue 10644002: Add core plumbing for Instant Extended work (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed UI stuff from SearchModel Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/search/search_types.h
diff --git a/chrome/browser/ui/search/search_types.h b/chrome/browser/ui/search/search_types.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f9c1a67c26294033d48770e54e1f161d5bef835
--- /dev/null
+++ b/chrome/browser/ui/search/search_types.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_TYPES_H_
+#define CHROME_BROWSER_UI_SEARCH_SEARCH_TYPES_H_
+#pragma once
+
+namespace chrome {
+namespace search {
+
+// The Mode structure encodes the visual states encountered when interacting
+// with the NTP and the Omnibox. State changes can be animated depending on the
+// context.
+struct Mode {
+ enum Type {
+ // The default state means anything but the following states.
+ MODE_DEFAULT,
+
+ // On the NTP page but the NTP isn't in a state that we should show it.
+ MODE_NTP_LOADING,
+
+ // On the NTP page and the NTP is ready to be displayed.
+ MODE_NTP,
+
+ // Any of the following:
+ // . on the NTP page and the Omnibox is modified in some way.
+ // . on a search results page.
+ // . the Omnibox has focus.
+ MODE_SEARCH,
+ };
+
+ Mode() : mode(MODE_DEFAULT), animate(false) {
+ }
+
+ Mode(Type in_mode, bool in_animate) : mode(in_mode), animate(in_animate) {
+ }
+
+ bool operator==(const Mode& rhs) const {
+ return mode == rhs.mode;
+ // |animate| is transient. It doesn't count.
+ }
+
+ bool is_default() const {
+ return mode == MODE_DEFAULT;
+ }
+
+ bool is_ntp() const {
+ return mode == MODE_NTP || mode == MODE_NTP_LOADING;
+ }
+
+ bool is_search() const {
+ return mode == MODE_SEARCH;
+ }
+
+ Type mode;
+
+ // Mode changes can be animated. This is transient state, once a call to
+ // |SearchModel::SetMode| has completed and its observers notified |animate|
+ // is set to |false|.
+ bool animate;
+};
+
+} // namespace search
+} // namespace chrome
+
+#endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TYPES_H_

Powered by Google App Engine
This is Rietveld 408576698