| 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/search_box_view.h" | 5 #include "ui/app_list/search_box_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/app_list/search_box_model.h" | 9 #include "ui/app_list/search_box_model.h" |
| 10 #include "ui/app_list/search_box_view_delegate.h" | 10 #include "ui/app_list/search_box_view_delegate.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 const int kPreferredHeight = 48; | 22 const int kPreferredHeight = 48; |
| 23 const int kFontSize = 14; | 23 const int kFontSize = 14; |
| 24 | 24 |
| 25 const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0); | 25 const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0); |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate) | 29 SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate) |
| 30 : delegate_(delegate), | 30 : delegate_(delegate), |
| 31 model_(NULL), | 31 model_(NULL), |
| 32 icon_view_(NULL), | 32 icon_view_(new views::ImageView), |
| 33 search_box_(NULL), | 33 search_box_(new views::Textfield), |
| 34 contents_view_(NULL) { | 34 contents_view_(NULL) { |
| 35 icon_view_ = new views::ImageView; | |
| 36 AddChildView(icon_view_); | 35 AddChildView(icon_view_); |
| 37 | 36 |
| 38 search_box_ = new views::Textfield; | |
| 39 search_box_->RemoveBorder(); | 37 search_box_->RemoveBorder(); |
| 40 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 38 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 41 search_box_->SetFont(gfx::Font( | 39 search_box_->SetFont(gfx::Font( |
| 42 rb.GetFont(ResourceBundle::BaseFont).GetFontName(), | 40 rb.GetFont(ui::ResourceBundle::BaseFont).GetFontName(), |
| 43 kFontSize)); | 41 kFontSize)); |
| 44 search_box_->set_placeholder_text_color(kHintTextColor); | 42 search_box_->set_placeholder_text_color(kHintTextColor); |
| 45 search_box_->SetController(this); | 43 search_box_->SetController(this); |
| 46 AddChildView(search_box_); | 44 AddChildView(search_box_); |
| 47 } | 45 } |
| 48 | 46 |
| 49 SearchBoxView::~SearchBoxView() { | 47 SearchBoxView::~SearchBoxView() { |
| 50 if (model_) | 48 if (model_) |
| 51 model_->RemoveObserver(this); | 49 model_->RemoveObserver(this); |
| 52 } | 50 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 void SearchBoxView::SelectionModelChanged() { | 145 void SearchBoxView::SelectionModelChanged() { |
| 148 search_box_->SelectSelectionModel(model_->selection_model()); | 146 search_box_->SelectSelectionModel(model_->selection_model()); |
| 149 } | 147 } |
| 150 | 148 |
| 151 void SearchBoxView::TextChanged() { | 149 void SearchBoxView::TextChanged() { |
| 152 search_box_->SetText(model_->text()); | 150 search_box_->SetText(model_->text()); |
| 153 } | 151 } |
| 154 | 152 |
| 155 } // namespace app_list | 153 } // namespace app_list |
| 156 | 154 |
| OLD | NEW |