Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Side by Side Diff: chrome/browser/ui/webui/cookies_tree_model_util.cc

Issue 1297093002: Cache Storage API: Hook up to chrome://settings/cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto https://codereview.chromium.org/1297023004 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
18 #include "content/public/browser/cache_storage_context.h"
18 #include "content/public/browser/indexed_db_context.h" 19 #include "content/public/browser/indexed_db_context.h"
19 #include "content/public/browser/service_worker_context.h" 20 #include "content/public/browser/service_worker_context.h"
20 #include "net/cookies/canonical_cookie.h" 21 #include "net/cookies/canonical_cookie.h"
21 #include "storage/common/fileapi/file_system_types.h" 22 #include "storage/common/fileapi/file_system_types.h"
22 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/text/bytes_formatting.h" 24 #include "ui/base/text/bytes_formatting.h"
24 25
25 #if defined(ENABLE_EXTENSIONS) 26 #if defined(ENABLE_EXTENSIONS)
26 #include "extensions/common/extension_set.h" 27 #include "extensions/common/extension_set.h"
27 #endif 28 #endif
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 dict->SetString(kKeyType, "indexed_db"); 179 dict->SetString(kKeyType, "indexed_db");
179 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); 180 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON");
180 181
181 const content::IndexedDBInfo& indexed_db_info = 182 const content::IndexedDBInfo& indexed_db_info =
182 *node.GetDetailedInfo().indexed_db_info; 183 *node.GetDetailedInfo().indexed_db_info;
183 184
184 dict->SetString(kKeyOrigin, indexed_db_info.origin_.spec()); 185 dict->SetString(kKeyOrigin, indexed_db_info.origin_.spec());
185 dict->SetString(kKeySize, ui::FormatBytes(indexed_db_info.size_)); 186 dict->SetString(kKeySize, ui::FormatBytes(indexed_db_info.size_));
186 dict->SetString(kKeyModified, base::UTF16ToUTF8( 187 dict->SetString(kKeyModified, base::UTF16ToUTF8(
187 base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified_))); 188 base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified_)));
188
189 break; 189 break;
190 } 190 }
191 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: { 191 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: {
192 dict->SetString(kKeyType, "file_system"); 192 dict->SetString(kKeyType, "file_system");
193 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); 193 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON");
194 194
195 const BrowsingDataFileSystemHelper::FileSystemInfo& file_system_info = 195 const BrowsingDataFileSystemHelper::FileSystemInfo& file_system_info =
196 *node.GetDetailedInfo().file_system_info; 196 *node.GetDetailedInfo().file_system_info;
197 const storage::FileSystemType kPerm = storage::kFileSystemTypePersistent; 197 const storage::FileSystemType kPerm = storage::kFileSystemTypePersistent;
198 const storage::FileSystemType kTemp = storage::kFileSystemTypeTemporary; 198 const storage::FileSystemType kTemp = storage::kFileSystemTypeTemporary;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 base::ListValue* scopes = new base::ListValue; 263 base::ListValue* scopes = new base::ListValue;
264 for (std::vector<GURL>::const_iterator it = 264 for (std::vector<GURL>::const_iterator it =
265 service_worker_info.scopes.begin(); 265 service_worker_info.scopes.begin();
266 it != service_worker_info.scopes.end(); 266 it != service_worker_info.scopes.end();
267 ++it) { 267 ++it) {
268 scopes->AppendString(it->spec()); 268 scopes->AppendString(it->spec());
269 } 269 }
270 dict->Set(kKeyScopes, scopes); 270 dict->Set(kKeyScopes, scopes);
271 break; 271 break;
272 } 272 }
273 case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE: {
274 dict->SetString(kKeyType, "cache_storage");
275 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON");
276
277 const content::CacheStorageUsageInfo& cache_storage_info =
278 *node.GetDetailedInfo().cache_storage_info;
279
280 dict->SetString(kKeyOrigin, cache_storage_info.origin.spec());
281 dict->SetString(kKeySize,
282 ui::FormatBytes(cache_storage_info.total_size_bytes));
283 dict->SetString(kKeyModified,
284 base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(
285 cache_storage_info.last_modified)));
286 break;
287 }
273 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: { 288 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: {
274 dict->SetString(kKeyType, "flash_lso"); 289 dict->SetString(kKeyType, "flash_lso");
275 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_ICON"); 290 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_ICON");
276 291
277 dict->SetString(kKeyDomain, node.GetDetailedInfo().flash_lso_domain); 292 dict->SetString(kKeyDomain, node.GetDetailedInfo().flash_lso_domain);
278 } 293 }
279 default: 294 default:
280 #if defined(OS_MACOSX) 295 #if defined(OS_MACOSX)
281 dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); 296 dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER");
282 #endif 297 #endif
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 child = id_map_.Lookup(node_id); 346 child = id_map_.Lookup(node_id);
332 child_index = parent->GetIndexOf(child); 347 child_index = parent->GetIndexOf(child);
333 if (child_index == -1) 348 if (child_index == -1)
334 break; 349 break;
335 350
336 parent = child; 351 parent = child;
337 } 352 }
338 353
339 return child_index >= 0 ? child : NULL; 354 return child_index >= 0 ? child : NULL;
340 } 355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698