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 "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/cookies_tree_model.h" | 12 #include "chrome/browser/cookies_tree_model.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
15 #include "ui/base/text/bytes_formatting.h" | 15 #include "ui/base/text/bytes_formatting.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 static const char kKeyId[] = "id"; | 19 static const char kKeyId[] = "id"; |
20 static const char kKeyTitle[] = "title"; | 20 static const char kKeyTitle[] = "title"; |
21 static const char kKeyIcon[] = "icon"; | 21 static const char kKeyIcon[] = "icon"; |
22 static const char kKeyType[] = "type"; | 22 static const char kKeyType[] = "type"; |
23 static const char kKeyHasChildren[] = "hasChildren"; | 23 static const char kKeyHasChildren[] = "hasChildren"; |
24 | 24 |
| 25 static const char kKeyAppId[] = "appId"; |
| 26 |
25 static const char kKeyName[] = "name"; | 27 static const char kKeyName[] = "name"; |
26 static const char kKeyContent[] = "content"; | 28 static const char kKeyContent[] = "content"; |
27 static const char kKeyDomain[] = "domain"; | 29 static const char kKeyDomain[] = "domain"; |
28 static const char kKeyPath[] = "path"; | 30 static const char kKeyPath[] = "path"; |
29 static const char kKeySendFor[] = "sendfor"; | 31 static const char kKeySendFor[] = "sendfor"; |
30 static const char kKeyAccessibleToScript[] = "accessibleToScript"; | 32 static const char kKeyAccessibleToScript[] = "accessibleToScript"; |
31 static const char kKeyDesc[] = "desc"; | 33 static const char kKeyDesc[] = "desc"; |
32 static const char kKeySize[] = "size"; | 34 static const char kKeySize[] = "size"; |
33 static const char kKeyOrigin[] = "origin"; | 35 static const char kKeyOrigin[] = "origin"; |
34 static const char kKeyManifest[] = "manifest"; | 36 static const char kKeyManifest[] = "manifest"; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, | 91 bool GetCookieTreeNodeDictionary(const CookieTreeNode& node, |
90 DictionaryValue* dict) { | 92 DictionaryValue* dict) { |
91 // Use node's address as an id for WebUI to look it up. | 93 // Use node's address as an id for WebUI to look it up. |
92 dict->SetString(kKeyId, PointerToHexString(&node)); | 94 dict->SetString(kKeyId, PointerToHexString(&node)); |
93 dict->SetString(kKeyTitle, node.GetTitle()); | 95 dict->SetString(kKeyTitle, node.GetTitle()); |
94 dict->SetBoolean(kKeyHasChildren, !node.empty()); | 96 dict->SetBoolean(kKeyHasChildren, !node.empty()); |
95 | 97 |
96 switch (node.GetDetailedInfo().node_type) { | 98 switch (node.GetDetailedInfo().node_type) { |
97 case CookieTreeNode::DetailedInfo::TYPE_ORIGIN: { | 99 case CookieTreeNode::DetailedInfo::TYPE_ORIGIN: { |
98 dict->SetString(kKeyType, "origin"); | 100 dict->SetString(kKeyType, "origin"); |
| 101 dict->SetString(kKeyAppId, node.GetDetailedInfo().app_id); |
99 #if defined(OS_MACOSX) | 102 #if defined(OS_MACOSX) |
100 dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); | 103 dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); |
101 #endif | 104 #endif |
102 break; | 105 break; |
103 } | 106 } |
104 case CookieTreeNode::DetailedInfo::TYPE_COOKIE: { | 107 case CookieTreeNode::DetailedInfo::TYPE_COOKIE: { |
105 dict->SetString(kKeyType, "cookie"); | 108 dict->SetString(kKeyType, "cookie"); |
106 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_ICON"); | 109 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_ICON"); |
107 | 110 |
108 const net::CookieMonster::CanonicalCookie& cookie = | 111 const net::CookieMonster::CanonicalCookie& cookie = |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 if (child_index == -1) | 294 if (child_index == -1) |
292 break; | 295 break; |
293 | 296 |
294 parent = child; | 297 parent = child; |
295 } | 298 } |
296 | 299 |
297 return child_index >= 0 ? child : NULL; | 300 return child_index >= 0 ? child : NULL; |
298 } | 301 } |
299 | 302 |
300 } // namespace cookies_tree_model_util | 303 } // namespace cookies_tree_model_util |
OLD | NEW |