| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browsing_data_appcache_helper.h" | 9 #include "chrome/browser/browsing_data_appcache_helper.h" |
| 10 #include "chrome/browser/browsing_data_database_helper.h" | 10 #include "chrome/browser/browsing_data_database_helper.h" |
| 11 #include "chrome/browser/browsing_data_file_system_helper.h" | 11 #include "chrome/browser/browsing_data_file_system_helper.h" |
| 12 #include "chrome/browser/browsing_data_indexed_db_helper.h" | 12 #include "chrome/browser/browsing_data_indexed_db_helper.h" |
| 13 #include "chrome/browser/browsing_data_quota_helper.h" | 13 #include "chrome/browser/browsing_data_quota_helper.h" |
| 14 #include "chrome/browser/browsing_data_local_storage_helper.h" | 14 #include "chrome/browser/browsing_data_local_storage_helper.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" | 16 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" |
| 17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 18 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 | 21 |
| 21 CookiesViewHandler::CookiesViewHandler() : batch_update_(false) { | 22 CookiesViewHandler::CookiesViewHandler() : batch_update_(false) { |
| 22 } | 23 } |
| 23 | 24 |
| 24 CookiesViewHandler::~CookiesViewHandler() { | 25 CookiesViewHandler::~CookiesViewHandler() { |
| 25 } | 26 } |
| 26 | 27 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 136 |
| 136 void CookiesViewHandler::TreeModelEndBatch(CookiesTreeModel* model) { | 137 void CookiesViewHandler::TreeModelEndBatch(CookiesTreeModel* model) { |
| 137 DCHECK(batch_update_); | 138 DCHECK(batch_update_); |
| 138 batch_update_ = false; | 139 batch_update_ = false; |
| 139 | 140 |
| 140 SendChildren(cookies_tree_model_->GetRoot()); | 141 SendChildren(cookies_tree_model_->GetRoot()); |
| 141 } | 142 } |
| 142 | 143 |
| 143 void CookiesViewHandler::EnsureCookiesTreeModelCreated() { | 144 void CookiesViewHandler::EnsureCookiesTreeModelCreated() { |
| 144 if (!cookies_tree_model_.get()) { | 145 if (!cookies_tree_model_.get()) { |
| 145 Profile* profile = web_ui_->GetProfile(); | 146 Profile* profile = |
| 147 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()); |
| 146 cookies_tree_model_.reset(new CookiesTreeModel( | 148 cookies_tree_model_.reset(new CookiesTreeModel( |
| 147 profile->GetRequestContext()->DONTUSEME_GetCookieStore()-> | 149 profile->GetRequestContext()->DONTUSEME_GetCookieStore()-> |
| 148 GetCookieMonster(), | 150 GetCookieMonster(), |
| 149 new BrowsingDataDatabaseHelper(profile), | 151 new BrowsingDataDatabaseHelper(profile), |
| 150 new BrowsingDataLocalStorageHelper(profile), | 152 new BrowsingDataLocalStorageHelper(profile), |
| 151 NULL, | 153 NULL, |
| 152 new BrowsingDataAppCacheHelper(profile), | 154 new BrowsingDataAppCacheHelper(profile), |
| 153 BrowsingDataIndexedDBHelper::Create(profile), | 155 BrowsingDataIndexedDBHelper::Create(profile), |
| 154 BrowsingDataFileSystemHelper::Create(profile), | 156 BrowsingDataFileSystemHelper::Create(profile), |
| 155 BrowsingDataQuotaHelper::Create(profile), | 157 BrowsingDataQuotaHelper::Create(profile), |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 children); | 210 children); |
| 209 | 211 |
| 210 ListValue args; | 212 ListValue args; |
| 211 args.Append(parent == cookies_tree_model_->GetRoot() ? | 213 args.Append(parent == cookies_tree_model_->GetRoot() ? |
| 212 Value::CreateNullValue() : | 214 Value::CreateNullValue() : |
| 213 Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId(parent))); | 215 Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId(parent))); |
| 214 args.Append(children); | 216 args.Append(children); |
| 215 | 217 |
| 216 web_ui_->CallJavascriptFunction("CookiesView.loadChildren", args); | 218 web_ui_->CallJavascriptFunction("CookiesView.loadChildren", args); |
| 217 } | 219 } |
| OLD | NEW |