| 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/string_util.h" | 11 #include "base/string_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/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 15 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 16 #include "content/public/browser/indexed_db_context.h" |
| 16 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 17 #include "net/cookies/canonical_cookie.h" | 18 #include "net/cookies/canonical_cookie.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/text/bytes_formatting.h" | 20 #include "ui/base/text/bytes_formatting.h" |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 const char kKeyId[] = "id"; | 24 const char kKeyId[] = "id"; |
| 24 const char kKeyTitle[] = "title"; | 25 const char kKeyTitle[] = "title"; |
| 25 const char kKeyIcon[] = "icon"; | 26 const char kKeyIcon[] = "icon"; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 base::TimeFormatFriendlyDateAndTime(appcache_info.creation_time))); | 174 base::TimeFormatFriendlyDateAndTime(appcache_info.creation_time))); |
| 174 dict->SetString(kKeyAccessed, UTF16ToUTF8( | 175 dict->SetString(kKeyAccessed, UTF16ToUTF8( |
| 175 base::TimeFormatFriendlyDateAndTime(appcache_info.last_access_time))); | 176 base::TimeFormatFriendlyDateAndTime(appcache_info.last_access_time))); |
| 176 | 177 |
| 177 break; | 178 break; |
| 178 } | 179 } |
| 179 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: { | 180 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: { |
| 180 dict->SetString(kKeyType, "indexed_db"); | 181 dict->SetString(kKeyType, "indexed_db"); |
| 181 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | 182 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); |
| 182 | 183 |
| 183 const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info = | 184 const content::IndexedDBInfo& indexed_db_info = |
| 184 *node.GetDetailedInfo().indexed_db_info; | 185 *node.GetDetailedInfo().indexed_db_info; |
| 185 | 186 |
| 186 dict->SetString(kKeyOrigin, indexed_db_info.origin.spec()); | 187 dict->SetString(kKeyOrigin, indexed_db_info.origin.spec()); |
| 187 dict->SetString(kKeySize, ui::FormatBytes(indexed_db_info.size)); | 188 dict->SetString(kKeySize, ui::FormatBytes(indexed_db_info.size)); |
| 188 dict->SetString(kKeyModified, UTF16ToUTF8( | 189 dict->SetString(kKeyModified, UTF16ToUTF8( |
| 189 base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified))); | 190 base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified))); |
| 190 | 191 |
| 191 break; | 192 break; |
| 192 } | 193 } |
| 193 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: { | 194 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 child = id_map_.Lookup(node_id); | 315 child = id_map_.Lookup(node_id); |
| 315 child_index = parent->GetIndexOf(child); | 316 child_index = parent->GetIndexOf(child); |
| 316 if (child_index == -1) | 317 if (child_index == -1) |
| 317 break; | 318 break; |
| 318 | 319 |
| 319 parent = child; | 320 parent = child; |
| 320 } | 321 } |
| 321 | 322 |
| 322 return child_index >= 0 ? child : NULL; | 323 return child_index >= 0 ? child : NULL; |
| 323 } | 324 } |
| OLD | NEW |