| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options/cookies_view_handler.h" | 5 #include "chrome/browser/ui/webui/options/cookies_view_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" | 23 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" |
| 24 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" | 26 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" |
| 27 #include "content/public/browser/browser_context.h" | 27 #include "content/public/browser/browser_context.h" |
| 28 #include "content/public/browser/storage_partition.h" | 28 #include "content/public/browser/storage_partition.h" |
| 29 #include "content/public/browser/web_ui.h" | 29 #include "content/public/browser/web_ui.h" |
| 30 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 32 | 32 |
| 33 namespace fileapi { |
| 34 class FileSystemContext; |
| 35 } |
| 36 |
| 33 namespace options { | 37 namespace options { |
| 34 | 38 |
| 35 CookiesViewHandler::CookiesViewHandler() | 39 CookiesViewHandler::CookiesViewHandler() |
| 36 : batch_update_(false), | 40 : batch_update_(false), |
| 37 app_context_(false), | 41 app_context_(false), |
| 38 model_util_(new CookiesTreeModelUtil) { | 42 model_util_(new CookiesTreeModelUtil) { |
| 39 } | 43 } |
| 40 | 44 |
| 41 CookiesViewHandler::~CookiesViewHandler() { | 45 CookiesViewHandler::~CookiesViewHandler() { |
| 42 } | 46 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 191 } |
| 188 | 192 |
| 189 void CookiesViewHandler::EnsureCookiesTreeModelCreated() { | 193 void CookiesViewHandler::EnsureCookiesTreeModelCreated() { |
| 190 if (!app_context_ && !cookies_tree_model_.get()) { | 194 if (!app_context_ && !cookies_tree_model_.get()) { |
| 191 Profile* profile = Profile::FromWebUI(web_ui()); | 195 Profile* profile = Profile::FromWebUI(web_ui()); |
| 192 ContainerMap apps_map; | 196 ContainerMap apps_map; |
| 193 content::StoragePartition* storage_partition = | 197 content::StoragePartition* storage_partition = |
| 194 content::BrowserContext::GetDefaultStoragePartition(profile); | 198 content::BrowserContext::GetDefaultStoragePartition(profile); |
| 195 content::IndexedDBContext* indexed_db_context = | 199 content::IndexedDBContext* indexed_db_context = |
| 196 storage_partition->GetIndexedDBContext(); | 200 storage_partition->GetIndexedDBContext(); |
| 201 fileapi::FileSystemContext* file_system_context = |
| 202 storage_partition->GetFileSystemContext(); |
| 197 apps_map[std::string()] = new LocalDataContainer( | 203 apps_map[std::string()] = new LocalDataContainer( |
| 198 "Site Data", std::string(), | 204 "Site Data", std::string(), |
| 199 new BrowsingDataCookieHelper(profile->GetRequestContext()), | 205 new BrowsingDataCookieHelper(profile->GetRequestContext()), |
| 200 new BrowsingDataDatabaseHelper(profile), | 206 new BrowsingDataDatabaseHelper(profile), |
| 201 new BrowsingDataLocalStorageHelper(profile), | 207 new BrowsingDataLocalStorageHelper(profile), |
| 202 NULL, | 208 NULL, |
| 203 new BrowsingDataAppCacheHelper(profile), | 209 new BrowsingDataAppCacheHelper(profile), |
| 204 BrowsingDataIndexedDBHelper::Create(indexed_db_context), | 210 BrowsingDataIndexedDBHelper::Create(indexed_db_context), |
| 205 BrowsingDataFileSystemHelper::Create(profile), | 211 BrowsingDataFileSystemHelper::Create(file_system_context), |
| 206 BrowsingDataQuotaHelper::Create(profile), | 212 BrowsingDataQuotaHelper::Create(profile), |
| 207 BrowsingDataServerBoundCertHelper::Create(profile), | 213 BrowsingDataServerBoundCertHelper::Create(profile), |
| 208 BrowsingDataFlashLSOHelper::Create(profile)); | 214 BrowsingDataFlashLSOHelper::Create(profile)); |
| 209 cookies_tree_model_.reset( | 215 cookies_tree_model_.reset( |
| 210 new CookiesTreeModel(apps_map, | 216 new CookiesTreeModel(apps_map, |
| 211 profile->GetExtensionSpecialStoragePolicy(), | 217 profile->GetExtensionSpecialStoragePolicy(), |
| 212 false)); | 218 false)); |
| 213 cookies_tree_model_->AddCookiesTreeObserver(this); | 219 cookies_tree_model_->AddCookiesTreeObserver(this); |
| 214 } | 220 } |
| 215 | 221 |
| 216 if (app_context_ && !app_cookies_tree_model_.get()) { | 222 if (app_context_ && !app_cookies_tree_model_.get()) { |
| 217 Profile* profile = Profile::FromWebUI(web_ui()); | 223 Profile* profile = Profile::FromWebUI(web_ui()); |
| 218 ContainerMap apps_map; | 224 ContainerMap apps_map; |
| 219 const ExtensionService* service = profile->GetExtensionService(); | 225 const ExtensionService* service = profile->GetExtensionService(); |
| 220 if (service) { | 226 if (service) { |
| 221 const ExtensionSet* extensions = service->extensions(); | 227 const ExtensionSet* extensions = service->extensions(); |
| 222 for (ExtensionSet::const_iterator it = extensions->begin(); | 228 for (ExtensionSet::const_iterator it = extensions->begin(); |
| 223 it != extensions->end(); ++it) { | 229 it != extensions->end(); ++it) { |
| 224 if ((*it)->is_storage_isolated()) { | 230 if ((*it)->is_storage_isolated()) { |
| 225 net::URLRequestContextGetter* context_getter = | 231 net::URLRequestContextGetter* context_getter = |
| 226 profile->GetRequestContextForIsolatedApp((*it)->id()); | 232 profile->GetRequestContextForStoragePartition((*it)->id()); |
| 227 // TODO(nasko): When new types of storage are isolated, add the | 233 // TODO(nasko): When new types of storage are isolated, add the |
| 228 // appropriate browsing data helper objects to the constructor. | 234 // appropriate browsing data helper objects to the constructor. |
| 229 // For now, just cookies are isolated, so other parameters are NULL. | 235 // For now, just cookies are isolated, so other parameters are NULL. |
| 230 apps_map[(*it)->id()] = new LocalDataContainer( | 236 apps_map[(*it)->id()] = new LocalDataContainer( |
| 231 (*it)->name(), (*it)->id(), | 237 (*it)->name(), (*it)->id(), |
| 232 new BrowsingDataCookieHelper(context_getter), | 238 new BrowsingDataCookieHelper(context_getter), |
| 233 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 239 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 234 } | 240 } |
| 235 } | 241 } |
| 236 app_cookies_tree_model_.reset( | 242 app_cookies_tree_model_.reset( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 std::string CookiesViewHandler::GetCallback( | 327 std::string CookiesViewHandler::GetCallback( |
| 322 std::string method, CookiesTreeModel* model) { | 328 std::string method, CookiesTreeModel* model) { |
| 323 std::string callback("CookiesView"); | 329 std::string callback("CookiesView"); |
| 324 | 330 |
| 325 if (model == app_cookies_tree_model_) | 331 if (model == app_cookies_tree_model_) |
| 326 callback.append("App"); | 332 callback.append("App"); |
| 327 return callback.append(".").append(method); | 333 return callback.append(".").append(method); |
| 328 } | 334 } |
| 329 | 335 |
| 330 } // namespace options | 336 } // namespace options |
| OLD | NEW |