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

Side by Side Diff: chrome/browser/dom_ui/options/cookies_view_handler.cc

Issue 6064003: Update the time formatting APIs to use string16.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui/options/cookies_view_handler.h" 5 #include "chrome/browser/dom_ui/options/cookies_view_handler.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const net::CookieMonster::CanonicalCookie& cookie = 78 const net::CookieMonster::CanonicalCookie& cookie =
79 *node.GetDetailedInfo().cookie; 79 *node.GetDetailedInfo().cookie;
80 80
81 dict->SetString(kKeyName, cookie.Name()); 81 dict->SetString(kKeyName, cookie.Name());
82 dict->SetString(kKeyContent, cookie.Value()); 82 dict->SetString(kKeyContent, cookie.Value());
83 dict->SetString(kKeyDomain, cookie.Domain()); 83 dict->SetString(kKeyDomain, cookie.Domain());
84 dict->SetString(kKeyPath, cookie.Path()); 84 dict->SetString(kKeyPath, cookie.Path());
85 dict->SetString(kKeySendFor, cookie.IsSecure() ? 85 dict->SetString(kKeySendFor, cookie.IsSecure() ?
86 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_SENDFOR_SECURE) : 86 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_SENDFOR_SECURE) :
87 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_SENDFOR_ANY)); 87 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_SENDFOR_ANY));
88 dict->SetString(kKeyCreated, WideToUTF8( 88 dict->SetString(kKeyCreated, UTF16ToUTF8(
89 base::TimeFormatFriendlyDateAndTime(cookie.CreationDate()))); 89 base::TimeFormatFriendlyDateAndTime(cookie.CreationDate())));
90 dict->SetString(kKeyExpires, cookie.DoesExpire() ? WideToUTF8( 90 dict->SetString(kKeyExpires, cookie.DoesExpire() ? UTF16ToUTF8(
91 base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate())) : 91 base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate())) :
92 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION)); 92 l10n_util::GetStringUTF8(IDS_COOKIES_COOKIE_EXPIRES_SESSION));
93 93
94 break; 94 break;
95 } 95 }
96 case CookieTreeNode::DetailedInfo::TYPE_DATABASE: { 96 case CookieTreeNode::DetailedInfo::TYPE_DATABASE: {
97 dict->SetString(kKeyType, "database"); 97 dict->SetString(kKeyType, "database");
98 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); 98 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON");
99 99
100 const BrowsingDataDatabaseHelper::DatabaseInfo& database_info = 100 const BrowsingDataDatabaseHelper::DatabaseInfo& database_info =
101 *node.GetDetailedInfo().database_info; 101 *node.GetDetailedInfo().database_info;
102 102
103 dict->SetString(kKeyName, database_info.database_name.empty() ? 103 dict->SetString(kKeyName, database_info.database_name.empty() ?
104 l10n_util::GetStringUTF8(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) : 104 l10n_util::GetStringUTF8(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) :
105 database_info.database_name); 105 database_info.database_name);
106 dict->SetString(kKeyDesc, database_info.description); 106 dict->SetString(kKeyDesc, database_info.description);
107 dict->SetString(kKeySize, 107 dict->SetString(kKeySize,
108 FormatBytes(database_info.size, 108 FormatBytes(database_info.size,
109 GetByteDisplayUnits(database_info.size), 109 GetByteDisplayUnits(database_info.size),
110 true)); 110 true));
111 dict->SetString(kKeyModified, WideToUTF8( 111 dict->SetString(kKeyModified, UTF16ToUTF8(
112 base::TimeFormatFriendlyDateAndTime(database_info.last_modified))); 112 base::TimeFormatFriendlyDateAndTime(database_info.last_modified)));
113 113
114 break; 114 break;
115 } 115 }
116 case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE: { 116 case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE: {
117 dict->SetString(kKeyType, "local_storage"); 117 dict->SetString(kKeyType, "local_storage");
118 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); 118 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON");
119 119
120 const BrowsingDataLocalStorageHelper::LocalStorageInfo& 120 const BrowsingDataLocalStorageHelper::LocalStorageInfo&
121 local_storage_info = *node.GetDetailedInfo().local_storage_info; 121 local_storage_info = *node.GetDetailedInfo().local_storage_info;
122 122
123 dict->SetString(kKeyOrigin, local_storage_info.origin); 123 dict->SetString(kKeyOrigin, local_storage_info.origin);
124 dict->SetString(kKeySize, 124 dict->SetString(kKeySize,
125 FormatBytes(local_storage_info.size, 125 FormatBytes(local_storage_info.size,
126 GetByteDisplayUnits(local_storage_info.size), 126 GetByteDisplayUnits(local_storage_info.size),
127 true)); 127 true));
128 dict->SetString(kKeyModified, WideToUTF8( 128 dict->SetString(kKeyModified, UTF16ToUTF8(
129 base::TimeFormatFriendlyDateAndTime( 129 base::TimeFormatFriendlyDateAndTime(
130 local_storage_info.last_modified))); 130 local_storage_info.last_modified)));
131 131
132 break; 132 break;
133 } 133 }
134 case CookieTreeNode::DetailedInfo::TYPE_APPCACHE: { 134 case CookieTreeNode::DetailedInfo::TYPE_APPCACHE: {
135 dict->SetString(kKeyType, "app_cache"); 135 dict->SetString(kKeyType, "app_cache");
136 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); 136 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON");
137 137
138 const appcache::AppCacheInfo& appcache_info = 138 const appcache::AppCacheInfo& appcache_info =
139 *node.GetDetailedInfo().appcache_info; 139 *node.GetDetailedInfo().appcache_info;
140 140
141 dict->SetString(kKeyManifest, appcache_info.manifest_url.spec()); 141 dict->SetString(kKeyManifest, appcache_info.manifest_url.spec());
142 dict->SetString(kKeySize, 142 dict->SetString(kKeySize,
143 FormatBytes(appcache_info.size, 143 FormatBytes(appcache_info.size,
144 GetByteDisplayUnits(appcache_info.size), 144 GetByteDisplayUnits(appcache_info.size),
145 true)); 145 true));
146 dict->SetString(kKeyCreated, WideToUTF8( 146 dict->SetString(kKeyCreated, UTF16ToUTF8(
147 base::TimeFormatFriendlyDateAndTime(appcache_info.creation_time))); 147 base::TimeFormatFriendlyDateAndTime(appcache_info.creation_time)));
148 dict->SetString(kKeyAccessed, WideToUTF8( 148 dict->SetString(kKeyAccessed, UTF16ToUTF8(
149 base::TimeFormatFriendlyDateAndTime(appcache_info.last_access_time))); 149 base::TimeFormatFriendlyDateAndTime(appcache_info.last_access_time)));
150 150
151 break; 151 break;
152 } 152 }
153 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: { 153 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: {
154 dict->SetString(kKeyType, "indexed_db"); 154 dict->SetString(kKeyType, "indexed_db");
155 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); 155 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON");
156 156
157 const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info = 157 const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info =
158 *node.GetDetailedInfo().indexed_db_info; 158 *node.GetDetailedInfo().indexed_db_info;
159 159
160 dict->SetString(kKeyOrigin, indexed_db_info.origin); 160 dict->SetString(kKeyOrigin, indexed_db_info.origin);
161 dict->SetString(kKeySize, 161 dict->SetString(kKeySize,
162 FormatBytes(indexed_db_info.size, 162 FormatBytes(indexed_db_info.size,
163 GetByteDisplayUnits(indexed_db_info.size), 163 GetByteDisplayUnits(indexed_db_info.size),
164 true)); 164 true));
165 dict->SetString(kKeyModified, WideToUTF8( 165 dict->SetString(kKeyModified, UTF16ToUTF8(
166 base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified))); 166 base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified)));
167 167
168 break; 168 break;
169 } 169 }
170 default: 170 default:
171 break; 171 break;
172 } 172 }
173 } 173 }
174 174
175 // Append the children nodes of |parent| in specified range to |nodes| list. 175 // Append the children nodes of |parent| in specified range to |nodes| list.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 GetChildNodeList(parent, 0, parent->GetChildCount(), children); 391 GetChildNodeList(parent, 0, parent->GetChildCount(), children);
392 392
393 ListValue args; 393 ListValue args;
394 args.Append(parent == cookies_tree_model_->GetRoot() ? 394 args.Append(parent == cookies_tree_model_->GetRoot() ?
395 Value::CreateNullValue() : 395 Value::CreateNullValue() :
396 Value::CreateStringValue(PointerToHexString(parent))); 396 Value::CreateStringValue(PointerToHexString(parent)));
397 args.Append(children); 397 args.Append(children);
398 398
399 dom_ui_->CallJavascriptFunction(L"CookiesView.loadChildren", args); 399 dom_ui_->CallJavascriptFunction(L"CookiesView.loadChildren", args);
400 } 400 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698