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.
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/browsing_data/cookies_tree_model.h"
10 #include "chrome/browser/content_settings/local_shared_objects_container.h"
11 #include "components/content_settings/core/browser/content_settings_client.h"
12 #include "content/public/browser/web_contents_user_data.h"
14 // Chrome-specific implementation of the ContentSettingsClient interface.
15 class ChromeContentSettingsClient
16 : public content_settings::ContentSettingsClient
,
17 public content::WebContentsUserData
<ChromeContentSettingsClient
> {
19 ~ChromeContentSettingsClient() override
;
21 // ContentSettingsClient implementation.
22 void OnCookiesRead(const GURL
& url
,
23 const GURL
& first_party_url
,
24 const net::CookieList
& cookie_list
,
25 bool blocked_by_policy
) override
;
26 void OnCookieChanged(const GURL
& url
,
27 const GURL
& first_party_url
,
28 const std::string
& cookie_line
,
29 const net::CookieOptions
& options
,
30 bool blocked_by_policy
) override
;
31 void OnFileSystemAccessed(const GURL
& url
, bool blocked_by_policy
) override
;
32 void OnIndexedDBAccessed(const GURL
& url
,
33 const base::string16
& description
,
34 bool blocked_by_policy
) override
;
35 void OnLocalStorageAccessed(const GURL
& url
,
37 bool blocked_by_policy
) override
;
38 void OnWebDatabaseAccessed(const GURL
& url
,
39 const base::string16
& name
,
40 const base::string16
& display_name
,
41 bool blocked_by_policy
) override
;
42 const LocalSharedObjectsCounter
& local_shared_objects(
43 AccessType type
) const override
;
45 // Creates a new copy of a CookiesTreeModel for all allowed (or blocked,
46 // depending on |type|) local shared objects.
47 scoped_ptr
<CookiesTreeModel
> CreateCookiesTreeModel(AccessType type
) const;
50 friend class content::WebContentsUserData
<ChromeContentSettingsClient
>;
52 explicit ChromeContentSettingsClient(content::WebContents
* contents
);
54 // Stores the blocked/allowed site data.
55 LocalSharedObjectsContainer allowed_local_shared_objects_
;
56 LocalSharedObjectsContainer blocked_local_shared_objects_
;
58 DISALLOW_COPY_AND_ASSIGN(ChromeContentSettingsClient
);
61 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_