OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/speech_view.h" | 5 #include "ui/app_list/views/speech_view.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
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_view_delegate.h" | 11 #include "ui/app_list/app_list_view_delegate.h" |
12 #include "ui/app_list/speech_ui_model.h" | 12 #include "ui/app_list/speech_ui_model.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/path.h" | 16 #include "ui/gfx/path.h" |
| 17 #include "ui/gfx/shadow_value.h" |
17 #include "ui/resources/grit/ui_resources.h" | 18 #include "ui/resources/grit/ui_resources.h" |
18 #include "ui/strings/grit/ui_strings.h" | 19 #include "ui/strings/grit/ui_strings.h" |
19 #include "ui/views/animation/bounds_animator.h" | 20 #include "ui/views/animation/bounds_animator.h" |
20 #include "ui/views/background.h" | 21 #include "ui/views/background.h" |
21 #include "ui/views/controls/button/image_button.h" | 22 #include "ui/views/controls/button/image_button.h" |
22 #include "ui/views/controls/image_view.h" | 23 #include "ui/views/controls/image_view.h" |
23 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
24 #include "ui/views/layout/fill_layout.h" | 25 #include "ui/views/layout/fill_layout.h" |
25 #include "ui/views/masked_targeter_delegate.h" | 26 #include "ui/views/masked_targeter_delegate.h" |
26 #include "ui/views/shadow_border.h" | 27 #include "ui/views/shadow_border.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return true; | 102 return true; |
102 } | 103 } |
103 | 104 |
104 } // namespace | 105 } // namespace |
105 | 106 |
106 // static | 107 // static |
107 | 108 |
108 SpeechView::SpeechView(AppListViewDelegate* delegate) | 109 SpeechView::SpeechView(AppListViewDelegate* delegate) |
109 : delegate_(delegate), | 110 : delegate_(delegate), |
110 logo_(NULL) { | 111 logo_(NULL) { |
111 SetBorder(scoped_ptr<views::Border>( | 112 SetBorder(scoped_ptr<views::Border>(new views::ShadowBorder(gfx::ShadowValue( |
112 new views::ShadowBorder(kCardShadowBlur, kCardShadowColor, | 113 gfx::Point(0, kCardShadowYOffset), kCardShadowBlur, kCardShadowColor)))); |
113 kCardShadowYOffset, // Vertical offset. | |
114 0))); | |
115 | 114 |
116 // To keep the painting order of the border and the background, this class | 115 // To keep the painting order of the border and the background, this class |
117 // actually has a single child of 'container' which has white background and | 116 // actually has a single child of 'container' which has white background and |
118 // contains all components. | 117 // contains all components. |
119 views::View* container = new views::View(); | 118 views::View* container = new views::View(); |
120 container->set_background( | 119 container->set_background( |
121 views::Background::CreateSolidBackground(SK_ColorWHITE)); | 120 views::Background::CreateSolidBackground(SK_ColorWHITE)); |
122 | 121 |
123 const gfx::ImageSkia& logo_image = delegate_->GetSpeechUI()->logo(); | 122 const gfx::ImageSkia& logo_image = delegate_->GetSpeechUI()->logo(); |
124 if (!logo_image.isNull()) { | 123 if (!logo_image.isNull()) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 241 } |
243 speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id)); | 242 speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id)); |
244 speech_result_->SetEnabledColor(kHintTextColor); | 243 speech_result_->SetEnabledColor(kHintTextColor); |
245 | 244 |
246 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 245 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
247 mic_button_->SetImage(views::Button::STATE_NORMAL, | 246 mic_button_->SetImage(views::Button::STATE_NORMAL, |
248 bundle.GetImageSkiaNamed(resource_id)); | 247 bundle.GetImageSkiaNamed(resource_id)); |
249 } | 248 } |
250 | 249 |
251 } // namespace app_list | 250 } // namespace app_list |
OLD | NEW |