| 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 "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 297 |
| 298 void SearchBoxView::OnEnabledChanged() { | 298 void SearchBoxView::OnEnabledChanged() { |
| 299 search_box_->SetEnabled(enabled()); | 299 search_box_->SetEnabled(enabled()); |
| 300 if (speech_button_) | 300 if (speech_button_) |
| 301 speech_button_->SetEnabled(enabled()); | 301 speech_button_->SetEnabled(enabled()); |
| 302 } | 302 } |
| 303 | 303 |
| 304 void SearchBoxView::UpdateModel() { | 304 void SearchBoxView::UpdateModel() { |
| 305 // Temporarily remove from observer to ignore notifications caused by us. | 305 // Temporarily remove from observer to ignore notifications caused by us. |
| 306 model_->search_box()->RemoveObserver(this); | 306 model_->search_box()->RemoveObserver(this); |
| 307 model_->search_box()->SetText(search_box_->text()); | 307 model_->search_box()->Update(search_box_->text(), false); |
| 308 model_->search_box()->SetSelectionModel(search_box_->GetSelectionModel()); | 308 model_->search_box()->SetSelectionModel(search_box_->GetSelectionModel()); |
| 309 model_->search_box()->AddObserver(this); | 309 model_->search_box()->AddObserver(this); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void SearchBoxView::NotifyQueryChanged() { | 312 void SearchBoxView::NotifyQueryChanged() { |
| 313 DCHECK(delegate_); | 313 DCHECK(delegate_); |
| 314 delegate_->QueryChanged(this); | 314 delegate_->QueryChanged(this); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void SearchBoxView::ContentsChanged(views::Textfield* sender, | 317 void SearchBoxView::ContentsChanged(views::Textfield* sender, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 void SearchBoxView::HintTextChanged() { | 415 void SearchBoxView::HintTextChanged() { |
| 416 const app_list::SearchBoxModel* search_box = model_->search_box(); | 416 const app_list::SearchBoxModel* search_box = model_->search_box(); |
| 417 search_box_->set_placeholder_text(search_box->hint_text()); | 417 search_box_->set_placeholder_text(search_box->hint_text()); |
| 418 search_box_->SetAccessibleName(search_box->accessible_name()); | 418 search_box_->SetAccessibleName(search_box->accessible_name()); |
| 419 } | 419 } |
| 420 | 420 |
| 421 void SearchBoxView::SelectionModelChanged() { | 421 void SearchBoxView::SelectionModelChanged() { |
| 422 search_box_->SelectSelectionModel(model_->search_box()->selection_model()); | 422 search_box_->SelectSelectionModel(model_->search_box()->selection_model()); |
| 423 } | 423 } |
| 424 | 424 |
| 425 void SearchBoxView::TextChanged() { | 425 void SearchBoxView::Update() { |
| 426 search_box_->SetText(model_->search_box()->text()); | 426 search_box_->SetText(model_->search_box()->text()); |
| 427 NotifyQueryChanged(); | 427 NotifyQueryChanged(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 void SearchBoxView::OnSpeechRecognitionStateChanged( | 430 void SearchBoxView::OnSpeechRecognitionStateChanged( |
| 431 SpeechRecognitionState new_state) { | 431 SpeechRecognitionState new_state) { |
| 432 SpeechRecognitionButtonPropChanged(); | 432 SpeechRecognitionButtonPropChanged(); |
| 433 SchedulePaint(); | 433 SchedulePaint(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace app_list | 436 } // namespace app_list |
| OLD | NEW |