summaryrefslogtreecommitdiffstats
path: root/chrome/browser/speech/speech_recognition_tray_icon_controller.h
blob: a73d9818f7c704bf8f4bee024eb857d8b4ffb80a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_TRAY_ICON_CONTROLLER_H_
#define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_TRAY_ICON_CONTROLLER_H_
#pragma once

#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"

class Extension;
class SkBitmap;
class SkCanvas;
class StatusIcon;

namespace gfx {
class ImageSkia;
}

// Manages the tray icon for speech recognition.
class SpeechRecognitionTrayIconController
     : public base::RefCountedThreadSafe<SpeechRecognitionTrayIconController> {
 public:
  SpeechRecognitionTrayIconController();

  void Show(const string16& tooltip, bool show_balloon);
  void Hide();
  void SetVUMeterVolume(float volume);

 private:
  friend class base::RefCountedThreadSafe<SpeechRecognitionTrayIconController>;
  virtual ~SpeechRecognitionTrayIconController();

  void Initialize();
  void DrawVolume(SkCanvas* canvas, const gfx::ImageSkia& image, float volume);
  void ShowNotificationBalloon(const string16& text);

  scoped_ptr<SkBitmap> mic_image_;
  scoped_ptr<SkBitmap> buffer_image_;
  StatusIcon* tray_icon_;
};

#endif  // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_TRAY_ICON_CONTROLLER_H_