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

Unified Diff: ui/app_list/search_box_model.h

Issue 10386224: app_list: Add search box and search result view for v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_aura Created 8 years, 7 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: ui/app_list/search_box_model.h
diff --git a/ui/app_list/search_box_model.h b/ui/app_list/search_box_model.h
new file mode 100644
index 0000000000000000000000000000000000000000..9cf98764519c743f1a5972a4ffc86bf29b11eecf
--- /dev/null
+++ b/ui/app_list/search_box_model.h
@@ -0,0 +1,75 @@
+// 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 UI_APP_LIST_SEARCH_BOX_MODEL_H_
+#define UI_APP_LIST_SEARCH_BOX_MODEL_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/observer_list.h"
+#include "base/string16.h"
+#include "ui/app_list/app_list_export.h"
+#include "ui/gfx/image/image_skia.h"
+#include "ui/gfx/selection_model.h"
+
+namespace app_list {
+
+class SearchBoxModelObserver;
+
+// SearchBoxModel consisits of an icon, a hint text, a user text and a selection
+// model. The icon is rendered to the side of the query editor. The hint text
+// is used as query edit control's placeholder text and displayed when there is
+// no user text in the control. The selection model and the text represents the
+// text, cursor position and selected text in edit control.
+class APP_LIST_EXPORT SearchBoxModel {
+ public:
+ SearchBoxModel();
+ ~SearchBoxModel();
+
+ // Sets the icon on side of edit box.
+ void SetIcon(const gfx::ImageSkia& icon);
+
+ // Sets the hint text to display when there is in input.
+ void SetHintText(const string16& hint_text);
+
+ // Sets the selection model for the search box's Textfield.
+ void SetSelectionModel(const gfx::SelectionModel& sel);
+
+ // Sets the text for the search box's Textfield.
+ void SetText(const string16& text);
+
+ void AddObserver(SearchBoxModelObserver* observer);
+ void RemoveObserver(SearchBoxModelObserver* observer);
+
+ const gfx::ImageSkia& icon() const {
+ return icon_;
+ }
+
+ const string16& hint_text() const {
+ return hint_text_;
+ }
+
+ const gfx::SelectionModel& selection_model() const {
+ return selection_model_;
+ }
+
+ const string16& text() const {
+ return text_;
+ }
+
+ private:
+ gfx::ImageSkia icon_;
+ string16 hint_text_;
+
+ gfx::SelectionModel selection_model_;
+ string16 text_;
+
+ ObserverList<SearchBoxModelObserver> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(SearchBoxModel);
+};
+
+} // namespace app_list
+
+#endif // UI_APP_LIST_SEARCH_BOX_MODEL_H_

Powered by Google App Engine
This is Rietveld 408576698