Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / content_settings / chrome_content_settings_client.cc
blob40c49f75a35dd033fe52734dda64bc1df0724184
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() {
13 void ChromeContentSettingsClient::OnCookiesRead(
14 const GURL& url,
15 const GURL& first_party_url,
16 const net::CookieList& cookie_list,
17 bool blocked_by_policy) {
18 // TODO(vabr): This is just a dummy implementation, replace with methods from
19 // TabSpecificContentSettings.
22 void ChromeContentSettingsClient::OnCookieChanged(
23 const GURL& url,
24 const GURL& first_party_url,
25 const std::string& cookie_line,
26 const net::CookieOptions& options,
27 bool blocked_by_policy) {
28 // TODO(vabr): This is just a dummy implementation, replace with methods from
29 // TabSpecificContentSettings.
32 void ChromeContentSettingsClient::OnFileSystemAccessed(const GURL& url,
33 bool blocked_by_policy) {
34 // TODO(vabr): This is just a dummy implementation, replace with methods from
35 // TabSpecificContentSettings.
38 void ChromeContentSettingsClient::OnIndexedDBAccessed(
39 const GURL& url,
40 const base::string16& description,
41 bool blocked_by_policy) {
42 // TODO(vabr): This is just a dummy implementation, replace with methods from
43 // TabSpecificContentSettings.
46 void ChromeContentSettingsClient::OnLocalStorageAccessed(
47 const GURL& url,
48 bool local,
49 bool blocked_by_policy) {
50 // TODO(vabr): This is just a dummy implementation, replace with methods from
51 // TabSpecificContentSettings.
54 void ChromeContentSettingsClient::OnWebDatabaseAccessed(
55 const GURL& url,
56 const base::string16& name,
57 const base::string16& display_name,
58 bool blocked_by_policy) {
59 // TODO(vabr): This is just a dummy implementation, replace with methods from
60 // TabSpecificContentSettings.
63 const LocalSharedObjectsCounter&
64 ChromeContentSettingsClient::local_shared_objects(AccessType type) const {
65 switch (type) {
66 case ALLOWED:
67 return allowed_local_shared_objects_;
68 case BLOCKED:
69 return blocked_local_shared_objects_;
71 // Some compilers don't believe this is not reachable, so let's return a dummy
72 // value.
73 NOTREACHED();
74 return blocked_local_shared_objects_;
77 scoped_ptr<CookiesTreeModel>
78 ChromeContentSettingsClient::CreateCookiesTreeModel(AccessType type) const {
79 switch (type) {
80 case ALLOWED:
81 return allowed_local_shared_objects_.CreateCookiesTreeModel();
82 case BLOCKED:
83 return blocked_local_shared_objects_.CreateCookiesTreeModel();
85 // Some compilers don't believe this is not reachable, so let's return a dummy
86 // value.
87 NOTREACHED();
88 return scoped_ptr<CookiesTreeModel>();
91 ChromeContentSettingsClient::ChromeContentSettingsClient(
92 content::WebContents* contents)
93 : allowed_local_shared_objects_(
94 Profile::FromBrowserContext(contents->GetBrowserContext())),
95 blocked_local_shared_objects_(
96 Profile::FromBrowserContext(contents->GetBrowserContext())) {