Chromium Code Reviews| Index: chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc |
| diff --git a/chrome/browser/ui/webui/options/cookies_view_handler.cc b/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc |
| similarity index 64% |
| copy from chrome/browser/ui/webui/options/cookies_view_handler.cc |
| copy to chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc |
| index 0d2fb42c761dbca622dedafe79af2c43af2888a8..46333961d231f82314747f57bdc85935db2eb560 100644 |
| --- a/chrome/browser/ui/webui/options/cookies_view_handler.cc |
| +++ b/chrome/browser/ui/webui/settings/settings_cookies_view_handler.cc |
| @@ -1,8 +1,8 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|
michaelpg
2016/07/04 19:44:21
remove (c)
Finnur
2016/07/05 11:04:49
Done.
|
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/ui/webui/options/cookies_view_handler.h" |
| +#include "chrome/browser/ui/webui/settings/settings_cookies_view_handler.h" |
| #include <string> |
| #include <utility> |
| @@ -36,7 +36,7 @@ namespace storage { |
| class FileSystemContext; |
| } |
| -namespace options { |
| +namespace settings { |
| CookiesViewHandler::CookiesViewHandler() |
| : batch_update_(false), |
| @@ -46,75 +46,10 @@ CookiesViewHandler::CookiesViewHandler() |
| CookiesViewHandler::~CookiesViewHandler() { |
| } |
| -void CookiesViewHandler::GetLocalizedValues( |
| - base::DictionaryValue* localized_strings) { |
| - DCHECK(localized_strings); |
| - |
| - static OptionsStringResource resources[] = { |
| - {"label_cookie_name", IDS_COOKIES_COOKIE_NAME_LABEL}, |
| - {"label_cookie_content", IDS_COOKIES_COOKIE_CONTENT_LABEL}, |
| - {"label_cookie_domain", IDS_COOKIES_COOKIE_DOMAIN_LABEL}, |
| - {"label_cookie_path", IDS_COOKIES_COOKIE_PATH_LABEL}, |
| - {"label_cookie_send_for", IDS_COOKIES_COOKIE_SENDFOR_LABEL}, |
| - {"label_cookie_accessible_to_script", |
| - IDS_COOKIES_COOKIE_ACCESSIBLE_TO_SCRIPT_LABEL}, |
| - {"label_cookie_created", IDS_COOKIES_COOKIE_CREATED_LABEL}, |
| - {"label_cookie_expires", IDS_COOKIES_COOKIE_EXPIRES_LABEL}, |
| - {"label_webdb_desc", IDS_COOKIES_WEB_DATABASE_DESCRIPTION_LABEL}, |
| - {"label_local_storage_size", |
| - IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL}, |
| - {"label_local_storage_last_modified", |
| - IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL}, |
| - {"label_local_storage_origin", IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL}, |
| - {"label_indexed_db_size", IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL}, |
| - {"label_indexed_db_last_modified", |
| - IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL}, |
| - {"label_indexed_db_origin", IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL}, |
| - {"label_service_worker_origin", IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL}, |
| - {"label_service_worker_size", |
| - IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL}, |
| - {"label_service_worker_scopes", IDS_COOKIES_SERVICE_WORKER_SCOPES_LABEL}, |
| - {"label_cache_storage_origin", IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL}, |
| - {"label_cache_storage_size", |
| - IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL}, |
| - {"label_cache_storage_last_modified", |
| - IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL}, |
| - {"label_app_cache_manifest", |
| - IDS_COOKIES_APPLICATION_CACHE_MANIFEST_LABEL}, |
| - {"label_cookie_last_accessed", IDS_COOKIES_LAST_ACCESSED_LABEL}, |
| - {"cookie_domain", IDS_COOKIES_DOMAIN_COLUMN_HEADER}, |
| - {"cookie_local_data", IDS_COOKIES_DATA_COLUMN_HEADER}, |
| - {"cookie_singular", IDS_COOKIES_SINGLE_COOKIE}, |
| - {"cookie_plural", IDS_COOKIES_PLURAL_COOKIES}, |
| - {"cookie_database_storage", IDS_COOKIES_DATABASE_STORAGE}, |
| - {"cookie_indexed_db", IDS_COOKIES_INDEXED_DB}, |
| - {"cookie_local_storage", IDS_COOKIES_LOCAL_STORAGE}, |
| - {"cookie_app_cache", IDS_COOKIES_APPLICATION_CACHE}, |
| - {"cookie_service_worker", IDS_COOKIES_SERVICE_WORKER}, |
| - {"cookie_cache_storage", IDS_COOKIES_CACHE_STORAGE}, |
| - {"cookie_flash_lso", IDS_COOKIES_FLASH_LSO}, |
| - {"search_cookies", IDS_COOKIES_SEARCH_COOKIES}, |
| - {"remove_cookie", IDS_COOKIES_REMOVE_LABEL}, |
| - {"remove_all_cookie", IDS_COOKIES_REMOVE_ALL_LABEL}, |
| - {"remove_all_shown_cookie", IDS_COOKIES_REMOVE_ALL_SHOWN_LABEL}, |
| - {"cookie_file_system", IDS_COOKIES_FILE_SYSTEM}, |
| - {"label_file_system_origin", IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL}, |
| - {"label_file_system_temporary_usage", |
| - IDS_COOKIES_FILE_SYSTEM_TEMPORARY_USAGE_LABEL}, |
| - {"label_file_system_persistent_usage", |
| - IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL}, |
| - {"cookie_channel_id", IDS_COOKIES_CHANNEL_ID}, |
| - {"label_channel_id_server_id", IDS_COOKIES_CHANNEL_ID_ORIGIN_LABEL}, |
| - {"label_channel_id_type", IDS_COOKIES_CHANNEL_ID_TYPE_LABEL}, |
| - {"label_channel_id_created", IDS_COOKIES_CHANNEL_ID_CREATED_LABEL}, |
| - {"label_channel_id_expires", IDS_COOKIES_CHANNEL_ID_EXPIRES_LABEL}, |
| - {"label_protected_by_apps", |
| - IDS_GEOLOCATION_SET_BY_HOVER}, // TODO(bauerb): Use a better string |
| - }; |
| - |
| - RegisterStrings(localized_strings, resources, arraysize(resources)); |
| - RegisterTitle(localized_strings, "cookiesViewPage", |
| - IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); |
| +void CookiesViewHandler::OnJavascriptAllowed() { |
| +} |
| + |
| +void CookiesViewHandler::OnJavascriptDisallowed() { |
| } |
| void CookiesViewHandler::RegisterMessages() { |
| @@ -143,6 +78,8 @@ void CookiesViewHandler::TreeNodesAdded(ui::TreeModel* model, |
| if (batch_update_) |
| return; |
| + AllowJavascript(); |
| + |
| CookiesTreeModel* tree_model = static_cast<CookiesTreeModel*>(model); |
| CookieTreeNode* parent_node = tree_model->AsNode(parent); |
| @@ -156,7 +93,9 @@ void CookiesViewHandler::TreeNodesAdded(ui::TreeModel* model, |
| args.AppendString(model_util_->GetTreeNodeId(parent_node)); |
| args.AppendInteger(start); |
| args.Append(std::move(children)); |
| - web_ui()->CallJavascriptFunctionUnsafe("CookiesView.onTreeItemAdded", args); |
| + CallJavascriptFunction("cr.webUIListenerCallback", |
| + base::StringValue("onTreeItemAdded"), |
| + args); |
| } |
| void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, |
| @@ -167,6 +106,8 @@ void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, |
| if (batch_update_) |
| return; |
| + AllowJavascript(); |
| + |
| CookiesTreeModel* tree_model = static_cast<CookiesTreeModel*>(model); |
| base::ListValue args; |
| @@ -176,7 +117,9 @@ void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, |
| args.AppendString(model_util_->GetTreeNodeId(tree_model->AsNode(parent))); |
| args.AppendInteger(start); |
| args.AppendInteger(count); |
| - web_ui()->CallJavascriptFunctionUnsafe("CookiesView.onTreeItemRemoved", args); |
| + CallJavascriptFunction("cr.webUIListenerCallback", |
| + base::StringValue("onTreeItemRemoved"), |
| + args); |
| } |
| void CookiesViewHandler::TreeModelBeginBatch(CookiesTreeModel* model) { |
| @@ -266,6 +209,8 @@ void CookiesViewHandler::LoadChildren(const base::ListValue* args) { |
| } |
| void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { |
| + AllowJavascript(); |
| + |
| std::unique_ptr<base::ListValue> children(new base::ListValue); |
| model_util_->GetChildNodeList(parent, 0, parent->child_count(), |
| children.get()); |
| @@ -277,7 +222,9 @@ void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { |
| args.AppendString(model_util_->GetTreeNodeId(parent)); |
| args.Append(std::move(children)); |
| - web_ui()->CallJavascriptFunctionUnsafe("CookiesView.loadChildren", args); |
| + CallJavascriptFunction("cr.webUIListenerCallback", |
| + base::StringValue("loadChildren"), |
| + args); |
| } |
| void CookiesViewHandler::ReloadCookies(const base::ListValue* args) { |
| @@ -286,4 +233,4 @@ void CookiesViewHandler::ReloadCookies(const base::ListValue* args) { |
| EnsureCookiesTreeModelCreated(); |
| } |
| -} // namespace options |
| +} // namespace settings |