OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_CLIENT_H_ |
| 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_CLIENT_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/strings/string16.h" |
| 12 |
| 13 class GURL; |
| 14 class LocalSharedObjectsCounter; |
| 15 |
| 16 namespace net { |
| 17 class CookieList; |
| 18 class CookieOptions; |
| 19 } |
| 20 |
| 21 namespace content_settings { |
| 22 |
| 23 // An abstraction of operations that depend on the embedder (e.g. Chrome). |
| 24 // For mock / testing implementation in tests you can inherit from |
| 25 // StubContentSettingsClient instead to avoid the need to stub unneeded pure |
| 26 // virtual methods. |
| 27 class ContentSettingsClient { |
| 28 public: |
| 29 enum AccessType { BLOCKED, ALLOWED }; |
| 30 |
| 31 ContentSettingsClient() {} |
| 32 virtual ~ContentSettingsClient() {} |
| 33 |
| 34 // Methods to notify the client about access to local shared objects. |
| 35 virtual void OnCookiesRead(const GURL& url, |
| 36 const GURL& first_party_url, |
| 37 const net::CookieList& cookie_list, |
| 38 bool blocked_by_policy) = 0; |
| 39 |
| 40 virtual void OnCookieChanged(const GURL& url, |
| 41 const GURL& first_party_url, |
| 42 const std::string& cookie_line, |
| 43 const net::CookieOptions& options, |
| 44 bool blocked_by_policy) = 0; |
| 45 |
| 46 virtual void OnFileSystemAccessed(const GURL& url, |
| 47 bool blocked_by_policy) = 0; |
| 48 |
| 49 virtual void OnIndexedDBAccessed(const GURL& url, |
| 50 const base::string16& description, |
| 51 bool blocked_by_policy) = 0; |
| 52 |
| 53 virtual void OnLocalStorageAccessed(const GURL& url, |
| 54 bool local, |
| 55 bool blocked_by_policy) = 0; |
| 56 |
| 57 virtual void OnWebDatabaseAccessed(const GURL& url, |
| 58 const base::string16& name, |
| 59 const base::string16& display_name, |
| 60 bool blocked_by_policy) = 0; |
| 61 |
| 62 // Returns the |LocalSharedObjectsCounter| instances corresponding to all |
| 63 // allowed (or blocked, depending on |type|) local shared objects. |
| 64 virtual const LocalSharedObjectsCounter& local_shared_objects( |
| 65 AccessType type) const = 0; |
| 66 |
| 67 private: |
| 68 DISALLOW_COPY_AND_ASSIGN(ContentSettingsClient); |
| 69 }; |
| 70 |
| 71 } // namespace content_settings |
| 72 |
| 73 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_CLIENT_H_ |
OLD | NEW |