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 net::CookieMonster* cookie_monster, | |
99 const net::CookieOptions& options, | |
100 bool blocked_by_policy) { | |
101 LocalSharedObjectsContainer& container = blocked_by_policy ? | |
102 blocked_local_shared_objects_ : allowed_local_shared_objects_; | |
103 net::CookieMonster::CookieList cookie_list = | |
104 cookie_monster->GetAllCookiesForURLWithOptions(url, options); | |
darin (slow to review)
2010/11/30 18:24:11
nit: indent by 4 spaces
darin (slow to review)
2010/11/30 18:24:11
it seems like the cookies that you fetch here coul
jochen (gone - plz use gerrit)
2010/12/03 16:02:32
Done.
| |
105 typedef net::CookieMonster::CookieList::const_iterator cookie_iterator; | |
106 for (cookie_iterator cookie = cookie_list.begin(); | |
107 cookie != cookie_list.end(); ++cookie) { | |
108 container.cookies()->SetCookieWithDetails(url, | |
109 cookie->Name(), | |
110 cookie->Value(), | |
111 cookie->Domain(), | |
112 cookie->Path(), | |
113 cookie->ExpiryDate(), | |
114 cookie->IsSecure(), | |
115 cookie->IsHttpOnly()); | |
116 } | |
117 if (blocked_by_policy) | |
118 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | |
119 else | |
120 OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES); | |
121 } | |
122 | |
96 void TabSpecificContentSettings::OnCookieAccessed( | 123 void TabSpecificContentSettings::OnCookieAccessed( |
97 const GURL& url, | 124 const GURL& url, |
98 const std::string& cookie_line, | 125 const std::string& cookie_line, |
99 const net::CookieOptions& options, | 126 const net::CookieOptions& options, |
100 bool blocked_by_policy) { | 127 bool blocked_by_policy) { |
101 if (blocked_by_policy) { | 128 if (blocked_by_policy) { |
102 blocked_local_shared_objects_.cookies()->SetCookieWithOptions( | 129 blocked_local_shared_objects_.cookies()->SetCookieWithOptions( |
103 url, cookie_line, options); | 130 url, cookie_line, options); |
104 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); | 131 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); |
105 } else { | 132 } else { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 | 287 |
261 CookiesTreeModel* | 288 CookiesTreeModel* |
262 TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() { | 289 TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() { |
263 return new CookiesTreeModel(cookies_, | 290 return new CookiesTreeModel(cookies_, |
264 databases_, | 291 databases_, |
265 local_storages_, | 292 local_storages_, |
266 session_storages_, | 293 session_storages_, |
267 appcaches_, | 294 appcaches_, |
268 indexed_dbs_); | 295 indexed_dbs_); |
269 } | 296 } |
OLD | NEW |