| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace | 110 } // namespace |
| 111 | 111 |
| 112 // static | 112 // static |
| 113 | 113 |
| 114 SpeechView::SpeechView(AppListViewDelegate* delegate) | 114 SpeechView::SpeechView(AppListViewDelegate* delegate) |
| 115 : delegate_(delegate), | 115 : delegate_(delegate), |
| 116 logo_(NULL) { | 116 logo_(NULL) { |
| 117 SetBorder(scoped_ptr<views::Border>( | 117 SetBorder(std::unique_ptr<views::Border>( |
| 118 new views::ShadowBorder(GetShadowForZHeight(1)))); | 118 new views::ShadowBorder(GetShadowForZHeight(1)))); |
| 119 | 119 |
| 120 // To keep the painting order of the border and the background, this class | 120 // To keep the painting order of the border and the background, this class |
| 121 // actually has a single child of 'container' which has white background and | 121 // actually has a single child of 'container' which has white background and |
| 122 // contains all components. | 122 // contains all components. |
| 123 views::View* container = new views::View(); | 123 views::View* container = new views::View(); |
| 124 container->set_background( | 124 container->set_background( |
| 125 views::Background::CreateSolidBackground(SK_ColorWHITE)); | 125 views::Background::CreateSolidBackground(SK_ColorWHITE)); |
| 126 | 126 |
| 127 const gfx::ImageSkia& logo_image = delegate_->GetSpeechUI()->logo(); | 127 const gfx::ImageSkia& logo_image = delegate_->GetSpeechUI()->logo(); |
| 128 if (!logo_image.isNull()) { | 128 if (!logo_image.isNull()) { |
| 129 logo_ = new views::ImageView(); | 129 logo_ = new views::ImageView(); |
| 130 logo_->SetImage(&logo_image); | 130 logo_->SetImage(&logo_image); |
| 131 container->AddChildView(logo_); | 131 container->AddChildView(logo_); |
| 132 } | 132 } |
| 133 | 133 |
| 134 indicator_ = new SoundLevelIndicator(); | 134 indicator_ = new SoundLevelIndicator(); |
| 135 indicator_->SetVisible(false); | 135 indicator_->SetVisible(false); |
| 136 container->AddChildView(indicator_); | 136 container->AddChildView(indicator_); |
| 137 | 137 |
| 138 MicButton* mic_button = new MicButton(this); | 138 MicButton* mic_button = new MicButton(this); |
| 139 mic_button_ = mic_button; | 139 mic_button_ = mic_button; |
| 140 container->AddChildView(mic_button_); | 140 container->AddChildView(mic_button_); |
| 141 mic_button_->SetEventTargeter( | 141 mic_button_->SetEventTargeter(std::unique_ptr<views::ViewTargeter>( |
| 142 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(mic_button))); | 142 new views::ViewTargeter(mic_button))); |
| 143 | 143 |
| 144 // TODO(mukai): use BoundedLabel to cap 2 lines. | 144 // TODO(mukai): use BoundedLabel to cap 2 lines. |
| 145 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 145 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 146 speech_result_ = new views::Label( | 146 speech_result_ = new views::Label( |
| 147 base::string16(), bundle.GetFontList(ui::ResourceBundle::LargeFont)); | 147 base::string16(), bundle.GetFontList(ui::ResourceBundle::LargeFont)); |
| 148 speech_result_->SetMultiLine(true); | 148 speech_result_->SetMultiLine(true); |
| 149 speech_result_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 149 speech_result_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 150 | 150 |
| 151 container->AddChildView(speech_result_); | 151 container->AddChildView(speech_result_); |
| 152 | 152 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id)); | 247 speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id)); |
| 248 speech_result_->SetEnabledColor(kHintTextColor); | 248 speech_result_->SetEnabledColor(kHintTextColor); |
| 249 | 249 |
| 250 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 250 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 251 mic_button_->SetImage(views::Button::STATE_NORMAL, | 251 mic_button_->SetImage(views::Button::STATE_NORMAL, |
| 252 bundle.GetImageSkiaNamed(resource_id)); | 252 bundle.GetImageSkiaNamed(resource_id)); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace app_list | 255 } // namespace app_list |
| OLD | NEW |