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

Side by Side Diff: chrome/browser/chromeos/cros/cros_library.cc

Issue 1775006: Adding speech synthesis library to access TTS feature in libcros. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 7 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/chromeos/cros/cros_library.h" 5 #include "chrome/browser/chromeos/cros/cros_library.h"
6 6
7 #include "chrome/browser/chromeos/cros/cros_library_loader.h" 7 #include "chrome/browser/chromeos/cros/cros_library_loader.h"
8 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 8 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
9 #include "chrome/browser/chromeos/cros/language_library.h" 9 #include "chrome/browser/chromeos/cros/language_library.h"
10 #include "chrome/browser/chromeos/cros/login_library.h" 10 #include "chrome/browser/chromeos/cros/login_library.h"
11 #include "chrome/browser/chromeos/cros/mount_library.h" 11 #include "chrome/browser/chromeos/cros/mount_library.h"
12 #include "chrome/browser/chromeos/cros/network_library.h" 12 #include "chrome/browser/chromeos/cros/network_library.h"
13 #include "chrome/browser/chromeos/cros/power_library.h" 13 #include "chrome/browser/chromeos/cros/power_library.h"
14 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h"
14 #include "chrome/browser/chromeos/cros/synaptics_library.h" 15 #include "chrome/browser/chromeos/cros/synaptics_library.h"
15 16
16 namespace chromeos { 17 namespace chromeos {
17 18
18 CrosLibrary::CrosLibrary() : library_loader_(NULL), 19 CrosLibrary::CrosLibrary() : library_loader_(NULL),
19 crypto_lib_(NULL), 20 crypto_lib_(NULL),
20 language_lib_(NULL), 21 language_lib_(NULL),
21 login_lib_(NULL), 22 login_lib_(NULL),
22 mount_lib_(NULL), 23 mount_lib_(NULL),
23 network_lib_(NULL), 24 network_lib_(NULL),
24 power_lib_(NULL), 25 power_lib_(NULL),
26 speech_synthesis_lib_(NULL),
25 synaptics_lib_(NULL), 27 synaptics_lib_(NULL),
26 own_library_loader_(true), 28 own_library_loader_(true),
27 own_cryptohome_loader_(true), 29 own_cryptohome_loader_(true),
28 own_language_loader_(true), 30 own_language_loader_(true),
29 own_login_loader_(true), 31 own_login_loader_(true),
30 own_mount_loader_(true), 32 own_mount_loader_(true),
31 own_network_loader_(true), 33 own_network_loader_(true),
32 own_power_loader_(true), 34 own_power_loader_(true),
35 own_speech_synthesis_library_(true),
33 own_synaptics_library_(true), 36 own_synaptics_library_(true),
34 loaded_(false), 37 loaded_(false),
35 load_error_(false), 38 load_error_(false),
36 test_api_(NULL) { 39 test_api_(NULL) {
37 40
38 } 41 }
39 42
40 CrosLibrary::~CrosLibrary() { 43 CrosLibrary::~CrosLibrary() {
41 if (own_library_loader_ && library_loader_) 44 if (own_library_loader_ && library_loader_)
42 delete library_loader_; 45 delete library_loader_;
43 if (own_cryptohome_loader_ && crypto_lib_) 46 if (own_cryptohome_loader_ && crypto_lib_)
44 delete crypto_lib_; 47 delete crypto_lib_;
45 if (own_language_loader_ && language_lib_) 48 if (own_language_loader_ && language_lib_)
46 delete language_lib_; 49 delete language_lib_;
47 if (own_login_loader_ && login_lib_) 50 if (own_login_loader_ && login_lib_)
48 delete login_lib_; 51 delete login_lib_;
49 if (own_mount_loader_ && mount_lib_) 52 if (own_mount_loader_ && mount_lib_)
50 delete mount_lib_; 53 delete mount_lib_;
51 if (own_network_loader_ && network_lib_) 54 if (own_network_loader_ && network_lib_)
52 delete network_lib_; 55 delete network_lib_;
53 if (own_power_loader_ && power_lib_) 56 if (own_power_loader_ && power_lib_)
54 delete power_lib_; 57 delete power_lib_;
58 if (own_speech_synthesis_library_ && speech_synthesis_lib_)
59 delete speech_synthesis_lib_;
55 if (own_synaptics_library_ && synaptics_lib_) 60 if (own_synaptics_library_ && synaptics_lib_)
56 delete synaptics_lib_; 61 delete synaptics_lib_;
57 if (test_api_) 62 if (test_api_)
58 delete test_api_; 63 delete test_api_;
59 } 64 }
60 65
61 // static 66 // static
62 CrosLibrary* CrosLibrary::Get() { 67 CrosLibrary* CrosLibrary::Get() {
63 return Singleton<CrosLibrary>::get(); 68 return Singleton<CrosLibrary>::get();
64 } 69 }
(...skipping 27 matching lines...) Expand all
92 network_lib_ = new NetworkLibraryImpl(); 97 network_lib_ = new NetworkLibraryImpl();
93 return network_lib_; 98 return network_lib_;
94 } 99 }
95 100
96 PowerLibrary* CrosLibrary::GetPowerLibrary() { 101 PowerLibrary* CrosLibrary::GetPowerLibrary() {
97 if (!power_lib_) 102 if (!power_lib_)
98 power_lib_ = new PowerLibraryImpl(); 103 power_lib_ = new PowerLibraryImpl();
99 return power_lib_; 104 return power_lib_;
100 } 105 }
101 106
107 SpeechSynthesisLibrary* CrosLibrary::GetSpeechSynthesisLibrary() {
108 if (!speech_synthesis_lib_)
109 speech_synthesis_lib_ = new SpeechSynthesisLibraryImpl();
110 return speech_synthesis_lib_;
111 }
112
102 SynapticsLibrary* CrosLibrary::GetSynapticsLibrary() { 113 SynapticsLibrary* CrosLibrary::GetSynapticsLibrary() {
103 if (!synaptics_lib_) 114 if (!synaptics_lib_)
104 synaptics_lib_ = new SynapticsLibraryImpl(); 115 synaptics_lib_ = new SynapticsLibraryImpl();
105 return synaptics_lib_; 116 return synaptics_lib_;
106 } 117 }
107 118
108 bool CrosLibrary::EnsureLoaded() { 119 bool CrosLibrary::EnsureLoaded() {
109 if (!loaded_ && !load_error_) { 120 if (!loaded_ && !load_error_) {
110 if (!library_loader_) 121 if (!library_loader_)
111 library_loader_ = new CrosLibraryLoader(); 122 library_loader_ = new CrosLibraryLoader();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 library_->network_lib_ = library; 183 library_->network_lib_ = library;
173 } 184 }
174 185
175 void CrosLibrary::TestApi::SetPowerLibrary(PowerLibrary* library, bool own) { 186 void CrosLibrary::TestApi::SetPowerLibrary(PowerLibrary* library, bool own) {
176 if (library_->own_power_loader_ && library_->power_lib_) 187 if (library_->own_power_loader_ && library_->power_lib_)
177 delete library_->power_lib_; 188 delete library_->power_lib_;
178 library_->own_power_loader_ = own; 189 library_->own_power_loader_ = own;
179 library_->power_lib_ = library; 190 library_->power_lib_ = library;
180 } 191 }
181 192
193 void CrosLibrary::TestApi::SetSpeechSynthesisLibrary(
194 SpeechSynthesisLibrary* library, bool own) {
195 if (library_->own_speech_synthesis_library_ &&
196 library_->speech_synthesis_lib_)
197 delete library_->speech_synthesis_lib_;
198 library_->own_speech_synthesis_library_ = own;
199 library_->speech_synthesis_lib_ = library;
200 }
201
182 void CrosLibrary::TestApi::SetSynapticsLibrary(SynapticsLibrary* library, 202 void CrosLibrary::TestApi::SetSynapticsLibrary(SynapticsLibrary* library,
183 bool own) { 203 bool own) {
184 if (library_->own_synaptics_library_ && library_->synaptics_lib_) 204 if (library_->own_synaptics_library_ && library_->synaptics_lib_)
185 delete library_->synaptics_lib_; 205 delete library_->synaptics_lib_;
186 library_->own_synaptics_library_ = own; 206 library_->own_synaptics_library_ = own;
187 library_->synaptics_lib_ = library; 207 library_->synaptics_lib_ = library;
188 } 208 }
189 209
190 } // end namespace. 210 } // end namespace.
191
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/cros_library.h ('k') | chrome/browser/chromeos/cros/mock_speech_synthesis_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698