Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: ui/app_list/views/speech_view.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/app_list/views/speech_view.h ('k') | ui/app_list/views/start_page_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/app_list/views/speech_view.h ('k') | ui/app_list/views/start_page_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698