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 "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "third_party/skia/include/core/SkPath.h" | 10 #include "third_party/skia/include/core/SkPath.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 int speech_width = contents_bounds.width() - kTextMargin * 2; | 196 int speech_width = contents_bounds.width() - kTextMargin * 2; |
197 speech_result_->SizeToFit(speech_width); | 197 speech_result_->SizeToFit(speech_width); |
198 int speech_height = speech_result_->GetHeightForWidth(speech_width); | 198 int speech_height = speech_result_->GetHeightForWidth(speech_width); |
199 speech_result_->SetBounds( | 199 speech_result_->SetBounds( |
200 contents_bounds.x() + kTextMargin, | 200 contents_bounds.x() + kTextMargin, |
201 contents_bounds.bottom() - kTextMargin - speech_height, | 201 contents_bounds.bottom() - kTextMargin - speech_height, |
202 speech_width, | 202 speech_width, |
203 speech_height); | 203 speech_height); |
204 } | 204 } |
205 | 205 |
206 gfx::Size SpeechView::GetPreferredSize() { | 206 gfx::Size SpeechView::GetPreferredSize() const { |
207 return gfx::Size(0, kSpeechViewMaxHeight); | 207 return gfx::Size(0, kSpeechViewMaxHeight); |
208 } | 208 } |
209 | 209 |
210 void SpeechView::ButtonPressed(views::Button* sender, const ui::Event& event) { | 210 void SpeechView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
211 delegate_->ToggleSpeechRecognition(); | 211 delegate_->ToggleSpeechRecognition(); |
212 } | 212 } |
213 | 213 |
214 void SpeechView::OnSpeechSoundLevelChanged(uint8 level) { | 214 void SpeechView::OnSpeechSoundLevelChanged(uint8 level) { |
215 if (!visible()) | 215 if (!visible()) |
216 return; | 216 return; |
(...skipping 24 matching lines...) Expand all Loading... |
241 resource_id = IDR_APP_LIST_SPEECH_MIC_ON; | 241 resource_id = IDR_APP_LIST_SPEECH_MIC_ON; |
242 else if (new_state == SPEECH_RECOGNITION_IN_SPEECH) | 242 else if (new_state == SPEECH_RECOGNITION_IN_SPEECH) |
243 resource_id = IDR_APP_LIST_SPEECH_MIC_RECORDING; | 243 resource_id = IDR_APP_LIST_SPEECH_MIC_RECORDING; |
244 | 244 |
245 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 245 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
246 mic_button_->SetImage(views::Button::STATE_NORMAL, | 246 mic_button_->SetImage(views::Button::STATE_NORMAL, |
247 bundle.GetImageSkiaNamed(resource_id)); | 247 bundle.GetImageSkiaNamed(resource_id)); |
248 } | 248 } |
249 | 249 |
250 } // namespace app_list | 250 } // namespace app_list |
OLD | NEW |