| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/tab_contents/tab_specific_content_settings.h" | 5 #include "chrome/browser/tab_contents/tab_specific_content_settings.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browsing_data_appcache_helper.h" | 8 #include "chrome/browser/browsing_data_appcache_helper.h" |
| 9 #include "chrome/browser/browsing_data_database_helper.h" | 9 #include "chrome/browser/browsing_data_database_helper.h" |
| 10 #include "chrome/browser/browsing_data_indexed_db_helper.h" | 10 #include "chrome/browser/browsing_data_indexed_db_helper.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 void TabSpecificContentSettings::OnContentAccessed(ContentSettingsType type) { | 96 void TabSpecificContentSettings::OnContentAccessed(ContentSettingsType type) { |
| 97 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) | 97 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) |
| 98 << "Geolocation settings handled by OnGeolocationPermissionSet"; | 98 << "Geolocation settings handled by OnGeolocationPermissionSet"; |
| 99 if (!content_accessed_[type]) { | 99 if (!content_accessed_[type]) { |
| 100 content_accessed_[type] = true; | 100 content_accessed_[type] = true; |
| 101 if (delegate_) | 101 if (delegate_) |
| 102 delegate_->OnContentSettingsAccessed(false); | 102 delegate_->OnContentSettingsAccessed(false); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 void TabSpecificContentSettings::OnCookieAccessed( | 106 void TabSpecificContentSettings::OnCookiesRead( |
| 107 const GURL& url, |
| 108 const net::CookieList& cookie_list, |
| 109 bool blocked_by_policy) { |
| 110 LocalSharedObjectsContainer& container = blocked_by_policy ? |
| 111 blocked_local_shared_objects_ : allowed_local_shared_objects_; |
| 112 typedef net::CookieList::const_iterator cookie_iterator; |
| 113 for (cookie_iterator cookie = cookie_list.begin(); |
| 114 cookie != cookie_list.end(); ++cookie) { |
| 115 container.cookies()->SetCookieWithDetails(url, |
| 116 cookie->Name(), |
| 117 cookie->Value(), |
| 118 cookie->Domain(), |
| 119 cookie->Path(), |
| 120 cookie->ExpiryDate(), |
| 121 cookie->IsSecure(), |
| 122 cookie->IsHttpOnly()); |
| 123 } |
| 124 if (blocked_by_policy) |
| 125 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); |
| 126 else |
| 127 OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 128 } |
| 129 |
| 130 void TabSpecificContentSettings::OnCookieChanged( |
| 107 const GURL& url, | 131 const GURL& url, |
| 108 const std::string& cookie_line, | 132 const std::string& cookie_line, |
| 109 const net::CookieOptions& options, | 133 const net::CookieOptions& options, |
| 110 bool blocked_by_policy) { | 134 bool blocked_by_policy) { |
| 111 if (blocked_by_policy) { | 135 if (blocked_by_policy) { |
| 112 blocked_local_shared_objects_.cookies()->SetCookieWithOptions( | 136 blocked_local_shared_objects_.cookies()->SetCookieWithOptions( |
| 113 url, cookie_line, options); | 137 url, cookie_line, options); |
| 114 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 138 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); |
| 115 } else { | 139 } else { |
| 116 allowed_local_shared_objects_.cookies()->SetCookieWithOptions( | 140 allowed_local_shared_objects_.cookies()->SetCookieWithOptions( |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 297 |
| 274 CookiesTreeModel* | 298 CookiesTreeModel* |
| 275 TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() { | 299 TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() { |
| 276 return new CookiesTreeModel(cookies_, | 300 return new CookiesTreeModel(cookies_, |
| 277 databases_, | 301 databases_, |
| 278 local_storages_, | 302 local_storages_, |
| 279 session_storages_, | 303 session_storages_, |
| 280 appcaches_, | 304 appcaches_, |
| 281 indexed_dbs_); | 305 indexed_dbs_); |
| 282 } | 306 } |
| OLD | NEW |