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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: { | 194 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: { |
195 dict->SetString(kKeyType, "file_system"); | 195 dict->SetString(kKeyType, "file_system"); |
196 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | 196 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); |
197 | 197 |
198 const BrowsingDataFileSystemHelper::FileSystemInfo& file_system_info = | 198 const BrowsingDataFileSystemHelper::FileSystemInfo& file_system_info = |
199 *node.GetDetailedInfo().file_system_info; | 199 *node.GetDetailedInfo().file_system_info; |
200 const storage::FileSystemType kPerm = storage::kFileSystemTypePersistent; | 200 const storage::FileSystemType kPerm = storage::kFileSystemTypePersistent; |
201 const storage::FileSystemType kTemp = storage::kFileSystemTypeTemporary; | 201 const storage::FileSystemType kTemp = storage::kFileSystemTypeTemporary; |
202 | 202 |
203 dict->SetString(kKeyOrigin, file_system_info.origin.spec()); | 203 dict->SetString(kKeyOrigin, file_system_info.origin.spec()); |
204 dict->SetString(kKeyPersistent, | 204 dict->SetString( |
205 ContainsKey(file_system_info.usage_map, kPerm) ? | 205 kKeyPersistent, |
206 base::UTF16ToUTF8(ui::FormatBytes( | 206 base::ContainsKey(file_system_info.usage_map, kPerm) |
207 file_system_info.usage_map.find(kPerm)->second)) : | 207 ? base::UTF16ToUTF8(ui::FormatBytes( |
208 l10n_util::GetStringUTF8( | 208 file_system_info.usage_map.find(kPerm)->second)) |
209 IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); | 209 : l10n_util::GetStringUTF8(IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); |
210 dict->SetString(kKeyTemporary, | 210 dict->SetString( |
211 ContainsKey(file_system_info.usage_map, kTemp) ? | 211 kKeyTemporary, |
212 base::UTF16ToUTF8(ui::FormatBytes( | 212 base::ContainsKey(file_system_info.usage_map, kTemp) |
213 file_system_info.usage_map.find(kTemp)->second)) : | 213 ? base::UTF16ToUTF8(ui::FormatBytes( |
214 l10n_util::GetStringUTF8( | 214 file_system_info.usage_map.find(kTemp)->second)) |
215 IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); | 215 : l10n_util::GetStringUTF8(IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); |
216 break; | 216 break; |
217 } | 217 } |
218 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: { | 218 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: { |
219 dict->SetString(kKeyType, "quota"); | 219 dict->SetString(kKeyType, "quota"); |
220 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | 220 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); |
221 | 221 |
222 const BrowsingDataQuotaHelper::QuotaInfo& quota_info = | 222 const BrowsingDataQuotaHelper::QuotaInfo& quota_info = |
223 *node.GetDetailedInfo().quota_info; | 223 *node.GetDetailedInfo().quota_info; |
224 if (quota_info.temporary_usage + quota_info.persistent_usage <= | 224 if (quota_info.temporary_usage + quota_info.persistent_usage <= |
225 kNegligibleUsage) | 225 kNegligibleUsage) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 child = id_map_.Lookup(node_id); | 351 child = id_map_.Lookup(node_id); |
352 child_index = parent->GetIndexOf(child); | 352 child_index = parent->GetIndexOf(child); |
353 if (child_index == -1) | 353 if (child_index == -1) |
354 break; | 354 break; |
355 | 355 |
356 parent = child; | 356 parent = child; |
357 } | 357 } |
358 | 358 |
359 return child_index >= 0 ? child : NULL; | 359 return child_index >= 0 ? child : NULL; |
360 } | 360 } |
OLD | NEW |