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

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

Issue 2859043: Added system notification for update_engine. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: . Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/input_method_library.h" 9 #include "chrome/browser/chromeos/cros/input_method_library.h"
10 #include "chrome/browser/chromeos/cros/keyboard_library.h" 10 #include "chrome/browser/chromeos/cros/keyboard_library.h"
11 #include "chrome/browser/chromeos/cros/login_library.h" 11 #include "chrome/browser/chromeos/cros/login_library.h"
12 #include "chrome/browser/chromeos/cros/mount_library.h" 12 #include "chrome/browser/chromeos/cros/mount_library.h"
13 #include "chrome/browser/chromeos/cros/network_library.h" 13 #include "chrome/browser/chromeos/cros/network_library.h"
14 #include "chrome/browser/chromeos/cros/power_library.h" 14 #include "chrome/browser/chromeos/cros/power_library.h"
15 #include "chrome/browser/chromeos/cros/screen_lock_library.h" 15 #include "chrome/browser/chromeos/cros/screen_lock_library.h"
16 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h" 16 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h"
17 #include "chrome/browser/chromeos/cros/synaptics_library.h" 17 #include "chrome/browser/chromeos/cros/synaptics_library.h"
18 #include "chrome/browser/chromeos/cros/syslogs_library.h" 18 #include "chrome/browser/chromeos/cros/syslogs_library.h"
19 #include "chrome/browser/chromeos/cros/system_library.h" 19 #include "chrome/browser/chromeos/cros/system_library.h"
20 #include "chrome/browser/chromeos/cros/update_library.h"
20 21
21 namespace chromeos { 22 namespace chromeos {
22 23
23 CrosLibrary::CrosLibrary() : library_loader_(NULL), 24 CrosLibrary::CrosLibrary() : library_loader_(NULL),
24 crypto_lib_(NULL), 25 crypto_lib_(NULL),
25 keyboard_lib_(NULL), 26 keyboard_lib_(NULL),
26 input_method_lib_(NULL), 27 input_method_lib_(NULL),
27 login_lib_(NULL), 28 login_lib_(NULL),
28 mount_lib_(NULL), 29 mount_lib_(NULL),
29 network_lib_(NULL), 30 network_lib_(NULL),
30 power_lib_(NULL), 31 power_lib_(NULL),
31 screen_lock_lib_(NULL), 32 screen_lock_lib_(NULL),
32 speech_synthesis_lib_(NULL), 33 speech_synthesis_lib_(NULL),
33 synaptics_lib_(NULL), 34 synaptics_lib_(NULL),
34 syslogs_lib_(NULL), 35 syslogs_lib_(NULL),
35 system_lib_(NULL), 36 system_lib_(NULL),
37 update_lib_(NULL),
36 own_library_loader_(true), 38 own_library_loader_(true),
37 own_cryptohome_lib_(true), 39 own_cryptohome_lib_(true),
38 own_keyboard_lib_(true), 40 own_keyboard_lib_(true),
39 own_input_method_lib_(true), 41 own_input_method_lib_(true),
40 own_login_lib_(true), 42 own_login_lib_(true),
41 own_mount_lib_(true), 43 own_mount_lib_(true),
42 own_network_lib_(true), 44 own_network_lib_(true),
43 own_power_lib_(true), 45 own_power_lib_(true),
44 own_screen_lock_lib_(true), 46 own_screen_lock_lib_(true),
45 own_speech_synthesis_lib_(true), 47 own_speech_synthesis_lib_(true),
46 own_synaptics_lib_(true), 48 own_synaptics_lib_(true),
47 own_syslogs_lib_(true), 49 own_syslogs_lib_(true),
48 own_system_lib_(true), 50 own_system_lib_(true),
51 own_update_lib_(true),
49 loaded_(false), 52 loaded_(false),
50 load_error_(false), 53 load_error_(false),
51 test_api_(NULL) { 54 test_api_(NULL) {
52 55
53 } 56 }
54 57
55 CrosLibrary::~CrosLibrary() { 58 CrosLibrary::~CrosLibrary() {
56 if (own_library_loader_) 59 if (own_library_loader_)
57 delete library_loader_; 60 delete library_loader_;
58 if (own_cryptohome_lib_) 61 if (own_cryptohome_lib_)
(...skipping 13 matching lines...) Expand all
72 if (own_screen_lock_lib_) 75 if (own_screen_lock_lib_)
73 delete screen_lock_lib_; 76 delete screen_lock_lib_;
74 if (own_speech_synthesis_lib_) 77 if (own_speech_synthesis_lib_)
75 delete speech_synthesis_lib_; 78 delete speech_synthesis_lib_;
76 if (own_synaptics_lib_) 79 if (own_synaptics_lib_)
77 delete synaptics_lib_; 80 delete synaptics_lib_;
78 if (own_syslogs_lib_) 81 if (own_syslogs_lib_)
79 delete syslogs_lib_; 82 delete syslogs_lib_;
80 if (own_system_lib_) 83 if (own_system_lib_)
81 delete system_lib_; 84 delete system_lib_;
85 if (own_update_lib_)
86 delete update_lib_;
82 delete test_api_; 87 delete test_api_;
83 } 88 }
84 89
85 // static 90 // static
86 CrosLibrary* CrosLibrary::Get() { 91 CrosLibrary* CrosLibrary::Get() {
87 return Singleton<CrosLibrary>::get(); 92 return Singleton<CrosLibrary>::get();
88 } 93 }
89 94
90 CryptohomeLibrary* CrosLibrary::GetCryptohomeLibrary() { 95 CryptohomeLibrary* CrosLibrary::GetCryptohomeLibrary() {
91 if (!crypto_lib_) 96 if (!crypto_lib_)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 syslogs_lib_ = new SyslogsLibraryImpl(); 157 syslogs_lib_ = new SyslogsLibraryImpl();
153 return syslogs_lib_; 158 return syslogs_lib_;
154 } 159 }
155 160
156 SystemLibrary* CrosLibrary::GetSystemLibrary() { 161 SystemLibrary* CrosLibrary::GetSystemLibrary() {
157 if (!system_lib_) 162 if (!system_lib_)
158 system_lib_ = new SystemLibraryImpl(); 163 system_lib_ = new SystemLibraryImpl();
159 return system_lib_; 164 return system_lib_;
160 } 165 }
161 166
167 UpdateLibrary* CrosLibrary::GetUpdateLibrary() {
168 if (!update_lib_)
169 update_lib_ = new UpdateLibraryImpl();
170 return update_lib_;
171 }
172
162 bool CrosLibrary::EnsureLoaded() { 173 bool CrosLibrary::EnsureLoaded() {
163 if (!loaded_ && !load_error_) { 174 if (!loaded_ && !load_error_) {
164 if (!library_loader_) 175 if (!library_loader_)
165 library_loader_ = new CrosLibraryLoader(); 176 library_loader_ = new CrosLibraryLoader();
166 loaded_ = library_loader_->Load(&load_error_string_); 177 loaded_ = library_loader_->Load(&load_error_string_);
167 load_error_ = !loaded_; 178 load_error_ = !loaded_;
168 } 179 }
169 return loaded_; 180 return loaded_;
170 } 181 }
171 182
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 285 }
275 286
276 void CrosLibrary::TestApi::SetSystemLibrary(SystemLibrary* library, 287 void CrosLibrary::TestApi::SetSystemLibrary(SystemLibrary* library,
277 bool own) { 288 bool own) {
278 if (library_->system_lib_) 289 if (library_->system_lib_)
279 delete library_->system_lib_; 290 delete library_->system_lib_;
280 library_->own_system_lib_ = own; 291 library_->own_system_lib_ = own;
281 library_->system_lib_ = library; 292 library_->system_lib_ = library;
282 } 293 }
283 294
295 void CrosLibrary::TestApi::SetUpdateLibrary(UpdateLibrary* library,
296 bool own) {
297 if (library_->update_lib_)
298 delete library_->update_lib_;
299 library_->own_update_lib_ = own;
300 library_->update_lib_ = library;
301 }
302
284 } // namespace chromeos 303 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/cros_library.h ('k') | chrome/browser/chromeos/cros/mock_update_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698