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

Side by Side Diff: ui/app_list/search_box_model.cc

Issue 10638018: app_list: Initialize more views in the initializer list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/app_list/pagination_model.cc ('k') | ui/app_list/search_box_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ui/app_list/search_box_model.h" 5 #include "ui/app_list/search_box_model.h"
6 6
7 #include "ui/app_list/search_box_model_observer.h" 7 #include "ui/app_list/search_box_model_observer.h"
8 #include "ui/views/controls/textfield/textfield.h"
9 8
10 namespace app_list { 9 namespace app_list {
11 10
12 SearchBoxModel::SearchBoxModel() { 11 SearchBoxModel::SearchBoxModel() {
13 } 12 }
14 13
15 SearchBoxModel::~SearchBoxModel() { 14 SearchBoxModel::~SearchBoxModel() {
16 } 15 }
17 16
18 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) { 17 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) {
19 icon_ = icon; 18 icon_ = icon;
20 FOR_EACH_OBSERVER(SearchBoxModelObserver, 19 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, IconChanged());
21 observers_,
22 IconChanged());
23 } 20 }
24 21
25 void SearchBoxModel::SetHintText(const string16& hint_text) { 22 void SearchBoxModel::SetHintText(const string16& hint_text) {
26 if (hint_text_ == hint_text) 23 if (hint_text_ == hint_text)
27 return; 24 return;
28 25
29 hint_text_ = hint_text; 26 hint_text_ = hint_text;
30 FOR_EACH_OBSERVER(SearchBoxModelObserver, 27 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, HintTextChanged());
31 observers_,
32 HintTextChanged());
33 } 28 }
34 29
35 void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) { 30 void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) {
36 if (selection_model_ == sel) 31 if (selection_model_ == sel)
37 return; 32 return;
38 33
39 selection_model_ = sel; 34 selection_model_ = sel;
40 FOR_EACH_OBSERVER(SearchBoxModelObserver, 35 FOR_EACH_OBSERVER(SearchBoxModelObserver,
41 observers_, 36 observers_,
42 SelectionModelChanged()); 37 SelectionModelChanged());
43 } 38 }
44 39
45 void SearchBoxModel::SetText(const string16& text) { 40 void SearchBoxModel::SetText(const string16& text) {
46 if (text_ == text) 41 if (text_ == text)
47 return; 42 return;
48 43
49 text_ = text; 44 text_ = text;
50 FOR_EACH_OBSERVER(SearchBoxModelObserver, 45 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, TextChanged());
51 observers_,
52 TextChanged());
53 } 46 }
54 47
55 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) { 48 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) {
56 observers_.AddObserver(observer); 49 observers_.AddObserver(observer);
57 } 50 }
58 51
59 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) { 52 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) {
60 observers_.RemoveObserver(observer); 53 observers_.RemoveObserver(observer);
61 } 54 }
62 55
63 } // namespace app_list 56 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/pagination_model.cc ('k') | ui/app_list/search_box_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698