Chromium Code Reviews| 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" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 14 #include "chrome/common/extensions/extension_set.h" | 14 #include "chrome/common/extensions/extension_set.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 15 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
| 16 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 17 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
| 18 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
| 19 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" | 19 #include "chrome/browser/browsing_data/browsing_data_flash_lso_helper.h" |
| 20 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 20 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
| 21 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 21 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
| 22 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" | 22 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" |
| 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" | |
| 28 #include "content/public/browser/storage_partition.h" | |
| 29 #include "content/public/browser/web_contents.h" | |
| 27 #include "content/public/browser/web_ui.h" | 30 #include "content/public/browser/web_ui.h" |
| 28 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| 30 | 33 |
| 31 namespace options { | 34 namespace options { |
| 32 | 35 |
| 33 CookiesViewHandler::CookiesViewHandler() | 36 CookiesViewHandler::CookiesViewHandler() |
| 34 : batch_update_(false), | 37 : batch_update_(false), |
| 35 app_context_(false), | 38 app_context_(false), |
| 36 model_util_(new CookiesTreeModelUtil) { | 39 model_util_(new CookiesTreeModelUtil) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 DCHECK(batch_update_); | 184 DCHECK(batch_update_); |
| 182 batch_update_ = false; | 185 batch_update_ = false; |
| 183 | 186 |
| 184 SendChildren(model->GetRoot()); | 187 SendChildren(model->GetRoot()); |
| 185 } | 188 } |
| 186 | 189 |
| 187 void CookiesViewHandler::EnsureCookiesTreeModelCreated() { | 190 void CookiesViewHandler::EnsureCookiesTreeModelCreated() { |
| 188 if (!app_context_ && !cookies_tree_model_.get()) { | 191 if (!app_context_ && !cookies_tree_model_.get()) { |
| 189 Profile* profile = Profile::FromWebUI(web_ui()); | 192 Profile* profile = Profile::FromWebUI(web_ui()); |
| 190 ContainerMap apps_map; | 193 ContainerMap apps_map; |
| 194 content::StoragePartition* storage_partition = | |
| 195 content::BrowserContext::GetDefaultStoragePartition(profile); | |
| 196 content::IndexedDBContext* indexed_db_context = | |
| 197 storage_partition->GetIndexedDBContext(); | |
|
Charlie Reis
2012/09/15 00:55:58
nit: wrong indent
awong
2012/09/15 01:19:37
Done.
| |
| 191 apps_map[std::string()] = new LocalDataContainer( | 198 apps_map[std::string()] = new LocalDataContainer( |
| 192 "Site Data", std::string(), | 199 "Site Data", std::string(), |
| 193 new BrowsingDataCookieHelper(profile->GetRequestContext()), | 200 new BrowsingDataCookieHelper(profile->GetRequestContext()), |
| 194 new BrowsingDataDatabaseHelper(profile), | 201 new BrowsingDataDatabaseHelper(profile), |
| 195 new BrowsingDataLocalStorageHelper(profile), | 202 new BrowsingDataLocalStorageHelper(profile), |
| 196 NULL, | 203 NULL, |
| 197 new BrowsingDataAppCacheHelper(profile), | 204 new BrowsingDataAppCacheHelper(profile), |
| 198 BrowsingDataIndexedDBHelper::Create(profile), | 205 BrowsingDataIndexedDBHelper::Create(indexed_db_context), |
| 199 BrowsingDataFileSystemHelper::Create(profile), | 206 BrowsingDataFileSystemHelper::Create(profile), |
| 200 BrowsingDataQuotaHelper::Create(profile), | 207 BrowsingDataQuotaHelper::Create(profile), |
| 201 BrowsingDataServerBoundCertHelper::Create(profile), | 208 BrowsingDataServerBoundCertHelper::Create(profile), |
| 202 BrowsingDataFlashLSOHelper::Create(profile)); | 209 BrowsingDataFlashLSOHelper::Create(profile)); |
| 203 cookies_tree_model_.reset( | 210 cookies_tree_model_.reset( |
| 204 new CookiesTreeModel(apps_map, | 211 new CookiesTreeModel(apps_map, |
| 205 profile->GetExtensionSpecialStoragePolicy(), | 212 profile->GetExtensionSpecialStoragePolicy(), |
| 206 false)); | 213 false)); |
| 207 cookies_tree_model_->AddCookiesTreeObserver(this); | 214 cookies_tree_model_->AddCookiesTreeObserver(this); |
| 208 } | 215 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 std::string CookiesViewHandler::GetCallback( | 322 std::string CookiesViewHandler::GetCallback( |
| 316 std::string method, CookiesTreeModel* model) { | 323 std::string method, CookiesTreeModel* model) { |
| 317 std::string callback("CookiesView"); | 324 std::string callback("CookiesView"); |
| 318 | 325 |
| 319 if (model == app_cookies_tree_model_) | 326 if (model == app_cookies_tree_model_) |
| 320 callback.append("App"); | 327 callback.append("App"); |
| 321 return callback.append(".").append(method); | 328 return callback.append(".").append(method); |
| 322 } | 329 } |
| 323 | 330 |
| 324 } // namespace options | 331 } // namespace options |
| OLD | NEW |