summaryrefslogtreecommitdiffstats
path: root/components/keyed_service
diff options
context:
space:
mode:
authorsdefresne <sdefresne@chromium.org>2015-01-10 02:10:04 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-10 10:10:50 +0000
commite9ea3c2ead117e0945df3c9d64c202477fffc99c (patch)
tree3500ad640cb8a244274c8adaa88599d60a64d78c /components/keyed_service
parent6fd7d48e8d56558b4279a0cec8490f6e59f37a48 (diff)
downloadchromium_src-e9ea3c2ead117e0945df3c9d64c202477fffc99c.zip
chromium_src-e9ea3c2ead117e0945df3c9d64c202477fffc99c.tar.gz
chromium_src-e9ea3c2ead117e0945df3c9d64c202477fffc99c.tar.bz2
Move ServiceAccessType into //components/keyed_service
The ServiceAccessType is only used when interacting with KeyedServiceFactories so move it into the keyed_service components. Turn the enumeration into a "class enum" so that the value names don't leak into the global namespace. Fix client code and add missing #include after changing the chrome/browser/profiles/profile.h #include into forward declaration in the KeyedServiceFactories headers. Usage of the enumeration was fixed using tools/git/mffr.py. BUG=419366 Review URL: https://codereview.chromium.org/839193002 Cr-Commit-Position: refs/heads/master@{#310979}
Diffstat (limited to 'components/keyed_service')
-rw-r--r--components/keyed_service/core/BUILD.gn1
-rw-r--r--components/keyed_service/core/service_access_type.h34
2 files changed, 35 insertions, 0 deletions
diff --git a/components/keyed_service/core/BUILD.gn b/components/keyed_service/core/BUILD.gn
index e0354e5..bc8d3b0 100644
--- a/components/keyed_service/core/BUILD.gn
+++ b/components/keyed_service/core/BUILD.gn
@@ -21,6 +21,7 @@ component("core") {
"refcounted_keyed_service.h",
"refcounted_keyed_service_factory.cc",
"refcounted_keyed_service_factory.h",
+ "service_access_types.h",
]
defines = [ "KEYED_SERVICE_IMPLEMENTATION" ]
diff --git a/components/keyed_service/core/service_access_type.h b/components/keyed_service/core/service_access_type.h
new file mode 100644
index 0000000..257a47d
--- /dev/null
+++ b/components/keyed_service/core/service_access_type.h
@@ -0,0 +1,34 @@
+// Copyright 2015 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 COMPONENTS_KEYED_SERVICE_CORE_SERVICE_ACCESS_TYPE_H_
+#define COMPONENTS_KEYED_SERVICE_CORE_SERVICE_ACCESS_TYPE_H_
+
+// Some KeyedServices are accessed with the following parameter. This parameter
+// defines what the caller plans to do with the service.
+//
+// The caller is responsible for not performing any operation that would
+// result in persistent implicit records while using an OffTheRecord context.
+// This flag allows the context to perform an additional check.
+//
+// It also leaves an opportunity to perform further checks in the future. For
+// example an history service that only allow some specific methods could be
+// returned.
+enum class ServiceAccessType {
+ // The caller plans to perform a read or write that takes place as a result
+ // of the user input. Use this flag when the operation can be performed while
+ // incognito (for example creating a bookmark).
+ //
+ // Since EXPLICIT_ACCESS means "as a result of a user action", this request
+ // always succeeds.
+ EXPLICIT_ACCESS,
+
+ // The caller plans to call a method that will permanently change some data
+ // in the context, as part of Chrome's implicit data logging. Use this flag
+ // before performing an operation which is incompatible with the incognito
+ // mode.
+ IMPLICIT_ACCESS
+};
+
+#endif // COMPONENTS_KEYED_SERVICE_CORE_SERVICE_ACCESS_TYPE_H_