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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void TabSpecificContentSettings::OnContentAccessed(ContentSettingsType type) { | 86 void TabSpecificContentSettings::OnContentAccessed(ContentSettingsType type) { |
87 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) | 87 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) |
88 << "Geolocation settings handled by OnGeolocationPermissionSet"; | 88 << "Geolocation settings handled by OnGeolocationPermissionSet"; |
89 if (!content_accessed_[type]) { | 89 if (!content_accessed_[type]) { |
90 content_accessed_[type] = true; | 90 content_accessed_[type] = true; |
91 if (delegate_) | 91 if (delegate_) |
92 delegate_->OnContentSettingsAccessed(false); | 92 delegate_->OnContentSettingsAccessed(false); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
| 96 void TabSpecificContentSettings::OnCookiesRead( |
| 97 const GURL& url, |
| 98 const net::CookieMonster::CookieList& cookie_list, |
| 99 bool blocked_by_policy) { |
| 100 LocalSharedObjectsContainer& container = blocked_by_policy ? |
| 101 blocked_local_shared_objects_ : allowed_local_shared_objects_; |
| 102 typedef net::CookieMonster::CookieList::const_iterator cookie_iterator; |
| 103 for (cookie_iterator cookie = cookie_list.begin(); |
| 104 cookie != cookie_list.end(); ++cookie) { |
| 105 container.cookies()->SetCookieWithDetails(url, |
| 106 cookie->Name(), |
| 107 cookie->Value(), |
| 108 cookie->Domain(), |
| 109 cookie->Path(), |
| 110 cookie->ExpiryDate(), |
| 111 cookie->IsSecure(), |
| 112 cookie->IsHttpOnly()); |
| 113 } |
| 114 if (blocked_by_policy) |
| 115 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); |
| 116 else |
| 117 OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 118 } |
| 119 |
96 void TabSpecificContentSettings::OnCookieAccessed( | 120 void TabSpecificContentSettings::OnCookieAccessed( |
97 const GURL& url, const std::string& cookie_line, bool blocked_by_policy) { | 121 const GURL& url, const std::string& cookie_line, bool blocked_by_policy) { |
98 net::CookieOptions options; | 122 net::CookieOptions options; |
99 options.set_include_httponly(); | 123 options.set_include_httponly(); |
100 if (blocked_by_policy) { | 124 if (blocked_by_policy) { |
101 blocked_local_shared_objects_.cookies()->SetCookieWithOptions( | 125 blocked_local_shared_objects_.cookies()->SetCookieWithOptions( |
102 url, cookie_line, options); | 126 url, cookie_line, options); |
103 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 127 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); |
104 } else { | 128 } else { |
105 allowed_local_shared_objects_.cookies()->SetCookieWithOptions( | 129 allowed_local_shared_objects_.cookies()->SetCookieWithOptions( |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 283 |
260 CookiesTreeModel* | 284 CookiesTreeModel* |
261 TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() { | 285 TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() { |
262 return new CookiesTreeModel(cookies_, | 286 return new CookiesTreeModel(cookies_, |
263 databases_, | 287 databases_, |
264 local_storages_, | 288 local_storages_, |
265 session_storages_, | 289 session_storages_, |
266 appcaches_, | 290 appcaches_, |
267 indexed_dbs_); | 291 indexed_dbs_); |
268 } | 292 } |
OLD | NEW |