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/cookies_tree_model_util.h" | 5 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 16 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
17 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
18 #include "content/public/browser/indexed_db_context.h" | 18 #include "content/public/browser/indexed_db_context.h" |
19 #include "content/public/browser/service_worker_context.h" | 19 #include "content/public/browser/service_worker_context.h" |
20 #include "net/cookies/canonical_cookie.h" | 20 #include "net/cookies/canonical_cookie.h" |
21 #include "net/ssl/ssl_client_cert_type.h" | |
22 #include "storage/common/fileapi/file_system_types.h" | 21 #include "storage/common/fileapi/file_system_types.h" |
23 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/base/text/bytes_formatting.h" | 23 #include "ui/base/text/bytes_formatting.h" |
25 | 24 |
26 #if defined(ENABLE_EXTENSIONS) | 25 #if defined(ENABLE_EXTENSIONS) |
27 #include "extensions/common/extension_set.h" | 26 #include "extensions/common/extension_set.h" |
28 #endif | 27 #endif |
29 | 28 |
30 namespace { | 29 namespace { |
31 | 30 |
(...skipping 29 matching lines...) Expand all Loading... | |
61 const char kKeyTotalUsage[] = "totalUsage"; | 60 const char kKeyTotalUsage[] = "totalUsage"; |
62 const char kKeyTemporaryUsage[] = "temporaryUsage"; | 61 const char kKeyTemporaryUsage[] = "temporaryUsage"; |
63 const char kKeyPersistentUsage[] = "persistentUsage"; | 62 const char kKeyPersistentUsage[] = "persistentUsage"; |
64 | 63 |
65 const char kKeyCertType[] = "certType"; | 64 const char kKeyCertType[] = "certType"; |
66 | 65 |
67 const char kKeyScopes[] = "scopes"; | 66 const char kKeyScopes[] = "scopes"; |
68 | 67 |
69 const int64 kNegligibleUsage = 1024; // 1KiB | 68 const int64 kNegligibleUsage = 1024; // 1KiB |
70 | 69 |
71 std::string ClientCertTypeToString(net::SSLClientCertType type) { | |
72 switch (type) { | |
73 case net::CLIENT_CERT_RSA_SIGN: | |
74 return l10n_util::GetStringUTF8(IDS_CLIENT_CERT_RSA_SIGN); | |
75 case net::CLIENT_CERT_DSS_SIGN: | |
76 return l10n_util::GetStringUTF8(IDS_CLIENT_CERT_DSS_SIGN); | |
77 case net::CLIENT_CERT_ECDSA_SIGN: | |
78 return l10n_util::GetStringUTF8(IDS_CLIENT_CERT_ECDSA_SIGN); | |
79 default: | |
80 return base::IntToString(type); | |
81 } | |
82 } | |
83 | |
84 } // namespace | 70 } // namespace |
85 | 71 |
86 CookiesTreeModelUtil::CookiesTreeModelUtil() { | 72 CookiesTreeModelUtil::CookiesTreeModelUtil() { |
87 } | 73 } |
88 | 74 |
89 CookiesTreeModelUtil::~CookiesTreeModelUtil() { | 75 CookiesTreeModelUtil::~CookiesTreeModelUtil() { |
90 } | 76 } |
91 | 77 |
92 std::string CookiesTreeModelUtil::GetTreeNodeId(const CookieTreeNode* node) { | 78 std::string CookiesTreeModelUtil::GetTreeNodeId(const CookieTreeNode* node) { |
93 CookieTreeNodeMap::const_iterator iter = node_map_.find(node); | 79 CookieTreeNodeMap::const_iterator iter = node_map_.find(node); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 } | 237 } |
252 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: { | 238 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: { |
253 dict->SetString(kKeyType, "channel_id"); | 239 dict->SetString(kKeyType, "channel_id"); |
254 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_ICON"); | 240 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_ICON"); |
255 | 241 |
256 const net::ChannelIDStore::ChannelID& channel_id = | 242 const net::ChannelIDStore::ChannelID& channel_id = |
257 *node.GetDetailedInfo().channel_id; | 243 *node.GetDetailedInfo().channel_id; |
258 | 244 |
259 dict->SetString(kKeyServerId, channel_id.server_identifier()); | 245 dict->SetString(kKeyServerId, channel_id.server_identifier()); |
260 dict->SetString(kKeyCertType, | 246 dict->SetString(kKeyCertType, |
261 ClientCertTypeToString(net::CLIENT_CERT_ECDSA_SIGN)); | 247 l10n_util::GetStringUTF8(IDS_CLIENT_CERT_ECDSA_SIGN)); |
davidben
2015/05/12 00:22:04
Is there any reason to localize this? It's the str
Ryan Sleevi
2015/05/12 00:56:12
No clue. I suspect maybe they wanted to say "Ellip
davidben
2015/05/12 21:31:01
Looks like it's got translateable="false" anyway,
| |
262 dict->SetString(kKeyCreated, base::UTF16ToUTF8( | 248 dict->SetString(kKeyCreated, base::UTF16ToUTF8( |
263 base::TimeFormatFriendlyDateAndTime( | 249 base::TimeFormatFriendlyDateAndTime( |
264 channel_id.creation_time()))); | 250 channel_id.creation_time()))); |
265 break; | 251 break; |
266 } | 252 } |
267 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: { | 253 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: { |
268 dict->SetString(kKeyType, "service_worker"); | 254 dict->SetString(kKeyType, "service_worker"); |
269 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | 255 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); |
270 | 256 |
271 const content::ServiceWorkerUsageInfo& service_worker_info = | 257 const content::ServiceWorkerUsageInfo& service_worker_info = |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 child = id_map_.Lookup(node_id); | 333 child = id_map_.Lookup(node_id); |
348 child_index = parent->GetIndexOf(child); | 334 child_index = parent->GetIndexOf(child); |
349 if (child_index == -1) | 335 if (child_index == -1) |
350 break; | 336 break; |
351 | 337 |
352 parent = child; | 338 parent = child; |
353 } | 339 } |
354 | 340 |
355 return child_index >= 0 ? child : NULL; | 341 return child_index >= 0 ? child : NULL; |
356 } | 342 } |
OLD | NEW |