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

Side by Side Diff: chrome/browser/speech/speech_input_extension_api.h

Issue 10068036: RefCounted types should not have public destructors, chrome/browser/ part 5 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix Created 8 years, 8 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
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 #ifndef CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_API_H_ 5 #ifndef CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_API_H_
6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_API_H_ 6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_API_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/extensions/extension_function.h" 9 #include "chrome/browser/extensions/extension_function.h"
10 #include "content/public/browser/notification_observer.h" 10 #include "content/public/browser/notification_observer.h"
11 11
12 // Handles asynchronous operations such as starting or stopping speech 12 // Handles asynchronous operations such as starting or stopping speech
13 // recognition in the framework of the extension API state machine. 13 // recognition in the framework of the extension API state machine.
14 class SpeechInputAsyncFunction : public AsyncExtensionFunction, 14 class SpeechInputAsyncFunction : public AsyncExtensionFunction,
15 public content::NotificationObserver { 15 public content::NotificationObserver {
16 public:
17 // content::NotificationObserver.
18 virtual void Observe(int type,
19 const content::NotificationSource& source,
20 const content::NotificationDetails& details) OVERRIDE;
21
16 protected: 22 protected:
17 SpeechInputAsyncFunction(int start_state, int transition_state, 23 SpeechInputAsyncFunction(int start_state, int transition_state,
18 int end_state, int transition_notification); 24 int end_state, int transition_notification);
19 virtual ~SpeechInputAsyncFunction(); 25 virtual ~SpeechInputAsyncFunction();
20 26
27 // ExtensionFunction:
21 virtual void Run() OVERRIDE; 28 virtual void Run() OVERRIDE;
22 virtual bool RunImpl() = 0; 29 virtual bool RunImpl() = 0;
23 30
24 private: 31 private:
25 // content::NotificationObserver.
26 virtual void Observe(int type,
27 const content::NotificationSource& source,
28 const content::NotificationDetails& details) OVERRIDE;
29
30 // To be defined on construction by derived classes. 32 // To be defined on construction by derived classes.
31 int start_state_; 33 int start_state_;
32 int transition_state_; 34 int transition_state_;
33 int end_state_; 35 int end_state_;
34 int transition_notification_; 36 int transition_notification_;
35 37
36 content::NotificationRegistrar registrar_; 38 content::NotificationRegistrar registrar_;
37 bool expecting_transition_; 39 bool expecting_transition_;
38 bool failed_; 40 bool failed_;
39 }; 41 };
40 42
41 // Implements experimental.speechInput.start. 43 // Implements experimental.speechInput.start.
42 class StartSpeechInputFunction : public SpeechInputAsyncFunction { 44 class StartSpeechInputFunction : public SpeechInputAsyncFunction {
43 public: 45 public:
46 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.start");
47
44 StartSpeechInputFunction(); 48 StartSpeechInputFunction();
45 virtual ~StartSpeechInputFunction() {}
46 49
47 protected: 50 protected:
51 // SpeechInputAsyncFunction:
48 virtual bool RunImpl() OVERRIDE; 52 virtual bool RunImpl() OVERRIDE;
49 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.start"); 53
54 private:
55 virtual ~StartSpeechInputFunction() {}
50 }; 56 };
51 57
52 // Implements experimental.speechInput.stop. 58 // Implements experimental.speechInput.stop.
53 class StopSpeechInputFunction : public SpeechInputAsyncFunction { 59 class StopSpeechInputFunction : public SpeechInputAsyncFunction {
54 public: 60 public:
61 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.stop");
62
55 StopSpeechInputFunction(); 63 StopSpeechInputFunction();
56 virtual ~StopSpeechInputFunction() {}
57 64
58 protected: 65 protected:
66 // SpeechInputAsyncFunction:
59 virtual bool RunImpl() OVERRIDE; 67 virtual bool RunImpl() OVERRIDE;
60 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.stop"); 68
69 private:
70 virtual ~StopSpeechInputFunction() {}
61 }; 71 };
62 72
63 // Implements experimental.speechInput.isRecording. 73 // Implements experimental.speechInput.isRecording.
64 class IsRecordingSpeechInputFunction : public SyncExtensionFunction { 74 class IsRecordingSpeechInputFunction : public SyncExtensionFunction {
65 public: 75 public:
76 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.isRecording");
77
66 // Called back from SpeechInputExtensionManager in the UI thread. 78 // Called back from SpeechInputExtensionManager in the UI thread.
67 void SetResult(bool result); 79 void SetResult(bool result);
68 80
69 protected: 81 protected:
82 // ExtensionFunction:
70 virtual void Run() OVERRIDE; 83 virtual void Run() OVERRIDE;
71 virtual bool RunImpl() OVERRIDE; 84 virtual bool RunImpl() OVERRIDE;
72 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.isRecording"); 85
86 private:
87 virtual ~IsRecordingSpeechInputFunction() {}
73 }; 88 };
74 89
75 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_API_H_ 90 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_test.cc ('k') | chrome/browser/speech/speech_input_extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698