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

Side by Side Diff: chrome/browser/speech/speech_recognition_tray_icon_controller.cc

Issue 10827371: status tray: Use explicit conversion from ImageSkia to SkBitmap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « chrome/browser/media/media_stream_capture_indicator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/speech/speech_recognition_tray_icon_controller.h" 5 #include "chrome/browser/speech/speech_recognition_tray_icon_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
132 if (!tray_icon_) 132 if (!tray_icon_)
133 return; 133 return;
134 134
135 mic_image_->eraseARGB(0, 0, 0, 0); 135 mic_image_->eraseARGB(0, 0, 0, 0);
136 SkCanvas canvas(*mic_image_); 136 SkCanvas canvas(*mic_image_);
137 137
138 // Draw the empty volume image first and the current volume image on top. 138 // Draw the empty volume image first and the current volume image on top.
139 canvas.drawBitmap(*g_images.Get().mic_empty(), 0, 0); 139 canvas.drawBitmap(*g_images.Get().mic_empty()->bitmap(), 0, 0);
140 DrawVolume(&canvas, *g_images.Get().mic_full(), volume); 140 DrawVolume(&canvas, *g_images.Get().mic_full(), volume);
141 141
142 tray_icon_->SetImage(*mic_image_.get()); 142 tray_icon_->SetImage(*mic_image_.get());
143 } 143 }
144 144
145 void SpeechRecognitionTrayIconController::Initialize() { 145 void SpeechRecognitionTrayIconController::Initialize() {
146 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 146 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
147 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 147 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
148 base::Bind(&SpeechRecognitionTrayIconController::Initialize, this)); 148 base::Bind(&SpeechRecognitionTrayIconController::Initialize, this));
149 return; 149 return;
(...skipping 22 matching lines...) Expand all
172 172
173 int width = mic_image_->width(); 173 int width = mic_image_->width();
174 int height = mic_image_->height(); 174 int height = mic_image_->height();
175 SkCanvas buffer_canvas(*buffer_image_); 175 SkCanvas buffer_canvas(*buffer_image_);
176 176
177 SkScalar clip_top = 177 SkScalar clip_top =
178 (((1.0f - volume) * (height * (kVolumeSteps + 1))) - height) / 178 (((1.0f - volume) * (height * (kVolumeSteps + 1))) - height) /
179 kVolumeSteps; 179 kVolumeSteps;
180 buffer_canvas.clipRect(SkRect::MakeLTRB(0, clip_top, 180 buffer_canvas.clipRect(SkRect::MakeLTRB(0, clip_top,
181 SkIntToScalar(width), SkIntToScalar(height))); 181 SkIntToScalar(width), SkIntToScalar(height)));
182 buffer_canvas.drawBitmap(image, 0, 0); 182 buffer_canvas.drawBitmap(*image.bitmap(), 0, 0);
183 183
184 canvas->drawBitmap(*buffer_image_.get(), 0, 0); 184 canvas->drawBitmap(*buffer_image_.get(), 0, 0);
185 } 185 }
186 186
187 void SpeechRecognitionTrayIconController::ShowNotificationBalloon( 187 void SpeechRecognitionTrayIconController::ShowNotificationBalloon(
188 const string16& text) { 188 const string16& text) {
189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
190 string16 title = l10n_util::GetStringUTF16( 190 string16 title = l10n_util::GetStringUTF16(
191 IDS_SPEECH_INPUT_TRAY_BALLOON_TITLE); 191 IDS_SPEECH_INPUT_TRAY_BALLOON_TITLE);
192 string16 message = l10n_util::GetStringFUTF16( 192 string16 message = l10n_util::GetStringFUTF16(
193 IDS_SPEECH_INPUT_TRAY_BALLOON_BODY, 193 IDS_SPEECH_INPUT_TRAY_BALLOON_BODY,
194 text); 194 text);
195 195
196 tray_icon_->DisplayBalloon(*g_images.Get().balloon_icon(), title, message); 196 tray_icon_->DisplayBalloon(*g_images.Get().balloon_icon()->bitmap(), title,
197 message);
197 } 198 }
OLDNEW
« no previous file with comments | « chrome/browser/media/media_stream_capture_indicator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698