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 #include "chrome/browser/content_settings/chrome_content_settings_client.h" |
| 6 #include "chrome/browser/profiles/profile.h" |
| 7 |
| 8 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromeContentSettingsClient); |
| 9 |
| 10 ChromeContentSettingsClient::~ChromeContentSettingsClient() { |
| 11 } |
| 12 |
| 13 // static |
| 14 void ChromeContentSettingsClient::CreateForWebContents( |
| 15 content::WebContents* contents) { |
| 16 if (FromWebContents(contents)) |
| 17 return; |
| 18 |
| 19 contents->SetUserData(UserDataKey(), |
| 20 new ChromeContentSettingsClient(contents)); |
| 21 } |
| 22 |
| 23 void ChromeContentSettingsClient::OnCookiesRead( |
| 24 const GURL& url, |
| 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. |
| 30 } |
| 31 |
| 32 void ChromeContentSettingsClient::OnCookieChanged( |
| 33 const GURL& url, |
| 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. |
| 40 } |
| 41 |
| 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. |
| 46 } |
| 47 |
| 48 void ChromeContentSettingsClient::OnIndexedDBAccessed( |
| 49 const GURL& url, |
| 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. |
| 54 } |
| 55 |
| 56 void ChromeContentSettingsClient::OnLocalStorageAccessed( |
| 57 const GURL& url, |
| 58 bool local, |
| 59 bool blocked_by_policy) { |
| 60 // TODO(vabr): This is just a dummy implementation, replace with methods from |
| 61 // TabSpecificContentSettings. |
| 62 } |
| 63 |
| 64 void ChromeContentSettingsClient::OnWebDatabaseAccessed( |
| 65 const GURL& url, |
| 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. |
| 71 } |
| 72 |
| 73 const LocalSharedObjectsCounter& |
| 74 ChromeContentSettingsClient::local_shared_objects(AccessType type) const { |
| 75 switch (type) { |
| 76 case ALLOWED: |
| 77 return allowed_local_shared_objects_; |
| 78 case BLOCKED: |
| 79 return blocked_local_shared_objects_; |
| 80 } |
| 81 // Some compilers don't believe this is not reachable, so let's return a dummy |
| 82 // value. |
| 83 NOTREACHED(); |
| 84 return blocked_local_shared_objects_; |
| 85 } |
| 86 |
| 87 scoped_ptr<CookiesTreeModel> |
| 88 ChromeContentSettingsClient::CreateCookiesTreeModel(AccessType type) const { |
| 89 switch (type) { |
| 90 case ALLOWED: |
| 91 return allowed_local_shared_objects_.CreateCookiesTreeModel(); |
| 92 case BLOCKED: |
| 93 return blocked_local_shared_objects_.CreateCookiesTreeModel(); |
| 94 } |
| 95 // Some compilers don't believe this is not reachable, so let's return a dummy |
| 96 // value. |
| 97 NOTREACHED(); |
| 98 return scoped_ptr<CookiesTreeModel>(); |
| 99 } |
| 100 |
| 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())) { |
| 107 } |
OLD | NEW |