OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/options2/cookies_view_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/cookies_view_handler2.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL }, | 80 IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL }, |
81 { "cookie_server_bound_cert", IDS_COOKIES_SERVER_BOUND_CERT }, | 81 { "cookie_server_bound_cert", IDS_COOKIES_SERVER_BOUND_CERT }, |
82 { "label_server_bound_cert_server_id", | 82 { "label_server_bound_cert_server_id", |
83 IDS_COOKIES_SERVER_BOUND_CERT_ORIGIN_LABEL }, | 83 IDS_COOKIES_SERVER_BOUND_CERT_ORIGIN_LABEL }, |
84 { "label_server_bound_cert_type", | 84 { "label_server_bound_cert_type", |
85 IDS_COOKIES_SERVER_BOUND_CERT_TYPE_LABEL }, | 85 IDS_COOKIES_SERVER_BOUND_CERT_TYPE_LABEL }, |
86 { "label_server_bound_cert_created", | 86 { "label_server_bound_cert_created", |
87 IDS_COOKIES_SERVER_BOUND_CERT_CREATED_LABEL }, | 87 IDS_COOKIES_SERVER_BOUND_CERT_CREATED_LABEL }, |
88 { "label_server_bound_cert_expires", | 88 { "label_server_bound_cert_expires", |
89 IDS_COOKIES_SERVER_BOUND_CERT_EXPIRES_LABEL }, | 89 IDS_COOKIES_SERVER_BOUND_CERT_EXPIRES_LABEL }, |
| 90 { "label_protected_by_apps", |
| 91 IDS_GEOLOCATION_SET_BY_HOVER }, // TODO(bauerb): Use a better string |
90 }; | 92 }; |
91 | 93 |
92 RegisterStrings(localized_strings, resources, arraysize(resources)); | 94 RegisterStrings(localized_strings, resources, arraysize(resources)); |
93 RegisterTitle(localized_strings, "cookiesViewPage", | 95 RegisterTitle(localized_strings, "cookiesViewPage", |
94 IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); | 96 IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); |
95 } | 97 } |
96 | 98 |
97 void CookiesViewHandler::RegisterMessages() { | 99 void CookiesViewHandler::RegisterMessages() { |
98 web_ui()->RegisterMessageCallback("updateCookieSearchResults", | 100 web_ui()->RegisterMessageCallback("updateCookieSearchResults", |
99 base::Bind(&CookiesViewHandler::UpdateSearchResults, | 101 base::Bind(&CookiesViewHandler::UpdateSearchResults, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 cookies_tree_model_.reset(new CookiesTreeModel( | 171 cookies_tree_model_.reset(new CookiesTreeModel( |
170 new BrowsingDataCookieHelper(profile->GetRequestContext()), | 172 new BrowsingDataCookieHelper(profile->GetRequestContext()), |
171 new BrowsingDataDatabaseHelper(profile), | 173 new BrowsingDataDatabaseHelper(profile), |
172 new BrowsingDataLocalStorageHelper(profile), | 174 new BrowsingDataLocalStorageHelper(profile), |
173 NULL, | 175 NULL, |
174 new BrowsingDataAppCacheHelper(profile), | 176 new BrowsingDataAppCacheHelper(profile), |
175 BrowsingDataIndexedDBHelper::Create(profile), | 177 BrowsingDataIndexedDBHelper::Create(profile), |
176 BrowsingDataFileSystemHelper::Create(profile), | 178 BrowsingDataFileSystemHelper::Create(profile), |
177 BrowsingDataQuotaHelper::Create(profile), | 179 BrowsingDataQuotaHelper::Create(profile), |
178 BrowsingDataServerBoundCertHelper::Create(profile), | 180 BrowsingDataServerBoundCertHelper::Create(profile), |
| 181 profile->GetExtensionSpecialStoragePolicy(), |
179 false)); | 182 false)); |
180 cookies_tree_model_->AddCookiesTreeObserver(this); | 183 cookies_tree_model_->AddCookiesTreeObserver(this); |
181 } | 184 } |
182 } | 185 } |
183 | 186 |
184 void CookiesViewHandler::UpdateSearchResults(const ListValue* args) { | 187 void CookiesViewHandler::UpdateSearchResults(const ListValue* args) { |
185 std::string query; | 188 std::string query; |
186 if (!args->GetString(0, &query)) { | 189 if (!args->GetString(0, &query)) |
187 return; | 190 return; |
188 } | |
189 | 191 |
190 EnsureCookiesTreeModelCreated(); | 192 EnsureCookiesTreeModelCreated(); |
191 | 193 |
192 cookies_tree_model_->UpdateSearchResults(UTF8ToWide(query)); | 194 cookies_tree_model_->UpdateSearchResults(UTF8ToUTF16(query)); |
193 } | 195 } |
194 | 196 |
195 void CookiesViewHandler::RemoveAll(const ListValue* args) { | 197 void CookiesViewHandler::RemoveAll(const ListValue* args) { |
196 EnsureCookiesTreeModelCreated(); | 198 EnsureCookiesTreeModelCreated(); |
197 cookies_tree_model_->DeleteAllStoredObjects(); | 199 cookies_tree_model_->DeleteAllStoredObjects(); |
198 } | 200 } |
199 | 201 |
200 void CookiesViewHandler::Remove(const ListValue* args) { | 202 void CookiesViewHandler::Remove(const ListValue* args) { |
201 std::string node_path; | 203 std::string node_path; |
202 if (!args->GetString(0, &node_path)) { | 204 if (!args->GetString(0, &node_path)) |
203 return; | 205 return; |
204 } | |
205 | 206 |
206 EnsureCookiesTreeModelCreated(); | 207 EnsureCookiesTreeModelCreated(); |
207 | 208 |
208 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( | 209 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( |
209 cookies_tree_model_->GetRoot(), node_path); | 210 cookies_tree_model_->GetRoot(), node_path); |
210 if (node) | 211 if (node) |
211 cookies_tree_model_->DeleteCookieNode(const_cast<CookieTreeNode*>(node)); | 212 cookies_tree_model_->DeleteCookieNode(const_cast<CookieTreeNode*>(node)); |
212 } | 213 } |
213 | 214 |
214 void CookiesViewHandler::LoadChildren(const ListValue* args) { | 215 void CookiesViewHandler::LoadChildren(const ListValue* args) { |
215 std::string node_path; | 216 std::string node_path; |
216 if (!args->GetString(0, &node_path)) { | 217 if (!args->GetString(0, &node_path)) |
217 return; | 218 return; |
218 } | |
219 | 219 |
220 EnsureCookiesTreeModelCreated(); | 220 EnsureCookiesTreeModelCreated(); |
221 | 221 |
222 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( | 222 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( |
223 cookies_tree_model_->GetRoot(), node_path); | 223 cookies_tree_model_->GetRoot(), node_path); |
224 if (node) | 224 if (node) |
225 SendChildren(node); | 225 SendChildren(node); |
226 } | 226 } |
227 | 227 |
228 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { | 228 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { |
229 ListValue* children = new ListValue; | 229 ListValue* children = new ListValue; |
230 model_util_->GetChildNodeList(parent, 0, parent->child_count(), | 230 model_util_->GetChildNodeList(parent, 0, parent->child_count(), |
231 children); | 231 children); |
232 | 232 |
233 ListValue args; | 233 ListValue args; |
234 args.Append(parent == cookies_tree_model_->GetRoot() ? | 234 args.Append(parent == cookies_tree_model_->GetRoot() ? |
235 Value::CreateNullValue() : | 235 Value::CreateNullValue() : |
236 Value::CreateStringValue(model_util_->GetTreeNodeId(parent))); | 236 Value::CreateStringValue(model_util_->GetTreeNodeId(parent))); |
237 args.Append(children); | 237 args.Append(children); |
238 | 238 |
239 web_ui()->CallJavascriptFunction("CookiesView.loadChildren", args); | 239 web_ui()->CallJavascriptFunction("CookiesView.loadChildren", args); |
240 } | 240 } |
241 | 241 |
242 } // namespace options2 | 242 } // namespace options2 |
OLD | NEW |