Correct blacklist entry message
[chromium-blink-merge.git] / ui / app_list / search_box_model.cc
blob5130e501cc882ccc2c252184490a0f260130da80
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 #include "ui/app_list/search_box_model.h"
7 #include "base/metrics/histogram.h"
8 #include "ui/app_list/search_box_model_observer.h"
10 namespace app_list {
12 SearchBoxModel::SearchBoxModel() {
15 SearchBoxModel::~SearchBoxModel() {
18 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) {
19 icon_ = icon;
20 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, IconChanged());
23 void SearchBoxModel::SetHintText(const base::string16& hint_text) {
24 if (hint_text_ == hint_text)
25 return;
27 hint_text_ = hint_text;
28 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, HintTextChanged());
31 void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) {
32 if (selection_model_ == sel)
33 return;
35 selection_model_ = sel;
36 FOR_EACH_OBSERVER(SearchBoxModelObserver,
37 observers_,
38 SelectionModelChanged());
41 void SearchBoxModel::SetText(const base::string16& text) {
42 if (text_ == text)
43 return;
45 // Log that a new search has been commenced whenever the text box text
46 // transitions from empty to non-empty.
47 if (text_.empty() && !text.empty()) {
48 UMA_HISTOGRAM_ENUMERATION("Apps.AppListSearchCommenced", 1, 2);
50 text_ = text;
51 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, TextChanged());
54 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) {
55 observers_.AddObserver(observer);
58 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) {
59 observers_.RemoveObserver(observer);
62 } // namespace app_list