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 }, |
| 71 { "usage_unavailable", IDS_COOKIES_USAGE_UNAVAILABLE } |
70 }; | 72 }; |
71 | 73 |
72 RegisterStrings(localized_strings, resources, arraysize(resources)); | 74 RegisterStrings(localized_strings, resources, arraysize(resources)); |
73 RegisterTitle(localized_strings, "cookiesViewPage", | 75 RegisterTitle(localized_strings, "cookiesViewPage", |
74 IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); | 76 IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); |
75 } | 77 } |
76 | 78 |
77 void CookiesViewHandler::RegisterMessages() { | 79 void CookiesViewHandler::RegisterMessages() { |
78 web_ui_->RegisterMessageCallback("updateCookieSearchResults", | 80 web_ui_->RegisterMessageCallback("updateCookieSearchResults", |
79 NewCallback(this, &CookiesViewHandler::UpdateSearchResults)); | 81 NewCallback(this, &CookiesViewHandler::UpdateSearchResults)); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 Profile* profile = web_ui_->GetProfile(); | 146 Profile* profile = web_ui_->GetProfile(); |
145 cookies_tree_model_.reset(new CookiesTreeModel( | 147 cookies_tree_model_.reset(new CookiesTreeModel( |
146 profile->GetRequestContext()->DONTUSEME_GetCookieStore()-> | 148 profile->GetRequestContext()->DONTUSEME_GetCookieStore()-> |
147 GetCookieMonster(), | 149 GetCookieMonster(), |
148 new BrowsingDataDatabaseHelper(profile), | 150 new BrowsingDataDatabaseHelper(profile), |
149 new BrowsingDataLocalStorageHelper(profile), | 151 new BrowsingDataLocalStorageHelper(profile), |
150 NULL, | 152 NULL, |
151 new BrowsingDataAppCacheHelper(profile), | 153 new BrowsingDataAppCacheHelper(profile), |
152 BrowsingDataIndexedDBHelper::Create(profile), | 154 BrowsingDataIndexedDBHelper::Create(profile), |
153 BrowsingDataFileSystemHelper::Create(profile), | 155 BrowsingDataFileSystemHelper::Create(profile), |
| 156 BrowsingDataQuotaHelper::Create(profile), |
154 false)); | 157 false)); |
155 cookies_tree_model_->AddCookiesTreeObserver(this); | 158 cookies_tree_model_->AddCookiesTreeObserver(this); |
156 } | 159 } |
157 } | 160 } |
158 | 161 |
159 void CookiesViewHandler::UpdateSearchResults(const ListValue* args) { | 162 void CookiesViewHandler::UpdateSearchResults(const ListValue* args) { |
160 std::string query; | 163 std::string query; |
161 if (!args->GetString(0, &query)) { | 164 if (!args->GetString(0, &query)) { |
162 return; | 165 return; |
163 } | 166 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 children); | 209 children); |
207 | 210 |
208 ListValue args; | 211 ListValue args; |
209 args.Append(parent == cookies_tree_model_->GetRoot() ? | 212 args.Append(parent == cookies_tree_model_->GetRoot() ? |
210 Value::CreateNullValue() : | 213 Value::CreateNullValue() : |
211 Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId(parent))); | 214 Value::CreateStringValue(cookies_tree_model_util::GetTreeNodeId(parent))); |
212 args.Append(children); | 215 args.Append(children); |
213 | 216 |
214 web_ui_->CallJavascriptFunction("CookiesView.loadChildren", args); | 217 web_ui_->CallJavascriptFunction("CookiesView.loadChildren", args); |
215 } | 218 } |
OLD | NEW |