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

Side by Side Diff: chrome/browser/chromeos/settings/stub_cros_settings_provider.h

Issue 1019283004: Switch to direct use of OwnerSettingsServiceChromeOS::Set() in tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 5 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
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_CHROMEOS_SETTINGS_STUB_CROS_SETTINGS_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_CROS_SETTINGS_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_CROS_SETTINGS_PROVIDER_H_ 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_CROS_SETTINGS_PROVIDER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/prefs/pref_value_map.h" 10 #include "base/prefs/pref_value_map.h"
11 #include "chromeos/settings/cros_settings_provider.h" 11 #include "chromeos/settings/cros_settings_provider.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 14
15 // CrosSettingsProvider implementation that stores settings in memory unsigned. 15 // CrosSettingsProvider implementation that stores settings in memory unsigned.
16 class StubCrosSettingsProvider : public CrosSettingsProvider { 16 class StubCrosSettingsProvider : public CrosSettingsProvider {
17 public: 17 public:
18 explicit StubCrosSettingsProvider(const NotifyObserversCallback& notify_cb); 18 explicit StubCrosSettingsProvider(const NotifyObserversCallback& notify_cb);
19 StubCrosSettingsProvider(); 19 StubCrosSettingsProvider();
20 ~StubCrosSettingsProvider() override; 20 ~StubCrosSettingsProvider() override;
21 21
22 // CrosSettingsProvider implementation. 22 // CrosSettingsProvider implementation.
23 const base::Value* Get(const std::string& path) const override; 23 const base::Value* Get(const std::string& path) const override;
24 TrustedStatus PrepareTrustedValues(const base::Closure& callback) override; 24 TrustedStatus PrepareTrustedValues(const base::Closure& callback) override;
25 bool HandlesSetting(const std::string& path) const override; 25 bool HandlesSetting(const std::string& path) const override;
26 26
27 void SetTrustedStatus(TrustedStatus status);
28 void SetCurrentUserIsOwner(bool owner);
29
27 private: 30 private:
28 // CrosSettingsProvider implementation: 31 // CrosSettingsProvider implementation:
29 void DoSet(const std::string& path, const base::Value& value) override; 32 void DoSet(const std::string& path, const base::Value& value) override;
30 33
31 // Initializes settings to their defaults. 34 // Initializes settings to their defaults.
32 void SetDefaults(); 35 void SetDefaults();
33 36
34 // In-memory settings storage. 37 // In-memory settings storage.
35 PrefValueMap values_; 38 PrefValueMap values_;
36 39
40 // By default, every value from Set is written. However, in some cases (e.g.
bartfab (slow) 2015/04/10 08:38:13 I find this comment very difficult to parse. Rewor
Ivan Podogov 2015/04/10 09:50:53 This behavior is actually something that some test
bartfab (slow) 2015/04/14 14:10:09 This still looks very hacky. Anyone reading such a
Ivan Podogov 2015/04/14 14:40:37 This is actually a mimic of the current DeviceSett
41 // enterprise-managed) it is required to retain current settings, but notify
42 // about the attempted change. That's what happens when the current user is
43 // not the owner.
44 bool current_user_is_owner_;
bartfab (slow) 2015/04/10 08:38:14 Nit: Initialize this.
Ivan Podogov 2015/04/10 09:50:53 Done.
45
46 // Default value is TRUSTED.
47 TrustedStatus trusted_status_;
bartfab (slow) 2015/04/10 08:38:14 Nit: Initialize this.
Ivan Podogov 2015/04/10 09:50:53 Done.
48
37 DISALLOW_COPY_AND_ASSIGN(StubCrosSettingsProvider); 49 DISALLOW_COPY_AND_ASSIGN(StubCrosSettingsProvider);
38 }; 50 };
39 51
40 } // namespace chromeos 52 } // namespace chromeos
41 53
42 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_CROS_SETTINGS_PROVIDER_H_ 54 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_CROS_SETTINGS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698