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 #include "chrome/browser/content_settings/chrome_content_settings_client.h"
6 #include "chrome/browser/profiles/profile.h"
8 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromeContentSettingsClient
);
10 ChromeContentSettingsClient::~ChromeContentSettingsClient() {
14 void ChromeContentSettingsClient::CreateForWebContents(
15 content::WebContents
* contents
) {
16 if (FromWebContents(contents
))
19 contents
->SetUserData(UserDataKey(),
20 new ChromeContentSettingsClient(contents
));
23 void ChromeContentSettingsClient::OnCookiesRead(
25 const GURL
& first_party_url
,
26 const net::CookieList
& cookie_list
,
27 bool blocked_by_policy
) {
28 // TODO(vabr): This is just a dummy implementation, replace with methods from
29 // TabSpecificContentSettings.
32 void ChromeContentSettingsClient::OnCookieChanged(
34 const GURL
& first_party_url
,
35 const std::string
& cookie_line
,
36 const net::CookieOptions
& options
,
37 bool blocked_by_policy
) {
38 // TODO(vabr): This is just a dummy implementation, replace with methods from
39 // TabSpecificContentSettings.
42 void ChromeContentSettingsClient::OnFileSystemAccessed(const GURL
& url
,
43 bool blocked_by_policy
) {
44 // TODO(vabr): This is just a dummy implementation, replace with methods from
45 // TabSpecificContentSettings.
48 void ChromeContentSettingsClient::OnIndexedDBAccessed(
50 const base::string16
& description
,
51 bool blocked_by_policy
) {
52 // TODO(vabr): This is just a dummy implementation, replace with methods from
53 // TabSpecificContentSettings.
56 void ChromeContentSettingsClient::OnLocalStorageAccessed(
59 bool blocked_by_policy
) {
60 // TODO(vabr): This is just a dummy implementation, replace with methods from
61 // TabSpecificContentSettings.
64 void ChromeContentSettingsClient::OnWebDatabaseAccessed(
66 const base::string16
& name
,
67 const base::string16
& display_name
,
68 bool blocked_by_policy
) {
69 // TODO(vabr): This is just a dummy implementation, replace with methods from
70 // TabSpecificContentSettings.
73 const LocalSharedObjectsCounter
&
74 ChromeContentSettingsClient::local_shared_objects(AccessType type
) const {
77 return allowed_local_shared_objects_
;
79 return blocked_local_shared_objects_
;
81 // Some compilers don't believe this is not reachable, so let's return a dummy
84 return blocked_local_shared_objects_
;
87 scoped_ptr
<CookiesTreeModel
>
88 ChromeContentSettingsClient::CreateCookiesTreeModel(AccessType type
) const {
91 return allowed_local_shared_objects_
.CreateCookiesTreeModel();
93 return blocked_local_shared_objects_
.CreateCookiesTreeModel();
95 // Some compilers don't believe this is not reachable, so let's return a dummy
98 return scoped_ptr
<CookiesTreeModel
>();
101 ChromeContentSettingsClient::ChromeContentSettingsClient(
102 content::WebContents
* contents
)
103 : allowed_local_shared_objects_(
104 Profile::FromBrowserContext(contents
->GetBrowserContext())),
105 blocked_local_shared_objects_(
106 Profile::FromBrowserContext(contents
->GetBrowserContext())) {