| OLD | NEW |
| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 if (StatusTray* status_tray = g_browser_process->status_tray()) { | 84 if (StatusTray* status_tray = g_browser_process->status_tray()) { |
| 85 DCHECK(!tray_icon_); | 85 DCHECK(!tray_icon_); |
| 86 AddRef(); // Balanced in Hide(). | 86 AddRef(); // Balanced in Hide(). |
| 87 tray_icon_ = status_tray->CreateStatusIcon(); | 87 tray_icon_ = status_tray->CreateStatusIcon(); |
| 88 DCHECK(tray_icon_); | 88 DCHECK(tray_icon_); |
| 89 VLOG(1) << "Tray icon added."; | 89 VLOG(1) << "Tray icon added."; |
| 90 | 90 |
| 91 SetVUMeterVolume(0.0f); | 91 SetVUMeterVolume(0.0f); |
| 92 tray_icon_->SetToolTip(l10n_util::GetStringFUTF16( | 92 tray_icon_->SetToolTip(l10n_util::GetStringFUTF16( |
| 93 IDS_SPEECH_INPUT_TRAY_TOOLTIP, | 93 IDS_SPEECH_INPUT_TRAY_TOOLTIP, |
| 94 tooltip, | 94 tooltip)); |
| 95 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); | |
| 96 } else { | 95 } else { |
| 97 VLOG(1) << "This platform doesn't support notification icons."; | 96 VLOG(1) << "This platform doesn't support notification icons."; |
| 98 return; | 97 return; |
| 99 } | 98 } |
| 100 | 99 |
| 101 if (show_balloon) | 100 if (show_balloon) |
| 102 ShowNotificationBalloon(tooltip); | 101 ShowNotificationBalloon(tooltip); |
| 103 } | 102 } |
| 104 | 103 |
| 105 void SpeechRecognitionTrayIconController::Hide() { | 104 void SpeechRecognitionTrayIconController::Hide() { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 canvas->drawBitmap(*buffer_image_.get(), 0, 0); | 184 canvas->drawBitmap(*buffer_image_.get(), 0, 0); |
| 186 } | 185 } |
| 187 | 186 |
| 188 void SpeechRecognitionTrayIconController::ShowNotificationBalloon( | 187 void SpeechRecognitionTrayIconController::ShowNotificationBalloon( |
| 189 const string16& text) { | 188 const string16& text) { |
| 190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 191 string16 title = l10n_util::GetStringUTF16( | 190 string16 title = l10n_util::GetStringUTF16( |
| 192 IDS_SPEECH_INPUT_TRAY_BALLOON_TITLE); | 191 IDS_SPEECH_INPUT_TRAY_BALLOON_TITLE); |
| 193 string16 message = l10n_util::GetStringFUTF16( | 192 string16 message = l10n_util::GetStringFUTF16( |
| 194 IDS_SPEECH_INPUT_TRAY_BALLOON_BODY, | 193 IDS_SPEECH_INPUT_TRAY_BALLOON_BODY, |
| 195 text, | 194 text); |
| 196 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | |
| 197 | 195 |
| 198 tray_icon_->DisplayBalloon(*g_images.Get().balloon_icon(), title, message); | 196 tray_icon_->DisplayBalloon(*g_images.Get().balloon_icon(), title, message); |
| 199 } | 197 } |
| OLD | NEW |