| 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  | 
 |   34 namespace fileapi { | 
 |   35 class FileSystemContext; | 
 |   36 } | 
 |   37  | 
|   31 namespace options { |   38 namespace options { | 
|   32  |   39  | 
|   33 CookiesViewHandler::CookiesViewHandler() |   40 CookiesViewHandler::CookiesViewHandler() | 
|   34   : batch_update_(false), |   41   : batch_update_(false), | 
|   35     app_context_(false), |   42     app_context_(false), | 
|   36     model_util_(new CookiesTreeModelUtil) { |   43     model_util_(new CookiesTreeModelUtil) { | 
|   37 } |   44 } | 
|   38  |   45  | 
|   39 CookiesViewHandler::~CookiesViewHandler() { |   46 CookiesViewHandler::~CookiesViewHandler() { | 
|   40 } |   47 } | 
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  181   DCHECK(batch_update_); |  188   DCHECK(batch_update_); | 
|  182   batch_update_ = false; |  189   batch_update_ = false; | 
|  183  |  190  | 
|  184   SendChildren(model->GetRoot()); |  191   SendChildren(model->GetRoot()); | 
|  185 } |  192 } | 
|  186  |  193  | 
|  187 void CookiesViewHandler::EnsureCookiesTreeModelCreated() { |  194 void CookiesViewHandler::EnsureCookiesTreeModelCreated() { | 
|  188   if (!app_context_ && !cookies_tree_model_.get()) { |  195   if (!app_context_ && !cookies_tree_model_.get()) { | 
|  189     Profile* profile = Profile::FromWebUI(web_ui()); |  196     Profile* profile = Profile::FromWebUI(web_ui()); | 
|  190     ContainerMap apps_map; |  197     ContainerMap apps_map; | 
 |  198     fileapi::FileSystemContext* file_system_context = | 
 |  199         content::BrowserContext::GetDefaultStoragePartition(profile)-> | 
 |  200             GetFileSystemContext(); | 
|  191     apps_map[std::string()] = new LocalDataContainer( |  201     apps_map[std::string()] = new LocalDataContainer( | 
|  192         "Site Data", std::string(), |  202         "Site Data", std::string(), | 
|  193         new BrowsingDataCookieHelper(profile->GetRequestContext()), |  203         new BrowsingDataCookieHelper(profile->GetRequestContext()), | 
|  194         new BrowsingDataDatabaseHelper(profile), |  204         new BrowsingDataDatabaseHelper(profile), | 
|  195         new BrowsingDataLocalStorageHelper(profile), |  205         new BrowsingDataLocalStorageHelper(profile), | 
|  196         NULL, |  206         NULL, | 
|  197         new BrowsingDataAppCacheHelper(profile), |  207         new BrowsingDataAppCacheHelper(profile), | 
|  198         BrowsingDataIndexedDBHelper::Create(profile), |  208         BrowsingDataIndexedDBHelper::Create(profile), | 
|  199         BrowsingDataFileSystemHelper::Create(profile), |  209         BrowsingDataFileSystemHelper::Create(file_system_context), | 
|  200         BrowsingDataQuotaHelper::Create(profile), |  210         BrowsingDataQuotaHelper::Create(profile), | 
|  201         BrowsingDataServerBoundCertHelper::Create(profile), |  211         BrowsingDataServerBoundCertHelper::Create(profile), | 
|  202         BrowsingDataFlashLSOHelper::Create(profile)); |  212         BrowsingDataFlashLSOHelper::Create(profile)); | 
|  203     cookies_tree_model_.reset( |  213     cookies_tree_model_.reset( | 
|  204         new CookiesTreeModel(apps_map, |  214         new CookiesTreeModel(apps_map, | 
|  205                              profile->GetExtensionSpecialStoragePolicy(), |  215                              profile->GetExtensionSpecialStoragePolicy(), | 
|  206                              false)); |  216                              false)); | 
|  207     cookies_tree_model_->AddCookiesTreeObserver(this); |  217     cookies_tree_model_->AddCookiesTreeObserver(this); | 
|  208   } |  218   } | 
|  209  |  219  | 
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  315 std::string CookiesViewHandler::GetCallback( |  325 std::string CookiesViewHandler::GetCallback( | 
|  316      std::string method, CookiesTreeModel* model) { |  326      std::string method, CookiesTreeModel* model) { | 
|  317   std::string callback("CookiesView"); |  327   std::string callback("CookiesView"); | 
|  318  |  328  | 
|  319   if (model == app_cookies_tree_model_) |  329   if (model == app_cookies_tree_model_) | 
|  320     callback.append("App"); |  330     callback.append("App"); | 
|  321   return callback.append(".").append(method); |  331   return callback.append(".").append(method); | 
|  322 } |  332 } | 
|  323  |  333  | 
|  324 }  // namespace options |  334 }  // namespace options | 
| OLD | NEW |