| Index: chrome/browser/ui/zoom/chrome_zoom_prefs_helper.h
|
| diff --git a/chrome/browser/ui/zoom/chrome_zoom_prefs_helper.h b/chrome/browser/ui/zoom/chrome_zoom_prefs_helper.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..302d40c6f190d9bd22cdbc043815e6e1bf73c018
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/zoom/chrome_zoom_prefs_helper.h
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_PREFS_HELPER_H_
|
| +#define CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_PREFS_HELPER_H_
|
| +
|
| +#include <memory>
|
| +#include <string>
|
| +
|
| +#include "base/macros.h"
|
| +#include "components/prefs/scoped_user_pref_update.h"
|
| +
|
| +class PrefService;
|
| +
|
| +namespace base {
|
| +class DictionaryValue;
|
| +class FilePath;
|
| +}
|
| +
|
| +// This class wraps a PrefService so that calls to get/set a preference value
|
| +// apply to the value under the key for a specific storage partition.
|
| +class ChromeZoomPrefsHelper {
|
| + public:
|
| + ChromeZoomPrefsHelper(
|
| + PrefService* pref_service,
|
| + const base::FilePath& profile_path,
|
| + const base::FilePath& partition_path);
|
| +
|
| + static std::string GetHashForTesting(const base::FilePath& relative_path);
|
| +
|
| + // Get/set the value under our partition key for the pref.
|
| + bool GetBoolean(const char* pref_name, bool* value) const;
|
| + void SetBoolean(const char* pref_name, bool value);
|
| + bool GetDouble(const char* pref_name, double* value) const;
|
| + void SetDouble(const char* pref_name, double value);
|
| +
|
| + // Get the dictionary under our partition key for the pref.
|
| + bool GetDictionary(const char* pref_name,
|
| + const base::DictionaryValue** value) const;
|
| + // Get a DictionaryPrefUpdate for the pref which can then be used to get a
|
| + // mutable dictionary.
|
| + std::unique_ptr<DictionaryPrefUpdate> GetUpdate(const char* pref_name);
|
| + // Get a mutable dictionary under our partition key for the pref.
|
| + // |update| must outlive the use of the returned dictionary.
|
| + base::DictionaryValue* GetMutableDictionary(
|
| + DictionaryPrefUpdate* update) const;
|
| +
|
| + private:
|
| + PrefService* pref_service_;
|
| + std::string partition_key_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ChromeZoomPrefsHelper);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_PREFS_HELPER_H_
|
|
|