| 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_local_storage_helper.h" | 14 #include "chrome/browser/browsing_data_local_storage_helper.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" | 16 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" |
| 16 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 17 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 | 20 |
| 20 CookiesViewHandler::CookiesViewHandler() : batch_update_(false) { | 21 CookiesViewHandler::CookiesViewHandler() : batch_update_(false) { |
| 21 } | 22 } |
| 22 | 23 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 { "cookie_local_storage", IDS_COOKIES_LOCAL_STORAGE }, | 60 { "cookie_local_storage", IDS_COOKIES_LOCAL_STORAGE }, |
| 60 { "cookie_app_cache", IDS_COOKIES_APPLICATION_CACHE }, | 61 { "cookie_app_cache", IDS_COOKIES_APPLICATION_CACHE }, |
| 61 { "search_cookies", IDS_COOKIES_SEARCH_COOKIES }, | 62 { "search_cookies", IDS_COOKIES_SEARCH_COOKIES }, |
| 62 { "remove_cookie", IDS_COOKIES_REMOVE_LABEL }, | 63 { "remove_cookie", IDS_COOKIES_REMOVE_LABEL }, |
| 63 { "remove_all_cookie", IDS_COOKIES_REMOVE_ALL_LABEL }, | 64 { "remove_all_cookie", IDS_COOKIES_REMOVE_ALL_LABEL }, |
| 64 { "cookie_file_system", IDS_COOKIES_FILE_SYSTEM }, | 65 { "cookie_file_system", IDS_COOKIES_FILE_SYSTEM }, |
| 65 { "label_file_system_origin", IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL }, | 66 { "label_file_system_origin", IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL }, |
| 66 { "label_file_system_temporary_usage", | 67 { "label_file_system_temporary_usage", |
| 67 IDS_COOKIES_FILE_SYSTEM_TEMPORARY_USAGE_LABEL }, | 68 IDS_COOKIES_FILE_SYSTEM_TEMPORARY_USAGE_LABEL }, |
| 68 { "label_file_system_persistent_usage", | 69 { "label_file_system_persistent_usage", |
| 69 IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL } | 70 IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL }, |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 RegisterStrings(localized_strings, resources, arraysize(resources)); | 73 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 73 RegisterTitle(localized_strings, "cookiesViewPage", | 74 RegisterTitle(localized_strings, "cookiesViewPage", |
| 74 IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); | 75 IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void CookiesViewHandler::RegisterMessages() { | 78 void CookiesViewHandler::RegisterMessages() { |
| 78 web_ui_->RegisterMessageCallback("updateCookieSearchResults", | 79 web_ui_->RegisterMessageCallback("updateCookieSearchResults", |
| 79 NewCallback(this, &CookiesViewHandler::UpdateSearchResults)); | 80 NewCallback(this, &CookiesViewHandler::UpdateSearchResults)); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 Profile* profile = web_ui_->GetProfile(); | 145 Profile* profile = web_ui_->GetProfile(); |
| 145 cookies_tree_model_.reset(new CookiesTreeModel( | 146 cookies_tree_model_.reset(new CookiesTreeModel( |
| 146 profile->GetRequestContext()->DONTUSEME_GetCookieStore()-> | 147 profile->GetRequestContext()->DONTUSEME_GetCookieStore()-> |
| 147 GetCookieMonster(), | 148 GetCookieMonster(), |
| 148 new BrowsingDataDatabaseHelper(profile), | 149 new BrowsingDataDatabaseHelper(profile), |
| 149 new BrowsingDataLocalStorageHelper(profile), | 150 new BrowsingDataLocalStorageHelper(profile), |
| 150 NULL, | 151 NULL, |
| 151 new BrowsingDataAppCacheHelper(profile), | 152 new BrowsingDataAppCacheHelper(profile), |
| 152 BrowsingDataIndexedDBHelper::Create(profile), | 153 BrowsingDataIndexedDBHelper::Create(profile), |
| 153 BrowsingDataFileSystemHelper::Create(profile), | 154 BrowsingDataFileSystemHelper::Create(profile), |
| 155 BrowsingDataQuotaHelper::Create(profile), |
| 154 false)); | 156 false)); |
| 155 cookies_tree_model_->AddCookiesTreeObserver(this); | 157 cookies_tree_model_->AddCookiesTreeObserver(this); |
| 156 } | 158 } |
| 157 } | 159 } |
| 158 | 160 |
| 159 void CookiesViewHandler::UpdateSearchResults(const ListValue* args) { | 161 void CookiesViewHandler::UpdateSearchResults(const ListValue* args) { |
| 160 std::string query; | 162 std::string query; |
| 161 if (!args->GetString(0, &query)) { | 163 if (!args->GetString(0, &query)) { |
| 162 return; | 164 return; |
| 163 } | 165 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 children); | 208 children); |
| 207 | 209 |
| 208 ListValue args; | 210 ListValue args; |
| 209 args.Append(parent == cookies_tree_model_->GetRoot() ? | 211 args.Append(parent == cookies_tree_model_->GetRoot() ? |
| 210 Value::CreateNullValue() : | 212 Value::CreateNullValue() : |
| 211 Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId(parent))); | 213 Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId(parent))); |
| 212 args.Append(children); | 214 args.Append(children); |
| 213 | 215 |
| 214 web_ui_->CallJavascriptFunction("CookiesView.loadChildren", args); | 216 web_ui_->CallJavascriptFunction("CookiesView.loadChildren", args); |
| 215 } | 217 } |
| OLD | NEW |