| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_ |
| 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 9 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 10 #include "chrome/browser/content_settings/local_shared_objects_container.h" | 10 #include "chrome/browser/content_settings/local_shared_objects_container.h" |
| 11 #include "components/content_settings/core/browser/content_settings_client.h" | 11 #include "components/content_settings/core/browser/content_settings_client.h" |
| 12 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
| 13 | 13 |
| 14 // Chrome-specific implementation of the ContentSettingsClient interface. | 14 // Chrome-specific implementation of the ContentSettingsClient interface. |
| 15 class ChromeContentSettingsClient | 15 class ChromeContentSettingsClient |
| 16 : public content_settings::ContentSettingsClient, | 16 : public content_settings::ContentSettingsClient, |
| 17 public content::WebContentsUserData<ChromeContentSettingsClient> { | 17 public content::WebContentsUserData<ChromeContentSettingsClient> { |
| 18 public: | 18 public: |
| 19 virtual ~ChromeContentSettingsClient(); | 19 ~ChromeContentSettingsClient() override; |
| 20 | 20 |
| 21 static void CreateForWebContents(content::WebContents* contents); | 21 static void CreateForWebContents(content::WebContents* contents); |
| 22 | 22 |
| 23 // ContentSettingsClient implementation. | 23 // ContentSettingsClient implementation. |
| 24 virtual void OnCookiesRead(const GURL& url, | 24 void OnCookiesRead(const GURL& url, |
| 25 const GURL& first_party_url, | 25 const GURL& first_party_url, |
| 26 const net::CookieList& cookie_list, | 26 const net::CookieList& cookie_list, |
| 27 bool blocked_by_policy) override; |
| 28 void OnCookieChanged(const GURL& url, |
| 29 const GURL& first_party_url, |
| 30 const std::string& cookie_line, |
| 31 const net::CookieOptions& options, |
| 32 bool blocked_by_policy) override; |
| 33 void OnFileSystemAccessed(const GURL& url, bool blocked_by_policy) override; |
| 34 void OnIndexedDBAccessed(const GURL& url, |
| 35 const base::string16& description, |
| 36 bool blocked_by_policy) override; |
| 37 void OnLocalStorageAccessed(const GURL& url, |
| 38 bool local, |
| 39 bool blocked_by_policy) override; |
| 40 void OnWebDatabaseAccessed(const GURL& url, |
| 41 const base::string16& name, |
| 42 const base::string16& display_name, |
| 27 bool blocked_by_policy) override; | 43 bool blocked_by_policy) override; |
| 28 virtual void OnCookieChanged(const GURL& url, | 44 const LocalSharedObjectsCounter& local_shared_objects( |
| 29 const GURL& first_party_url, | |
| 30 const std::string& cookie_line, | |
| 31 const net::CookieOptions& options, | |
| 32 bool blocked_by_policy) override; | |
| 33 virtual void OnFileSystemAccessed(const GURL& url, | |
| 34 bool blocked_by_policy) override; | |
| 35 virtual void OnIndexedDBAccessed(const GURL& url, | |
| 36 const base::string16& description, | |
| 37 bool blocked_by_policy) override; | |
| 38 virtual void OnLocalStorageAccessed(const GURL& url, | |
| 39 bool local, | |
| 40 bool blocked_by_policy) override; | |
| 41 virtual void OnWebDatabaseAccessed(const GURL& url, | |
| 42 const base::string16& name, | |
| 43 const base::string16& display_name, | |
| 44 bool blocked_by_policy) override; | |
| 45 virtual const LocalSharedObjectsCounter& local_shared_objects( | |
| 46 AccessType type) const override; | 45 AccessType type) const override; |
| 47 | 46 |
| 48 // Creates a new copy of a CookiesTreeModel for all allowed (or blocked, | 47 // Creates a new copy of a CookiesTreeModel for all allowed (or blocked, |
| 49 // depending on |type|) local shared objects. | 48 // depending on |type|) local shared objects. |
| 50 scoped_ptr<CookiesTreeModel> CreateCookiesTreeModel(AccessType type) const; | 49 scoped_ptr<CookiesTreeModel> CreateCookiesTreeModel(AccessType type) const; |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 friend class content::WebContentsUserData<ChromeContentSettingsClient>; | 52 friend class content::WebContentsUserData<ChromeContentSettingsClient>; |
| 54 | 53 |
| 55 explicit ChromeContentSettingsClient(content::WebContents* contents); | 54 explicit ChromeContentSettingsClient(content::WebContents* contents); |
| 56 | 55 |
| 57 // Stores the blocked/allowed site data. | 56 // Stores the blocked/allowed site data. |
| 58 LocalSharedObjectsContainer allowed_local_shared_objects_; | 57 LocalSharedObjectsContainer allowed_local_shared_objects_; |
| 59 LocalSharedObjectsContainer blocked_local_shared_objects_; | 58 LocalSharedObjectsContainer blocked_local_shared_objects_; |
| 60 | 59 |
| 61 DISALLOW_COPY_AND_ASSIGN(ChromeContentSettingsClient); | 60 DISALLOW_COPY_AND_ASSIGN(ChromeContentSettingsClient); |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_ | 63 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_ |
| OLD | NEW |