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