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

Side by Side Diff: chrome/browser/extensions/extension_tts_api_controller.h

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 15
16 class DictionaryValue;
17 class Extension; 16 class Extension;
18 class ExtensionTtsPlatformImpl; 17 class ExtensionTtsPlatformImpl;
18 class Profile;
19
20 namespace base {
21 class DictionaryValue;
19 class ListValue; 22 class ListValue;
20 class Profile;
21 class Value; 23 class Value;
22 24 }
23 25
24 // Events sent back from the TTS engine indicating the progress. 26 // Events sent back from the TTS engine indicating the progress.
25 enum TtsEventType { 27 enum TtsEventType {
26 TTS_EVENT_START, 28 TTS_EVENT_START,
27 TTS_EVENT_END, 29 TTS_EVENT_END,
28 TTS_EVENT_WORD, 30 TTS_EVENT_WORD,
29 TTS_EVENT_SENTENCE, 31 TTS_EVENT_SENTENCE,
30 TTS_EVENT_MARKER, 32 TTS_EVENT_MARKER,
31 TTS_EVENT_INTERRUPTED, 33 TTS_EVENT_INTERRUPTED,
32 TTS_EVENT_CANCELLED, 34 TTS_EVENT_CANCELLED,
(...skipping 27 matching lines...) Expand all
60 int char_index, 62 int char_index,
61 const std::string& error_message); 63 const std::string& error_message);
62 64
63 // Finish an utterance without sending an event to the delegate. 65 // Finish an utterance without sending an event to the delegate.
64 void Finish(); 66 void Finish();
65 67
66 // Getters and setters for the text to speak and other speech options. 68 // Getters and setters for the text to speak and other speech options.
67 void set_text(const std::string& text) { text_ = text; } 69 void set_text(const std::string& text) { text_ = text; }
68 const std::string& text() const { return text_; } 70 const std::string& text() const { return text_; }
69 71
70 void set_options(const Value* options); 72 void set_options(const base::Value* options);
71 const Value* options() const { return options_.get(); } 73 const base::Value* options() const { return options_.get(); }
72 74
73 void set_src_extension_id(const std::string& src_extension_id) { 75 void set_src_extension_id(const std::string& src_extension_id) {
74 src_extension_id_ = src_extension_id; 76 src_extension_id_ = src_extension_id;
75 } 77 }
76 const std::string& src_extension_id() { return src_extension_id_; } 78 const std::string& src_extension_id() { return src_extension_id_; }
77 79
78 void set_src_id(int src_id) { src_id_ = src_id; } 80 void set_src_id(int src_id) { src_id_ = src_id; }
79 int src_id() { return src_id_; } 81 int src_id() { return src_id_; }
80 82
81 void set_src_url(const GURL& src_url) { src_url_ = src_url; } 83 void set_src_url(const GURL& src_url) { src_url_ = src_url; }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 146
145 // The id of the next utterance, so we can associate requests with 147 // The id of the next utterance, so we can associate requests with
146 // responses. 148 // responses.
147 static int next_utterance_id_; 149 static int next_utterance_id_;
148 150
149 // The text to speak. 151 // The text to speak.
150 std::string text_; 152 std::string text_;
151 153
152 // The full options arg passed to tts.speak, which may include fields 154 // The full options arg passed to tts.speak, which may include fields
153 // other than the ones we explicitly parse, below. 155 // other than the ones we explicitly parse, below.
154 scoped_ptr<Value> options_; 156 scoped_ptr<base::Value> options_;
155 157
156 // The extension ID of the extension that called speak() and should 158 // The extension ID of the extension that called speak() and should
157 // receive events. 159 // receive events.
158 std::string src_extension_id_; 160 std::string src_extension_id_;
159 161
160 // The source extension's ID of this utterance, so that it can associate 162 // The source extension's ID of this utterance, so that it can associate
161 // events with the appropriate callback. 163 // events with the appropriate callback.
162 int src_id_; 164 int src_id_;
163 165
164 // The URL of the page where the source extension called speak. 166 // The URL of the page where the source extension called speak.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // the callback function, and in addition, completion and error events 207 // the callback function, and in addition, completion and error events
206 // trigger finishing the current utterance and starting the next one, if 208 // trigger finishing the current utterance and starting the next one, if
207 // any. 209 // any.
208 void OnTtsEvent(int utterance_id, 210 void OnTtsEvent(int utterance_id,
209 TtsEventType event_type, 211 TtsEventType event_type,
210 int char_index, 212 int char_index,
211 const std::string& error_message); 213 const std::string& error_message);
212 214
213 // Return a list of all available voices, including the native voice, 215 // Return a list of all available voices, including the native voice,
214 // if supported, and all voices registered by extensions. 216 // if supported, and all voices registered by extensions.
215 ListValue* GetVoices(Profile* profile); 217 base::ListValue* GetVoices(Profile* profile);
216 218
217 // For unit testing. 219 // For unit testing.
218 void SetPlatformImpl(ExtensionTtsPlatformImpl* platform_impl); 220 void SetPlatformImpl(ExtensionTtsPlatformImpl* platform_impl);
219 int QueueSize(); 221 int QueueSize();
220 222
221 private: 223 private:
222 ExtensionTtsController(); 224 ExtensionTtsController();
223 virtual ~ExtensionTtsController(); 225 virtual ~ExtensionTtsController();
224 226
225 // Get the platform TTS implementation (or injected mock). 227 // Get the platform TTS implementation (or injected mock).
(...skipping 21 matching lines...) Expand all
247 std::queue<Utterance*> utterance_queue_; 249 std::queue<Utterance*> utterance_queue_;
248 250
249 // A pointer to the platform implementation of text-to-speech, for 251 // A pointer to the platform implementation of text-to-speech, for
250 // dependency injection. 252 // dependency injection.
251 ExtensionTtsPlatformImpl* platform_impl_; 253 ExtensionTtsPlatformImpl* platform_impl_;
252 254
253 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsController); 255 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsController);
254 }; 256 };
255 257
256 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_ 258 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tabs_module.h ('k') | chrome/browser/extensions/extension_tts_engine_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698