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

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_app_manager.h

Issue 900553006: Updated KioskAppManager to track whether an app was auto-launched. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback Created 5 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/app_mode/kiosk_app_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // be enabled on this machine. 52 // be enabled on this machine.
53 CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED, 53 CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED,
54 }; 54 };
55 55
56 typedef base::Callback<void(bool success)> EnableKioskAutoLaunchCallback; 56 typedef base::Callback<void(bool success)> EnableKioskAutoLaunchCallback;
57 typedef base::Callback<void(ConsumerKioskAutoLaunchStatus status)> 57 typedef base::Callback<void(ConsumerKioskAutoLaunchStatus status)>
58 GetConsumerKioskAutoLaunchStatusCallback; 58 GetConsumerKioskAutoLaunchStatusCallback;
59 59
60 // Struct to hold app info returned from GetApps() call. 60 // Struct to hold app info returned from GetApps() call.
61 struct App { 61 struct App {
62 App(const KioskAppData& data, bool is_extension_pending); 62 App(const KioskAppData& data,
63 bool is_extension_pending,
64 bool was_auto_launched_with_zero_delay);
63 App(); 65 App();
64 ~App(); 66 ~App();
65 67
66 std::string app_id; 68 std::string app_id;
67 std::string user_id; 69 std::string user_id;
68 std::string name; 70 std::string name;
69 gfx::ImageSkia icon; 71 gfx::ImageSkia icon;
70 bool is_loading; 72 bool is_loading;
73 bool was_auto_launched_with_zero_delay;
71 }; 74 };
72 typedef std::vector<App> Apps; 75 typedef std::vector<App> Apps;
73 76
74 // Name of a dictionary that holds kiosk app info in Local State. 77 // Name of a dictionary that holds kiosk app info in Local State.
75 // Sample layout: 78 // Sample layout:
76 // "kiosk": { 79 // "kiosk": {
77 // "auto_login_enabled": true // 80 // "auto_login_enabled": true //
78 // } 81 // }
79 static const char kKioskDictionaryName[]; 82 static const char kKioskDictionaryName[];
80 static const char kKeyApps[]; 83 static const char kKeyApps[];
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 119
117 // Sets |app_id| as the app to auto launch at start up. 120 // Sets |app_id| as the app to auto launch at start up.
118 void SetAutoLaunchApp(const std::string& app_id); 121 void SetAutoLaunchApp(const std::string& app_id);
119 122
120 // Returns true if there is a pending auto-launch request. 123 // Returns true if there is a pending auto-launch request.
121 bool IsAutoLaunchRequested() const; 124 bool IsAutoLaunchRequested() const;
122 125
123 // Returns true if owner/policy enabled auto launch. 126 // Returns true if owner/policy enabled auto launch.
124 bool IsAutoLaunchEnabled() const; 127 bool IsAutoLaunchEnabled() const;
125 128
129 // Returns true if current app was auto launched with zero delay.
130 bool IsCurrentAppAutoLaunchedWithZeroDelay() const;
131
126 // Enable auto launch setter. 132 // Enable auto launch setter.
127 void SetEnableAutoLaunch(bool value); 133 void SetEnableAutoLaunch(bool value);
128 134
129 // Adds/removes a kiosk app by id. When removed, all locally cached data 135 // Adds/removes a kiosk app by id. When removed, all locally cached data
130 // will be removed as well. 136 // will be removed as well.
131 void AddApp(const std::string& app_id); 137 void AddApp(const std::string& app_id);
132 void RemoveApp(const std::string& app_id); 138 void RemoveApp(const std::string& app_id);
133 139
134 // Gets info of all apps that have no meta data load error. 140 // Gets info of all apps that have no meta data load error.
135 void GetApps(Apps* apps) const; 141 void GetApps(Apps* apps) const;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 194
189 // Installs the validated external extension into cache. 195 // Installs the validated external extension into cache.
190 void PutValidatedExternalExtension( 196 void PutValidatedExternalExtension(
191 const std::string& app_id, 197 const std::string& app_id,
192 const base::FilePath& crx_path, 198 const base::FilePath& crx_path,
193 const std::string& version, 199 const std::string& version,
194 const ExternalCache::PutExternalExtensionCallback& callback); 200 const ExternalCache::PutExternalExtensionCallback& callback);
195 201
196 bool external_loader_created() const { return external_loader_created_; } 202 bool external_loader_created() const { return external_loader_created_; }
197 203
204 // Notifies the KioskAppManager that a given app was auto-launched
205 // automatically with no delay on startup. Certain privacy-sensitive
206 // kiosk-mode behavior (such as network reporting) is only enabled for
207 // kiosk apps that are immediately auto-launched on startup.
208 void SetAppWasAutoLaunchedWithZeroDelay(const std::string& app_id);
209
198 private: 210 private:
199 friend struct base::DefaultLazyInstanceTraits<KioskAppManager>; 211 friend struct base::DefaultLazyInstanceTraits<KioskAppManager>;
200 friend struct base::DefaultDeleter<KioskAppManager>; 212 friend struct base::DefaultDeleter<KioskAppManager>;
201 friend class KioskAppManagerTest; 213 friend class KioskAppManagerTest;
202 friend class KioskTest; 214 friend class KioskTest;
203 friend class KioskUpdateTest; 215 friend class KioskUpdateTest;
204 216
205 enum AutoLoginState { 217 enum AutoLoginState {
206 AUTOLOGIN_NONE = 0, 218 AUTOLOGIN_NONE = 0,
207 AUTOLOGIN_REQUESTED = 1, 219 AUTOLOGIN_REQUESTED = 1,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 AutoLoginState GetAutoLoginState() const; 266 AutoLoginState GetAutoLoginState() const;
255 void SetAutoLoginState(AutoLoginState state); 267 void SetAutoLoginState(AutoLoginState state);
256 268
257 void GetCrxCacheDir(base::FilePath* cache_dir); 269 void GetCrxCacheDir(base::FilePath* cache_dir);
258 void GetCrxUnpackDir(base::FilePath* unpack_dir); 270 void GetCrxUnpackDir(base::FilePath* unpack_dir);
259 271
260 // True if machine ownership is already established. 272 // True if machine ownership is already established.
261 bool ownership_established_; 273 bool ownership_established_;
262 ScopedVector<KioskAppData> apps_; 274 ScopedVector<KioskAppData> apps_;
263 std::string auto_launch_app_id_; 275 std::string auto_launch_app_id_;
276 std::string currently_auto_launched_with_zero_delay_app_;
264 ObserverList<KioskAppManagerObserver, true> observers_; 277 ObserverList<KioskAppManagerObserver, true> observers_;
265 278
266 scoped_ptr<CrosSettings::ObserverSubscription> 279 scoped_ptr<CrosSettings::ObserverSubscription>
267 local_accounts_subscription_; 280 local_accounts_subscription_;
268 scoped_ptr<CrosSettings::ObserverSubscription> 281 scoped_ptr<CrosSettings::ObserverSubscription>
269 local_account_auto_login_id_subscription_; 282 local_account_auto_login_id_subscription_;
270 283
271 scoped_ptr<ExternalCache> external_cache_; 284 scoped_ptr<ExternalCache> external_cache_;
272 285
273 scoped_ptr<KioskExternalUpdater> usb_stick_updater_; 286 scoped_ptr<KioskExternalUpdater> usb_stick_updater_;
274 287
275 // The extension external loader for installing kiosk app. 288 // The extension external loader for installing kiosk app.
276 bool external_loader_created_; 289 bool external_loader_created_;
277 base::WeakPtr<KioskAppExternalLoader> external_loader_; 290 base::WeakPtr<KioskAppExternalLoader> external_loader_;
278 291
279 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); 292 DISALLOW_COPY_AND_ASSIGN(KioskAppManager);
280 }; 293 };
281 294
282 } // namespace chromeos 295 } // namespace chromeos
283 296
284 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ 297 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/app_mode/kiosk_app_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698