When Retrier succeeds, record errors it encountered.
[chromium-blink-merge.git] / ui / app_list / search_box_model.h
blob1df14291f289affcd9e48aa94c8c902bb6fbb131
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
3 // found in the LICENSE file.
5 #ifndef UI_APP_LIST_SEARCH_BOX_MODEL_H_
6 #define UI_APP_LIST_SEARCH_BOX_MODEL_H_
8 #include "base/basictypes.h"
9 #include "base/observer_list.h"
10 #include "base/string16.h"
11 #include "ui/app_list/app_list_export.h"
12 #include "ui/gfx/image/image_skia.h"
13 #include "ui/gfx/selection_model.h"
15 namespace app_list {
17 class SearchBoxModelObserver;
19 // SearchBoxModel consisits of an icon, a hint text, a user text and a selection
20 // model. The icon is rendered to the side of the query editor. The hint text
21 // is used as query edit control's placeholder text and displayed when there is
22 // no user text in the control. The selection model and the text represents the
23 // text, cursor position and selected text in edit control.
24 class APP_LIST_EXPORT SearchBoxModel {
25 public:
26 SearchBoxModel();
27 ~SearchBoxModel();
29 // Sets/gets the icon on side of edit box.
30 void SetIcon(const gfx::ImageSkia& icon);
31 const gfx::ImageSkia& icon() const { return icon_; }
33 // Sets/gets the hint text to display when there is in input.
34 void SetHintText(const string16& hint_text);
35 const string16& hint_text() const { return hint_text_; }
37 // Sets/gets the selection model for the search box's Textfield.
38 void SetSelectionModel(const gfx::SelectionModel& sel);
39 const gfx::SelectionModel& selection_model() const {
40 return selection_model_;
43 // Sets/gets the text for the search box's Textfield.
44 void SetText(const string16& text);
45 const string16& text() const { return text_; }
47 void AddObserver(SearchBoxModelObserver* observer);
48 void RemoveObserver(SearchBoxModelObserver* observer);
50 private:
51 gfx::ImageSkia icon_;
52 string16 hint_text_;
53 gfx::SelectionModel selection_model_;
54 string16 text_;
56 ObserverList<SearchBoxModelObserver> observers_;
58 DISALLOW_COPY_AND_ASSIGN(SearchBoxModel);
61 } // namespace app_list
63 #endif // UI_APP_LIST_SEARCH_BOX_MODEL_H_