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 "ui/app_list/app_list_constants.h" | 9 #include "ui/app_list/app_list_constants.h" |
10 #include "ui/app_list/app_list_model.h" | 10 #include "ui/app_list/app_list_model.h" |
11 #include "ui/app_list/app_list_switches.h" | 11 #include "ui/app_list/app_list_switches.h" |
12 #include "ui/app_list/app_list_view_delegate.h" | 12 #include "ui/app_list/app_list_view_delegate.h" |
13 #include "ui/app_list/search_box_model.h" | 13 #include "ui/app_list/search_box_model.h" |
14 #include "ui/app_list/speech_ui_model.h" | 14 #include "ui/app_list/speech_ui_model.h" |
15 #include "ui/app_list/views/app_list_menu_views.h" | 15 #include "ui/app_list/views/app_list_menu_views.h" |
16 #include "ui/app_list/views/search_box_view_delegate.h" | 16 #include "ui/app_list/views/search_box_view_delegate.h" |
17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/events/event.h" | 18 #include "ui/events/event.h" |
19 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
| 20 #include "ui/gfx/shadow_value.h" |
20 #include "ui/resources/grit/ui_resources.h" | 21 #include "ui/resources/grit/ui_resources.h" |
21 #include "ui/views/border.h" | 22 #include "ui/views/border.h" |
22 #include "ui/views/controls/button/image_button.h" | 23 #include "ui/views/controls/button/image_button.h" |
23 #include "ui/views/controls/button/menu_button.h" | 24 #include "ui/views/controls/button/menu_button.h" |
24 #include "ui/views/controls/image_view.h" | 25 #include "ui/views/controls/image_view.h" |
25 #include "ui/views/controls/textfield/textfield.h" | 26 #include "ui/views/controls/textfield/textfield.h" |
26 #include "ui/views/layout/box_layout.h" | 27 #include "ui/views/layout/box_layout.h" |
27 #include "ui/views/layout/fill_layout.h" | 28 #include "ui/views/layout/fill_layout.h" |
28 #include "ui/views/shadow_border.h" | 29 #include "ui/views/shadow_border.h" |
29 | 30 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 icon_view_(NULL), | 79 icon_view_(NULL), |
79 back_button_(NULL), | 80 back_button_(NULL), |
80 speech_button_(NULL), | 81 speech_button_(NULL), |
81 menu_button_(NULL), | 82 menu_button_(NULL), |
82 search_box_(new views::Textfield), | 83 search_box_(new views::Textfield), |
83 contents_view_(NULL) { | 84 contents_view_(NULL) { |
84 SetLayoutManager(new views::FillLayout); | 85 SetLayoutManager(new views::FillLayout); |
85 AddChildView(content_container_); | 86 AddChildView(content_container_); |
86 | 87 |
87 if (switches::IsExperimentalAppListEnabled()) { | 88 if (switches::IsExperimentalAppListEnabled()) { |
88 SetBorder(make_scoped_ptr( | 89 SetBorder(make_scoped_ptr(new views::ShadowBorder(gfx::ShadowValue( |
89 new views::ShadowBorder(kShadowBlur, kShadowColor, kShadowYOffset, 0))); | 90 gfx::Point(0, kShadowYOffset), kShadowBlur, kShadowColor)))); |
90 back_button_ = new views::ImageButton(this); | 91 back_button_ = new views::ImageButton(this); |
91 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 92 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
92 back_button_->SetImage( | 93 back_button_->SetImage( |
93 views::ImageButton::STATE_NORMAL, | 94 views::ImageButton::STATE_NORMAL, |
94 rb.GetImageSkiaNamed(IDR_APP_LIST_FOLDER_BACK_NORMAL)); | 95 rb.GetImageSkiaNamed(IDR_APP_LIST_FOLDER_BACK_NORMAL)); |
95 back_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 96 back_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
96 views::ImageButton::ALIGN_MIDDLE); | 97 views::ImageButton::ALIGN_MIDDLE); |
97 content_container_->AddChildView(back_button_); | 98 content_container_->AddChildView(back_button_); |
98 | 99 |
99 content_container_->set_background(new ExperimentalSearchBoxBackground()); | 100 content_container_->set_background(new ExperimentalSearchBoxBackground()); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 NotifyQueryChanged(); | 298 NotifyQueryChanged(); |
298 } | 299 } |
299 | 300 |
300 void SearchBoxView::OnSpeechRecognitionStateChanged( | 301 void SearchBoxView::OnSpeechRecognitionStateChanged( |
301 SpeechRecognitionState new_state) { | 302 SpeechRecognitionState new_state) { |
302 SpeechRecognitionButtonPropChanged(); | 303 SpeechRecognitionButtonPropChanged(); |
303 SchedulePaint(); | 304 SchedulePaint(); |
304 } | 305 } |
305 | 306 |
306 } // namespace app_list | 307 } // namespace app_list |
OLD | NEW |