| OLD | NEW |
| 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/views/search_box_view.h" | 5 #include "ui/app_list/views/search_box_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
| 10 #include "ui/app_list/app_list_model.h" | 10 #include "ui/app_list/app_list_model.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 AddChildView(menu_button_); | 65 AddChildView(menu_button_); |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 search_box_->RemoveBorder(); | 68 search_box_->RemoveBorder(); |
| 69 search_box_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); | 69 search_box_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); |
| 70 search_box_->set_placeholder_text_color(kHintTextColor); | 70 search_box_->set_placeholder_text_color(kHintTextColor); |
| 71 search_box_->SetController(this); | 71 search_box_->SetController(this); |
| 72 AddChildView(search_box_); | 72 AddChildView(search_box_); |
| 73 | 73 |
| 74 model_->search_box()->AddObserver(this); | 74 model_->search_box()->AddObserver(this); |
| 75 view_delegate_->AddObserver(this); |
| 76 |
| 75 IconChanged(); | 77 IconChanged(); |
| 76 SpeechRecognitionButtonPropChanged(); | 78 SpeechRecognitionButtonPropChanged(); |
| 77 HintTextChanged(); | 79 HintTextChanged(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 SearchBoxView::~SearchBoxView() { | 82 SearchBoxView::~SearchBoxView() { |
| 81 model_->search_box()->RemoveObserver(this); | 83 model_->search_box()->RemoveObserver(this); |
| 84 view_delegate_->RemoveObserver(this); |
| 82 } | 85 } |
| 83 | 86 |
| 84 bool SearchBoxView::HasSearch() const { | 87 bool SearchBoxView::HasSearch() const { |
| 85 return !search_box_->text().empty(); | 88 return !search_box_->text().empty(); |
| 86 } | 89 } |
| 87 | 90 |
| 88 void SearchBoxView::ClearSearch() { | 91 void SearchBoxView::ClearSearch() { |
| 89 search_box_->SetText(base::string16()); | 92 search_box_->SetText(base::string16()); |
| 90 // Updates model and fires query changed manually because SetText() above | 93 // Updates model and fires query changed manually because SetText() above |
| 91 // does not generate ContentsChanged() notification. | 94 // does not generate ContentsChanged() notification. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 237 |
| 235 void SearchBoxView::SelectionModelChanged() { | 238 void SearchBoxView::SelectionModelChanged() { |
| 236 search_box_->SelectSelectionModel(model_->search_box()->selection_model()); | 239 search_box_->SelectSelectionModel(model_->search_box()->selection_model()); |
| 237 } | 240 } |
| 238 | 241 |
| 239 void SearchBoxView::TextChanged() { | 242 void SearchBoxView::TextChanged() { |
| 240 search_box_->SetText(model_->search_box()->text()); | 243 search_box_->SetText(model_->search_box()->text()); |
| 241 NotifyQueryChanged(); | 244 NotifyQueryChanged(); |
| 242 } | 245 } |
| 243 | 246 |
| 247 void SearchBoxView::OnUsersChanged() { |
| 248 InvalidateMenu(); |
| 249 } |
| 250 |
| 244 } // namespace app_list | 251 } // namespace app_list |
| OLD | NEW |