| 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 "content/public/browser/indexed_db_context.h" | 17 #include "content/public/browser/indexed_db_context.h" |
| 18 #include "content/public/browser/service_worker_context.h" | 18 #include "content/public/browser/service_worker_context.h" |
| 19 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 20 #include "net/cookies/canonical_cookie.h" | 20 #include "net/cookies/canonical_cookie.h" |
| 21 #include "net/ssl/ssl_client_cert_type.h" | 21 #include "net/ssl/ssl_client_cert_type.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/text/bytes_formatting.h" | 23 #include "ui/base/text/bytes_formatting.h" |
| 24 #include "webkit/common/fileapi/file_system_types.h" | 24 #include "storage/common/fileapi/file_system_types.h" |
| 25 | 25 |
| 26 #if defined(ENABLE_EXTENSIONS) | 26 #if defined(ENABLE_EXTENSIONS) |
| 27 #include "extensions/common/extension_set.h" | 27 #include "extensions/common/extension_set.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 const char kKeyId[] = "id"; | 32 const char kKeyId[] = "id"; |
| 33 const char kKeyTitle[] = "title"; | 33 const char kKeyTitle[] = "title"; |
| 34 const char kKeyIcon[] = "icon"; | 34 const char kKeyIcon[] = "icon"; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified_))); | 201 base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified_))); |
| 202 | 202 |
| 203 break; | 203 break; |
| 204 } | 204 } |
| 205 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: { | 205 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: { |
| 206 dict->SetString(kKeyType, "file_system"); | 206 dict->SetString(kKeyType, "file_system"); |
| 207 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | 207 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); |
| 208 | 208 |
| 209 const BrowsingDataFileSystemHelper::FileSystemInfo& file_system_info = | 209 const BrowsingDataFileSystemHelper::FileSystemInfo& file_system_info = |
| 210 *node.GetDetailedInfo().file_system_info; | 210 *node.GetDetailedInfo().file_system_info; |
| 211 const fileapi::FileSystemType kPerm = fileapi::kFileSystemTypePersistent; | 211 const storage::FileSystemType kPerm = storage::kFileSystemTypePersistent; |
| 212 const fileapi::FileSystemType kTemp = fileapi::kFileSystemTypeTemporary; | 212 const storage::FileSystemType kTemp = storage::kFileSystemTypeTemporary; |
| 213 | 213 |
| 214 dict->SetString(kKeyOrigin, file_system_info.origin.spec()); | 214 dict->SetString(kKeyOrigin, file_system_info.origin.spec()); |
| 215 dict->SetString(kKeyPersistent, | 215 dict->SetString(kKeyPersistent, |
| 216 ContainsKey(file_system_info.usage_map, kPerm) ? | 216 ContainsKey(file_system_info.usage_map, kPerm) ? |
| 217 base::UTF16ToUTF8(ui::FormatBytes( | 217 base::UTF16ToUTF8(ui::FormatBytes( |
| 218 file_system_info.usage_map.find(kPerm)->second)) : | 218 file_system_info.usage_map.find(kPerm)->second)) : |
| 219 l10n_util::GetStringUTF8( | 219 l10n_util::GetStringUTF8( |
| 220 IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); | 220 IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); |
| 221 dict->SetString(kKeyTemporary, | 221 dict->SetString(kKeyTemporary, |
| 222 ContainsKey(file_system_info.usage_map, kTemp) ? | 222 ContainsKey(file_system_info.usage_map, kTemp) ? |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 child = id_map_.Lookup(node_id); | 345 child = id_map_.Lookup(node_id); |
| 346 child_index = parent->GetIndexOf(child); | 346 child_index = parent->GetIndexOf(child); |
| 347 if (child_index == -1) | 347 if (child_index == -1) |
| 348 break; | 348 break; |
| 349 | 349 |
| 350 parent = child; | 350 parent = child; |
| 351 } | 351 } |
| 352 | 352 |
| 353 return child_index >= 0 ? child : NULL; | 353 return child_index >= 0 ? child : NULL; |
| 354 } | 354 } |
| OLD | NEW |