Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 #include "ui/base/text/bytes_formatting.h" | 27 #include "ui/base/text/bytes_formatting.h" |
| 28 | 28 |
| 29 #if BUILDFLAG(ENABLE_EXTENSIONS) | 29 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 30 #include "extensions/common/extension_set.h" | 30 #include "extensions/common/extension_set.h" |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 const char kKeyId[] = "id"; | 35 const char kKeyId[] = "id"; |
| 36 const char kKeyTitle[] = "title"; | 36 const char kKeyTitle[] = "title"; |
| 37 const char kKeyIcon[] = "icon"; | |
| 38 const char kKeyType[] = "type"; | 37 const char kKeyType[] = "type"; |
| 39 const char kKeyHasChildren[] = "hasChildren"; | 38 const char kKeyHasChildren[] = "hasChildren"; |
| 40 | 39 |
| 41 #if BUILDFLAG(ENABLE_EXTENSIONS) | 40 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 42 const char kKeyAppsProtectingThis[] = "appsProtectingThis"; | 41 const char kKeyAppsProtectingThis[] = "appsProtectingThis"; |
| 43 #endif | 42 #endif |
| 44 const char kKeyName[] = "name"; | 43 const char kKeyName[] = "name"; |
| 45 const char kKeyContent[] = "content"; | 44 const char kKeyContent[] = "content"; |
| 46 const char kKeyDomain[] = "domain"; | 45 const char kKeyDomain[] = "domain"; |
| 47 const char kKeyPath[] = "path"; | 46 const char kKeyPath[] = "path"; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 bool include_quota_nodes, | 93 bool include_quota_nodes, |
| 95 base::DictionaryValue* dict) { | 94 base::DictionaryValue* dict) { |
| 96 // Use node's address as an id for WebUI to look it up. | 95 // Use node's address as an id for WebUI to look it up. |
| 97 dict->SetString(kKeyId, GetTreeNodeId(&node)); | 96 dict->SetString(kKeyId, GetTreeNodeId(&node)); |
| 98 dict->SetString(kKeyTitle, node.GetTitle()); | 97 dict->SetString(kKeyTitle, node.GetTitle()); |
| 99 dict->SetBoolean(kKeyHasChildren, !node.empty()); | 98 dict->SetBoolean(kKeyHasChildren, !node.empty()); |
| 100 | 99 |
| 101 switch (node.GetDetailedInfo().node_type) { | 100 switch (node.GetDetailedInfo().node_type) { |
| 102 case CookieTreeNode::DetailedInfo::TYPE_HOST: { | 101 case CookieTreeNode::DetailedInfo::TYPE_HOST: { |
| 103 dict->SetString(kKeyType, "origin"); | 102 dict->SetString(kKeyType, "origin"); |
| 104 #if defined(OS_MACOSX) | |
| 105 dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); | |
| 106 #endif | |
| 107 break; | 103 break; |
| 108 } | 104 } |
| 109 case CookieTreeNode::DetailedInfo::TYPE_COOKIE: { | 105 case CookieTreeNode::DetailedInfo::TYPE_COOKIE: { |
| 110 dict->SetString(kKeyType, "cookie"); | 106 dict->SetString(kKeyType, "cookie"); |
| 111 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_ICON"); | |
| 112 | 107 |
| 113 const net::CanonicalCookie& cookie = *node.GetDetailedInfo().cookie; | 108 const net::CanonicalCookie& cookie = *node.GetDetailedInfo().cookie; |
| 114 | 109 |
| 115 dict->SetString(kKeyName, cookie.Name()); | 110 dict->SetString(kKeyName, cookie.Name()); |
| 116 dict->SetString(kKeyContent, cookie.Value()); | 111 dict->SetString(kKeyContent, cookie.Value()); |
| 117 dict->SetString(kKeyDomain, cookie.Domain()); | 112 dict->SetString(kKeyDomain, cookie.Domain()); |
| 118 dict->SetString(kKeyPath, cookie.Path()); | 113 dict->SetString(kKeyPath, cookie.Path()); |
| 119 dict->SetString(kKeySendFor, | 114 dict->SetString(kKeySendFor, |
| 120 l10n_util::GetStringUTF16( | 115 l10n_util::GetStringUTF16( |
| 121 CookiesTreeModel::GetSendForMessageID(cookie))); | 116 CookiesTreeModel::GetSendForMessageID(cookie))); |
| 122 std::string accessible = cookie.IsHttpOnly() ? | 117 std::string accessible = cookie.IsHttpOnly() ? |
| 123 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_ACCESSIBLE_TO_SCRIPT_NO) : | 118 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_ACCESSIBLE_TO_SCRIPT_NO) : |
| 124 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_ACCESSIBLE_TO_SCRIPT_YES); | 119 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_ACCESSIBLE_TO_SCRIPT_YES); |
| 125 dict->SetString(kKeyAccessibleToScript, accessible); | 120 dict->SetString(kKeyAccessibleToScript, accessible); |
| 126 dict->SetString(kKeyCreated, base::UTF16ToUTF8( | 121 dict->SetString(kKeyCreated, base::UTF16ToUTF8( |
| 127 base::TimeFormatFriendlyDateAndTime(cookie.CreationDate()))); | 122 base::TimeFormatFriendlyDateAndTime(cookie.CreationDate()))); |
| 128 dict->SetString(kKeyExpires, cookie.IsPersistent() ? base::UTF16ToUTF8( | 123 dict->SetString(kKeyExpires, cookie.IsPersistent() ? base::UTF16ToUTF8( |
| 129 base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate())) : | 124 base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate())) : |
| 130 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION)); | 125 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION)); |
| 131 | 126 |
| 132 break; | 127 break; |
| 133 } | 128 } |
| 134 case CookieTreeNode::DetailedInfo::TYPE_DATABASE: { | 129 case CookieTreeNode::DetailedInfo::TYPE_DATABASE: { |
| 135 dict->SetString(kKeyType, "database"); | 130 dict->SetString(kKeyType, "database"); |
| 136 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | |
|
dschuyler
2016/12/15 02:24:48
Are there associated icon resources that could be
| |
| 137 | 131 |
| 138 const BrowsingDataDatabaseHelper::DatabaseInfo& database_info = | 132 const BrowsingDataDatabaseHelper::DatabaseInfo& database_info = |
| 139 *node.GetDetailedInfo().database_info; | 133 *node.GetDetailedInfo().database_info; |
| 140 | 134 |
| 141 dict->SetString(kKeyName, database_info.database_name.empty() ? | 135 dict->SetString(kKeyName, database_info.database_name.empty() ? |
| 142 l10n_util::GetStringUTF8(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) : | 136 l10n_util::GetStringUTF8(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) : |
| 143 database_info.database_name); | 137 database_info.database_name); |
| 144 dict->SetString(kKeyDesc, database_info.description); | 138 dict->SetString(kKeyDesc, database_info.description); |
| 145 dict->SetString(kKeySize, ui::FormatBytes(database_info.size)); | 139 dict->SetString(kKeySize, ui::FormatBytes(database_info.size)); |
| 146 dict->SetString(kKeyModified, base::UTF16ToUTF8( | 140 dict->SetString(kKeyModified, base::UTF16ToUTF8( |
| 147 base::TimeFormatFriendlyDateAndTime(database_info.last_modified))); | 141 base::TimeFormatFriendlyDateAndTime(database_info.last_modified))); |
| 148 | 142 |
| 149 break; | 143 break; |
| 150 } | 144 } |
| 151 case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE: { | 145 case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE: { |
| 152 dict->SetString(kKeyType, "local_storage"); | 146 dict->SetString(kKeyType, "local_storage"); |
| 153 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | |
| 154 | 147 |
| 155 const BrowsingDataLocalStorageHelper::LocalStorageInfo& | 148 const BrowsingDataLocalStorageHelper::LocalStorageInfo& |
| 156 local_storage_info = *node.GetDetailedInfo().local_storage_info; | 149 local_storage_info = *node.GetDetailedInfo().local_storage_info; |
| 157 | 150 |
| 158 dict->SetString(kKeyOrigin, local_storage_info.origin_url.spec()); | 151 dict->SetString(kKeyOrigin, local_storage_info.origin_url.spec()); |
| 159 dict->SetString(kKeySize, ui::FormatBytes(local_storage_info.size)); | 152 dict->SetString(kKeySize, ui::FormatBytes(local_storage_info.size)); |
| 160 dict->SetString(kKeyModified, base::UTF16ToUTF8( | 153 dict->SetString(kKeyModified, base::UTF16ToUTF8( |
| 161 base::TimeFormatFriendlyDateAndTime( | 154 base::TimeFormatFriendlyDateAndTime( |
| 162 local_storage_info.last_modified))); | 155 local_storage_info.last_modified))); |
| 163 | 156 |
| 164 break; | 157 break; |
| 165 } | 158 } |
| 166 case CookieTreeNode::DetailedInfo::TYPE_APPCACHE: { | 159 case CookieTreeNode::DetailedInfo::TYPE_APPCACHE: { |
| 167 dict->SetString(kKeyType, "app_cache"); | 160 dict->SetString(kKeyType, "app_cache"); |
| 168 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | |
| 169 | 161 |
| 170 const content::AppCacheInfo& appcache_info = | 162 const content::AppCacheInfo& appcache_info = |
| 171 *node.GetDetailedInfo().appcache_info; | 163 *node.GetDetailedInfo().appcache_info; |
| 172 | 164 |
| 173 dict->SetString(kKeyManifest, appcache_info.manifest_url.spec()); | 165 dict->SetString(kKeyManifest, appcache_info.manifest_url.spec()); |
| 174 dict->SetString(kKeySize, ui::FormatBytes(appcache_info.size)); | 166 dict->SetString(kKeySize, ui::FormatBytes(appcache_info.size)); |
| 175 dict->SetString(kKeyCreated, base::UTF16ToUTF8( | 167 dict->SetString(kKeyCreated, base::UTF16ToUTF8( |
| 176 base::TimeFormatFriendlyDateAndTime(appcache_info.creation_time))); | 168 base::TimeFormatFriendlyDateAndTime(appcache_info.creation_time))); |
| 177 dict->SetString(kKeyAccessed, base::UTF16ToUTF8( | 169 dict->SetString(kKeyAccessed, base::UTF16ToUTF8( |
| 178 base::TimeFormatFriendlyDateAndTime(appcache_info.last_access_time))); | 170 base::TimeFormatFriendlyDateAndTime(appcache_info.last_access_time))); |
| 179 | 171 |
| 180 break; | 172 break; |
| 181 } | 173 } |
| 182 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: { | 174 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: { |
| 183 dict->SetString(kKeyType, "indexed_db"); | 175 dict->SetString(kKeyType, "indexed_db"); |
| 184 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | |
| 185 | 176 |
| 186 const content::IndexedDBInfo& indexed_db_info = | 177 const content::IndexedDBInfo& indexed_db_info = |
| 187 *node.GetDetailedInfo().indexed_db_info; | 178 *node.GetDetailedInfo().indexed_db_info; |
| 188 | 179 |
| 189 dict->SetString(kKeyOrigin, indexed_db_info.origin.spec()); | 180 dict->SetString(kKeyOrigin, indexed_db_info.origin.spec()); |
| 190 dict->SetString(kKeySize, ui::FormatBytes(indexed_db_info.size)); | 181 dict->SetString(kKeySize, ui::FormatBytes(indexed_db_info.size)); |
| 191 dict->SetString(kKeyModified, | 182 dict->SetString(kKeyModified, |
| 192 base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( | 183 base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( |
| 193 indexed_db_info.last_modified))); | 184 indexed_db_info.last_modified))); |
| 194 break; | 185 break; |
| 195 } | 186 } |
| 196 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: { | 187 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: { |
| 197 dict->SetString(kKeyType, "file_system"); | 188 dict->SetString(kKeyType, "file_system"); |
| 198 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | |
| 199 | 189 |
| 200 const BrowsingDataFileSystemHelper::FileSystemInfo& file_system_info = | 190 const BrowsingDataFileSystemHelper::FileSystemInfo& file_system_info = |
| 201 *node.GetDetailedInfo().file_system_info; | 191 *node.GetDetailedInfo().file_system_info; |
| 202 const storage::FileSystemType kPerm = storage::kFileSystemTypePersistent; | 192 const storage::FileSystemType kPerm = storage::kFileSystemTypePersistent; |
| 203 const storage::FileSystemType kTemp = storage::kFileSystemTypeTemporary; | 193 const storage::FileSystemType kTemp = storage::kFileSystemTypeTemporary; |
| 204 | 194 |
| 205 dict->SetString(kKeyOrigin, file_system_info.origin.spec()); | 195 dict->SetString(kKeyOrigin, file_system_info.origin.spec()); |
| 206 dict->SetString( | 196 dict->SetString( |
| 207 kKeyPersistent, | 197 kKeyPersistent, |
| 208 base::ContainsKey(file_system_info.usage_map, kPerm) | 198 base::ContainsKey(file_system_info.usage_map, kPerm) |
| 209 ? base::UTF16ToUTF8(ui::FormatBytes( | 199 ? base::UTF16ToUTF8(ui::FormatBytes( |
| 210 file_system_info.usage_map.find(kPerm)->second)) | 200 file_system_info.usage_map.find(kPerm)->second)) |
| 211 : l10n_util::GetStringUTF8(IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); | 201 : l10n_util::GetStringUTF8(IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); |
| 212 dict->SetString( | 202 dict->SetString( |
| 213 kKeyTemporary, | 203 kKeyTemporary, |
| 214 base::ContainsKey(file_system_info.usage_map, kTemp) | 204 base::ContainsKey(file_system_info.usage_map, kTemp) |
| 215 ? base::UTF16ToUTF8(ui::FormatBytes( | 205 ? base::UTF16ToUTF8(ui::FormatBytes( |
| 216 file_system_info.usage_map.find(kTemp)->second)) | 206 file_system_info.usage_map.find(kTemp)->second)) |
| 217 : l10n_util::GetStringUTF8(IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); | 207 : l10n_util::GetStringUTF8(IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); |
| 218 break; | 208 break; |
| 219 } | 209 } |
| 220 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: { | 210 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: { |
| 221 if (!include_quota_nodes) | 211 if (!include_quota_nodes) |
| 222 return false; | 212 return false; |
| 223 | 213 |
| 224 dict->SetString(kKeyType, "quota"); | 214 dict->SetString(kKeyType, "quota"); |
| 225 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | |
| 226 | 215 |
| 227 const BrowsingDataQuotaHelper::QuotaInfo& quota_info = | 216 const BrowsingDataQuotaHelper::QuotaInfo& quota_info = |
| 228 *node.GetDetailedInfo().quota_info; | 217 *node.GetDetailedInfo().quota_info; |
| 229 if (quota_info.temporary_usage + quota_info.persistent_usage <= | 218 if (quota_info.temporary_usage + quota_info.persistent_usage <= |
| 230 kNegligibleUsage) | 219 kNegligibleUsage) |
| 231 return false; | 220 return false; |
| 232 | 221 |
| 233 dict->SetString(kKeyOrigin, quota_info.host); | 222 dict->SetString(kKeyOrigin, quota_info.host); |
| 234 dict->SetString(kKeyTotalUsage, | 223 dict->SetString(kKeyTotalUsage, |
| 235 base::UTF16ToUTF8(ui::FormatBytes( | 224 base::UTF16ToUTF8(ui::FormatBytes( |
| 236 quota_info.temporary_usage + | 225 quota_info.temporary_usage + |
| 237 quota_info.persistent_usage))); | 226 quota_info.persistent_usage))); |
| 238 dict->SetString(kKeyTemporaryUsage, | 227 dict->SetString(kKeyTemporaryUsage, |
| 239 base::UTF16ToUTF8(ui::FormatBytes( | 228 base::UTF16ToUTF8(ui::FormatBytes( |
| 240 quota_info.temporary_usage))); | 229 quota_info.temporary_usage))); |
| 241 dict->SetString(kKeyPersistentUsage, | 230 dict->SetString(kKeyPersistentUsage, |
| 242 base::UTF16ToUTF8(ui::FormatBytes( | 231 base::UTF16ToUTF8(ui::FormatBytes( |
| 243 quota_info.persistent_usage))); | 232 quota_info.persistent_usage))); |
| 244 break; | 233 break; |
| 245 } | 234 } |
| 246 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: { | 235 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: { |
| 247 dict->SetString(kKeyType, "channel_id"); | 236 dict->SetString(kKeyType, "channel_id"); |
| 248 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_ICON"); | |
| 249 | 237 |
| 250 const net::ChannelIDStore::ChannelID& channel_id = | 238 const net::ChannelIDStore::ChannelID& channel_id = |
| 251 *node.GetDetailedInfo().channel_id; | 239 *node.GetDetailedInfo().channel_id; |
| 252 | 240 |
| 253 dict->SetString(kKeyServerId, channel_id.server_identifier()); | 241 dict->SetString(kKeyServerId, channel_id.server_identifier()); |
| 254 dict->SetString(kKeyCertType, | 242 dict->SetString(kKeyCertType, |
| 255 l10n_util::GetStringUTF8(IDS_CLIENT_CERT_ECDSA_SIGN)); | 243 l10n_util::GetStringUTF8(IDS_CLIENT_CERT_ECDSA_SIGN)); |
| 256 dict->SetString(kKeyCreated, base::UTF16ToUTF8( | 244 dict->SetString(kKeyCreated, base::UTF16ToUTF8( |
| 257 base::TimeFormatFriendlyDateAndTime( | 245 base::TimeFormatFriendlyDateAndTime( |
| 258 channel_id.creation_time()))); | 246 channel_id.creation_time()))); |
| 259 break; | 247 break; |
| 260 } | 248 } |
| 261 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: { | 249 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: { |
| 262 dict->SetString(kKeyType, "service_worker"); | 250 dict->SetString(kKeyType, "service_worker"); |
| 263 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | |
| 264 | 251 |
| 265 const content::ServiceWorkerUsageInfo& service_worker_info = | 252 const content::ServiceWorkerUsageInfo& service_worker_info = |
| 266 *node.GetDetailedInfo().service_worker_info; | 253 *node.GetDetailedInfo().service_worker_info; |
| 267 | 254 |
| 268 dict->SetString(kKeyOrigin, service_worker_info.origin.spec()); | 255 dict->SetString(kKeyOrigin, service_worker_info.origin.spec()); |
| 269 dict->SetString(kKeySize, | 256 dict->SetString(kKeySize, |
| 270 ui::FormatBytes(service_worker_info.total_size_bytes)); | 257 ui::FormatBytes(service_worker_info.total_size_bytes)); |
| 271 base::ListValue* scopes = new base::ListValue; | 258 base::ListValue* scopes = new base::ListValue; |
| 272 for (std::vector<GURL>::const_iterator it = | 259 for (std::vector<GURL>::const_iterator it = |
| 273 service_worker_info.scopes.begin(); | 260 service_worker_info.scopes.begin(); |
| 274 it != service_worker_info.scopes.end(); | 261 it != service_worker_info.scopes.end(); |
| 275 ++it) { | 262 ++it) { |
| 276 scopes->AppendString(it->spec()); | 263 scopes->AppendString(it->spec()); |
| 277 } | 264 } |
| 278 dict->Set(kKeyScopes, scopes); | 265 dict->Set(kKeyScopes, scopes); |
| 279 break; | 266 break; |
| 280 } | 267 } |
| 281 case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE: { | 268 case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE: { |
| 282 dict->SetString(kKeyType, "cache_storage"); | 269 dict->SetString(kKeyType, "cache_storage"); |
| 283 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | |
| 284 | 270 |
| 285 const content::CacheStorageUsageInfo& cache_storage_info = | 271 const content::CacheStorageUsageInfo& cache_storage_info = |
| 286 *node.GetDetailedInfo().cache_storage_info; | 272 *node.GetDetailedInfo().cache_storage_info; |
| 287 | 273 |
| 288 dict->SetString(kKeyOrigin, cache_storage_info.origin.spec()); | 274 dict->SetString(kKeyOrigin, cache_storage_info.origin.spec()); |
| 289 dict->SetString(kKeySize, | 275 dict->SetString(kKeySize, |
| 290 ui::FormatBytes(cache_storage_info.total_size_bytes)); | 276 ui::FormatBytes(cache_storage_info.total_size_bytes)); |
| 291 dict->SetString(kKeyModified, | 277 dict->SetString(kKeyModified, |
| 292 base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( | 278 base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( |
| 293 cache_storage_info.last_modified))); | 279 cache_storage_info.last_modified))); |
| 294 break; | 280 break; |
| 295 } | 281 } |
| 296 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: { | 282 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: { |
| 297 dict->SetString(kKeyType, "flash_lso"); | 283 dict->SetString(kKeyType, "flash_lso"); |
| 298 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_ICON"); | |
| 299 | 284 |
| 300 dict->SetString(kKeyDomain, node.GetDetailedInfo().flash_lso_domain); | 285 dict->SetString(kKeyDomain, node.GetDetailedInfo().flash_lso_domain); |
| 301 break; | 286 break; |
| 302 } | 287 } |
| 303 case CookieTreeNode::DetailedInfo::TYPE_MEDIA_LICENSE: { | 288 case CookieTreeNode::DetailedInfo::TYPE_MEDIA_LICENSE: { |
| 304 dict->SetString(kKeyType, "media_license"); | 289 dict->SetString(kKeyType, "media_license"); |
| 305 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); | |
| 306 | 290 |
| 307 const BrowsingDataMediaLicenseHelper::MediaLicenseInfo& | 291 const BrowsingDataMediaLicenseHelper::MediaLicenseInfo& |
| 308 media_license_info = *node.GetDetailedInfo().media_license_info; | 292 media_license_info = *node.GetDetailedInfo().media_license_info; |
| 309 dict->SetString(kKeyOrigin, media_license_info.origin.spec()); | 293 dict->SetString(kKeyOrigin, media_license_info.origin.spec()); |
| 310 dict->SetString(kKeySize, ui::FormatBytes(media_license_info.size)); | 294 dict->SetString(kKeySize, ui::FormatBytes(media_license_info.size)); |
| 311 dict->SetString(kKeyModified, | 295 dict->SetString(kKeyModified, |
| 312 base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( | 296 base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( |
| 313 media_license_info.last_modified_time))); | 297 media_license_info.last_modified_time))); |
| 314 break; | 298 break; |
| 315 } | 299 } |
| 316 default: | 300 default: |
| 317 #if defined(OS_MACOSX) | |
| 318 dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); | |
| 319 #endif | |
| 320 break; | 301 break; |
| 321 } | 302 } |
| 322 | 303 |
| 323 #if BUILDFLAG(ENABLE_EXTENSIONS) | 304 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 324 const extensions::ExtensionSet* protecting_apps = | 305 const extensions::ExtensionSet* protecting_apps = |
| 325 node.GetModel()->ExtensionsProtectingNode(node); | 306 node.GetModel()->ExtensionsProtectingNode(node); |
| 326 if (protecting_apps && !protecting_apps->is_empty()) { | 307 if (protecting_apps && !protecting_apps->is_empty()) { |
| 327 base::ListValue* app_infos = new base::ListValue; | 308 base::ListValue* app_infos = new base::ListValue; |
| 328 for (extensions::ExtensionSet::const_iterator it = protecting_apps->begin(); | 309 for (extensions::ExtensionSet::const_iterator it = protecting_apps->begin(); |
| 329 it != protecting_apps->end(); ++it) { | 310 it != protecting_apps->end(); ++it) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 // lookup for O(1) space, but it could be further improved to O(1) lookup if | 391 // lookup for O(1) space, but it could be further improved to O(1) lookup if |
| 411 // desired (by trading O(n) space for the time improvement). | 392 // desired (by trading O(n) space for the time improvement). |
| 412 int site_count = root->child_count(); | 393 int site_count = root->child_count(); |
| 413 for (int i = 0; i < site_count; ++i) { | 394 for (int i = 0; i < site_count; ++i) { |
| 414 const CookieTreeNode* child = root->GetChild(i); | 395 const CookieTreeNode* child = root->GetChild(i); |
| 415 if (title == child->GetTitle()) | 396 if (title == child->GetTitle()) |
| 416 return child; | 397 return child; |
| 417 } | 398 } |
| 418 return nullptr; | 399 return nullptr; |
| 419 } | 400 } |
| OLD | NEW |