| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #include "ui/app_list/search_box_model.h" |
| 6 |
| 7 #include "ui/app_list/search_box_model_observer.h" |
| 8 #include "ui/views/controls/textfield/textfield.h" |
| 9 |
| 10 namespace app_list { |
| 11 |
| 12 SearchBoxModel::SearchBoxModel() { |
| 13 } |
| 14 |
| 15 SearchBoxModel::~SearchBoxModel() { |
| 16 } |
| 17 |
| 18 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) { |
| 19 icon_ = icon; |
| 20 FOR_EACH_OBSERVER(SearchBoxModelObserver, |
| 21 observers_, |
| 22 IconChanged()); |
| 23 } |
| 24 |
| 25 void SearchBoxModel::SetHintText(const string16& hint_text) { |
| 26 if (hint_text_ == hint_text) |
| 27 return; |
| 28 |
| 29 hint_text_ = hint_text; |
| 30 FOR_EACH_OBSERVER(SearchBoxModelObserver, |
| 31 observers_, |
| 32 HintTextChanged()); |
| 33 } |
| 34 |
| 35 void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) { |
| 36 if (selection_model_ == sel) |
| 37 return; |
| 38 |
| 39 selection_model_ = sel; |
| 40 FOR_EACH_OBSERVER(SearchBoxModelObserver, |
| 41 observers_, |
| 42 SelectionModelChanged()); |
| 43 } |
| 44 |
| 45 void SearchBoxModel::SetText(const string16& text) { |
| 46 if (text_ == text) |
| 47 return; |
| 48 |
| 49 text_ = text; |
| 50 FOR_EACH_OBSERVER(SearchBoxModelObserver, |
| 51 observers_, |
| 52 TextChanged()); |
| 53 } |
| 54 |
| 55 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) { |
| 56 observers_.AddObserver(observer); |
| 57 } |
| 58 |
| 59 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) { |
| 60 observers_.RemoveObserver(observer); |
| 61 } |
| 62 |
| 63 } // namespace app_list |
| OLD | NEW |