summaryrefslogtreecommitdiffstats
path: root/components/content_settings
diff options
context:
space:
mode:
authorvabr <vabr@chromium.org>2014-10-10 04:13:26 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-10 11:13:45 +0000
commit478dd52b98307a5b27eca64a8a8af14e0977cc67 (patch)
tree7d62a116bd4f6468ea711c2ea14fbfb97c51f9b0 /components/content_settings
parent6650ccfc57f15543efdba8eaab758b6f2071f32b (diff)
downloadchromium_src-478dd52b98307a5b27eca64a8a8af14e0977cc67.zip
chromium_src-478dd52b98307a5b27eca64a8a8af14e0977cc67.tar.gz
chromium_src-478dd52b98307a5b27eca64a8a8af14e0977cc67.tar.bz2
Introduce ContentSettingsClient interface
This CL: * Introduces ContentSettingsClient interface. * Includes some functions to be transferred to interface from TabSpecificContentSettings. To be done in follow-up CLs: * Introduce a Chrome implementation of this interface. * Add code to create those objects. * Move the methods from TabSpecificContentSettings included in the interface to the implementation. BUG=387075,384873,393248 Review URL: https://codereview.chromium.org/640753002 Cr-Commit-Position: refs/heads/master@{#299090}
Diffstat (limited to 'components/content_settings')
-rw-r--r--components/content_settings/core/browser/BUILD.gn1
-rw-r--r--components/content_settings/core/browser/content_settings_client.h73
-rw-r--r--components/content_settings/core/browser/local_shared_objects_counter.h2
3 files changed, 76 insertions, 0 deletions
diff --git a/components/content_settings/core/browser/BUILD.gn b/components/content_settings/core/browser/BUILD.gn
index 04354f6..4535a9a 100644
--- a/components/content_settings/core/browser/BUILD.gn
+++ b/components/content_settings/core/browser/BUILD.gn
@@ -4,6 +4,7 @@
static_library("browser") {
sources = [
+ "content_settings_client.h",
"content_settings_details.cc",
"content_settings_details.h",
"content_settings_observer.h",
diff --git a/components/content_settings/core/browser/content_settings_client.h b/components/content_settings/core/browser/content_settings_client.h
new file mode 100644
index 0000000..1bda243
--- /dev/null
+++ b/components/content_settings/core/browser/content_settings_client.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2014 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_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_CLIENT_H_
+#define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_CLIENT_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/strings/string16.h"
+
+class GURL;
+class LocalSharedObjectsCounter;
+
+namespace net {
+class CookieList;
+class CookieOptions;
+}
+
+namespace content_settings {
+
+// An abstraction of operations that depend on the embedder (e.g. Chrome).
+// For mock / testing implementation in tests you can inherit from
+// StubContentSettingsClient instead to avoid the need to stub unneeded pure
+// virtual methods.
+class ContentSettingsClient {
+ public:
+ enum AccessType { BLOCKED, ALLOWED };
+
+ ContentSettingsClient() {}
+ virtual ~ContentSettingsClient() {}
+
+ // Methods to notify the client about access to local shared objects.
+ virtual void OnCookiesRead(const GURL& url,
+ const GURL& first_party_url,
+ const net::CookieList& cookie_list,
+ bool blocked_by_policy) = 0;
+
+ virtual void OnCookieChanged(const GURL& url,
+ const GURL& first_party_url,
+ const std::string& cookie_line,
+ const net::CookieOptions& options,
+ bool blocked_by_policy) = 0;
+
+ virtual void OnFileSystemAccessed(const GURL& url,
+ bool blocked_by_policy) = 0;
+
+ virtual void OnIndexedDBAccessed(const GURL& url,
+ const base::string16& description,
+ bool blocked_by_policy) = 0;
+
+ virtual void OnLocalStorageAccessed(const GURL& url,
+ bool local,
+ bool blocked_by_policy) = 0;
+
+ virtual void OnWebDatabaseAccessed(const GURL& url,
+ const base::string16& name,
+ const base::string16& display_name,
+ bool blocked_by_policy) = 0;
+
+ // Returns the |LocalSharedObjectsCounter| instances corresponding to all
+ // allowed (or blocked, depending on |type|) local shared objects.
+ virtual const LocalSharedObjectsCounter& local_shared_objects(
+ AccessType type) const = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ContentSettingsClient);
+};
+
+} // namespace content_settings
+
+#endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_CLIENT_H_
diff --git a/components/content_settings/core/browser/local_shared_objects_counter.h b/components/content_settings/core/browser/local_shared_objects_counter.h
index 161b85b..582956d 100644
--- a/components/content_settings/core/browser/local_shared_objects_counter.h
+++ b/components/content_settings/core/browser/local_shared_objects_counter.h
@@ -5,6 +5,8 @@
#ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_LOCAL_SHARED_OBJECTS_COUNTER_H_
#define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_LOCAL_SHARED_OBJECTS_COUNTER_H_
+#include "base/basictypes.h"
+
class GURL;
// An interface to retrieve counts of browser data objects.