// Copyright 2014 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef EXTENSIONS_BROWSER_EXTENSION_PREF_VALUE_MAP_H_ #define EXTENSIONS_BROWSER_EXTENSION_PREF_VALUE_MAP_H_ #include <map> #include <memory> #include <set> #include <string> #include "base/observer_list.h" #include "components/keyed_service/core/keyed_service.h" #include "extensions/common/api/types.h" #include "extensions/common/extension_id.h" class PrefValueMap; namespace base { class Time; class Value; } // Non-persistent data container that is shared by ExtensionPrefStores. All // extension pref values (incognito and regular) are stored herein and // provided to ExtensionPrefStores. // // The semantics of the ExtensionPrefValueMap are: // - A regular setting applies to regular browsing sessions as well as incognito // browsing sessions. // - An incognito setting applies only to incognito browsing sessions, not to // regular ones. It takes precedence over a regular setting set by the same // extension. // - A regular-only setting applies only to regular browsing sessions, not to // incognito ones. It takes precedence over a regular setting set by the same // extension. // - If two different extensions set a value for the same preference (and both // values apply to the regular/incognito browsing session), the extension that // was installed later takes precedence, regardless of whether the settings // are regular, incognito or regular-only. // // The following table illustrates the behavior: // A.reg | A.reg_only | A.inc | B.reg | B.reg_only | B.inc | E.reg | E.inc // 1 | - | - | - | - | - | 1 | 1 // 1 | 2 | - | - | - | - | 2 | 1 // 1 | - | 3 | - | - | - | 1 | 3 // 1 | 2 | 3 | - | - | - | 2 | 3 // 1 | - | - | 4 | - | - | 4 | 4 // 1 | 2 | 3 | 4 | - | - | 4 | 4 // 1 | - | - | - | 5 | - | 5 | 1 // 1 | - | 3 | 4 | 5 | - | 5 | 4 // 1 | - | - | - | - | 6 | 1 | 6 // 1 | 2 | - | 4 | - | 6 | 4 | 6 // 1 | 2 | 3 | - | 5 | 6 | 5 | 6 // // A = extension A, B = extension B, E = effective value // .reg = regular value // .reg_only = regular-only value // .inc = incognito value // Extension B has higher precedence than A. class ExtensionPrefValueMap : public KeyedService { … }; #endif // EXTENSIONS_BROWSER_EXTENSION_PREF_VALUE_MAP_H_