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

Side by Side Diff: chrome/browser/ui/cocoa/content_settings/cookie_details.mm

Issue 7189076: Localize strings, speeds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tweaking Created 9 years, 6 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/ui/cocoa/content_settings/cookie_details.h" 5 #include "chrome/browser/ui/cocoa/content_settings/cookie_details.h"
6 6
7 #import "base/i18n/time_formatting.h" 7 #import "base/i18n/time_formatting.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "chrome/browser/cookies_tree_model.h" 10 #include "chrome/browser/cookies_tree_model.h"
11 #include "ui/base/l10n/l10n_util_mac.h" 11 #include "ui/base/l10n/l10n_util_mac.h"
12 #include "ui/base/text/bytes_formatting.h"
12 #include "webkit/appcache/appcache_service.h" 13 #include "webkit/appcache/appcache_service.h"
13 14
14 #pragma mark Cocoa Cookie Details 15 #pragma mark Cocoa Cookie Details
15 16
16 @implementation CocoaCookieDetails 17 @implementation CocoaCookieDetails
17 18
18 @synthesize canEditExpiration = canEditExpiration_; 19 @synthesize canEditExpiration = canEditExpiration_;
19 @synthesize hasExpiration = hasExpiration_; 20 @synthesize hasExpiration = hasExpiration_;
20 @synthesize type = type_; 21 @synthesize type = type_;
21 22
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return self; 150 return self;
150 } 151 }
151 152
152 - (id)initWithDatabase:(const BrowsingDataDatabaseHelper::DatabaseInfo*) 153 - (id)initWithDatabase:(const BrowsingDataDatabaseHelper::DatabaseInfo*)
153 databaseInfo { 154 databaseInfo {
154 if ((self = [super init])) { 155 if ((self = [super init])) {
155 type_ = kCocoaCookieDetailsTypeTreeDatabase; 156 type_ = kCocoaCookieDetailsTypeTreeDatabase;
156 canEditExpiration_ = NO; 157 canEditExpiration_ = NO;
157 databaseDescription_.reset([base::SysUTF8ToNSString( 158 databaseDescription_.reset([base::SysUTF8ToNSString(
158 databaseInfo->description) retain]); 159 databaseInfo->description) retain]);
159 fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(databaseInfo->size, 160 fileSize_.reset([base::SysUTF16ToNSString(
160 GetByteDisplayUnits(databaseInfo->size), true)) retain]); 161 ui::FormatBytes(databaseInfo->size,
162 ui::DATA_UNITS_NATURAL, true)) retain]);
161 lastModified_.reset([base::SysUTF16ToNSString( 163 lastModified_.reset([base::SysUTF16ToNSString(
162 base::TimeFormatFriendlyDateAndTime( 164 base::TimeFormatFriendlyDateAndTime(
163 databaseInfo->last_modified)) retain]); 165 databaseInfo->last_modified)) retain]);
164 } 166 }
165 return self; 167 return self;
166 } 168 }
167 169
168 - (id)initWithLocalStorage:( 170 - (id)initWithLocalStorage:(
169 const BrowsingDataLocalStorageHelper::LocalStorageInfo*)storageInfo { 171 const BrowsingDataLocalStorageHelper::LocalStorageInfo*)storageInfo {
170 if ((self = [super init])) { 172 if ((self = [super init])) {
171 type_ = kCocoaCookieDetailsTypeTreeLocalStorage; 173 type_ = kCocoaCookieDetailsTypeTreeLocalStorage;
172 canEditExpiration_ = NO; 174 canEditExpiration_ = NO;
173 domain_.reset([base::SysUTF8ToNSString(storageInfo->origin) retain]); 175 domain_.reset([base::SysUTF8ToNSString(storageInfo->origin) retain]);
174 fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(storageInfo->size, 176 fileSize_.reset([base::SysUTF16ToNSString(ui::FormatBytes(storageInfo->size,
175 GetByteDisplayUnits(storageInfo->size), true)) retain]); 177 ui::DATA_UNITS_NATURAL, true)) retain]);
176 lastModified_.reset([base::SysUTF16ToNSString( 178 lastModified_.reset([base::SysUTF16ToNSString(
177 base::TimeFormatFriendlyDateAndTime( 179 base::TimeFormatFriendlyDateAndTime(
178 storageInfo->last_modified)) retain]); 180 storageInfo->last_modified)) retain]);
179 } 181 }
180 return self; 182 return self;
181 } 183 }
182 184
183 - (id)initWithAppCacheInfo:(const appcache::AppCacheInfo*)appcacheInfo { 185 - (id)initWithAppCacheInfo:(const appcache::AppCacheInfo*)appcacheInfo {
184 if ((self = [super init])) { 186 if ((self = [super init])) {
185 type_ = kCocoaCookieDetailsTypeTreeAppCache; 187 type_ = kCocoaCookieDetailsTypeTreeAppCache;
186 canEditExpiration_ = NO; 188 canEditExpiration_ = NO;
187 manifestURL_.reset([base::SysUTF8ToNSString( 189 manifestURL_.reset([base::SysUTF8ToNSString(
188 appcacheInfo->manifest_url.spec()) retain]); 190 appcacheInfo->manifest_url.spec()) retain]);
189 fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(appcacheInfo->size, 191 fileSize_.reset([base::SysUTF16ToNSString(
190 GetByteDisplayUnits(appcacheInfo->size), true)) retain]); 192 ui::FormatBytes(appcacheInfo->size,
193 ui::DATA_UNITS_NATURAL, true)) retain]);
191 created_.reset([base::SysUTF16ToNSString( 194 created_.reset([base::SysUTF16ToNSString(
192 base::TimeFormatFriendlyDateAndTime( 195 base::TimeFormatFriendlyDateAndTime(
193 appcacheInfo->creation_time)) retain]); 196 appcacheInfo->creation_time)) retain]);
194 lastAccessed_.reset([base::SysUTF16ToNSString( 197 lastAccessed_.reset([base::SysUTF16ToNSString(
195 base::TimeFormatFriendlyDateAndTime( 198 base::TimeFormatFriendlyDateAndTime(
196 appcacheInfo->last_access_time)) retain]); 199 appcacheInfo->last_access_time)) retain]);
197 } 200 }
198 return self; 201 return self;
199 } 202 }
200 203
201 - (id)initWithDatabase:(const std::string&)domain 204 - (id)initWithDatabase:(const std::string&)domain
202 databaseName:(const string16&)databaseName 205 databaseName:(const string16&)databaseName
203 databaseDescription:(const string16&)databaseDescription 206 databaseDescription:(const string16&)databaseDescription
204 fileSize:(unsigned long)fileSize { 207 fileSize:(unsigned long)fileSize {
205 if ((self = [super init])) { 208 if ((self = [super init])) {
206 type_ = kCocoaCookieDetailsTypePromptDatabase; 209 type_ = kCocoaCookieDetailsTypePromptDatabase;
207 canEditExpiration_ = NO; 210 canEditExpiration_ = NO;
208 name_.reset([base::SysUTF16ToNSString(databaseName) retain]); 211 name_.reset([base::SysUTF16ToNSString(databaseName) retain]);
209 domain_.reset([base::SysUTF8ToNSString(domain) retain]); 212 domain_.reset([base::SysUTF8ToNSString(domain) retain]);
210 databaseDescription_.reset( 213 databaseDescription_.reset(
211 [base::SysUTF16ToNSString(databaseDescription) retain]); 214 [base::SysUTF16ToNSString(databaseDescription) retain]);
212 fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(fileSize, 215 fileSize_.reset([base::SysUTF16ToNSString(ui::FormatBytes(fileSize,
213 GetByteDisplayUnits(fileSize), true)) retain]); 216 ui::DATA_UNITS_NATURAL, true)) retain]);
214 } 217 }
215 return self; 218 return self;
216 } 219 }
217 220
218 - (id)initWithLocalStorage:(const std::string&)domain 221 - (id)initWithLocalStorage:(const std::string&)domain
219 key:(const string16&)key 222 key:(const string16&)key
220 value:(const string16&)value { 223 value:(const string16&)value {
221 if ((self = [super init])) { 224 if ((self = [super init])) {
222 type_ = kCocoaCookieDetailsTypePromptLocalStorage; 225 type_ = kCocoaCookieDetailsTypePromptLocalStorage;
223 canEditExpiration_ = NO; 226 canEditExpiration_ = NO;
(...skipping 12 matching lines...) Expand all
236 } 239 }
237 return self; 240 return self;
238 } 241 }
239 242
240 - (id)initWithIndexedDBInfo: 243 - (id)initWithIndexedDBInfo:
241 (const BrowsingDataIndexedDBHelper::IndexedDBInfo*)indexedDBInfo { 244 (const BrowsingDataIndexedDBHelper::IndexedDBInfo*)indexedDBInfo {
242 if ((self = [super init])) { 245 if ((self = [super init])) {
243 type_ = kCocoaCookieDetailsTypeTreeIndexedDB; 246 type_ = kCocoaCookieDetailsTypeTreeIndexedDB;
244 canEditExpiration_ = NO; 247 canEditExpiration_ = NO;
245 domain_.reset([base::SysUTF8ToNSString(indexedDBInfo->origin) retain]); 248 domain_.reset([base::SysUTF8ToNSString(indexedDBInfo->origin) retain]);
246 fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(indexedDBInfo->size, 249 fileSize_.reset([base::SysUTF16ToNSString(
247 GetByteDisplayUnits(indexedDBInfo->size), true)) retain]); 250 ui::FormatBytes(indexedDBInfo->size,
251 ui::DATA_UNITS_NATURAL, true)) retain]);
248 lastModified_.reset([base::SysUTF16ToNSString( 252 lastModified_.reset([base::SysUTF16ToNSString(
249 base::TimeFormatFriendlyDateAndTime( 253 base::TimeFormatFriendlyDateAndTime(
250 indexedDBInfo->last_modified)) retain]); 254 indexedDBInfo->last_modified)) retain]);
251 } 255 }
252 return self; 256 return self;
253 } 257 }
254 258
255 + (CocoaCookieDetails*)createFromCookieTreeNode:(CookieTreeNode*)treeNode { 259 + (CocoaCookieDetails*)createFromCookieTreeNode:(CookieTreeNode*)treeNode {
256 CookieTreeNode::DetailedInfo info = treeNode->GetDetailedInfo(); 260 CookieTreeNode::DetailedInfo info = treeNode->GetDetailedInfo();
257 CookieTreeNode::DetailedInfo::NodeType nodeType = info.node_type; 261 CookieTreeNode::DetailedInfo::NodeType nodeType = info.node_type;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 details_.reset([details retain]); 294 details_.reset([details retain]);
291 } 295 }
292 return self; 296 return self;
293 } 297 }
294 298
295 - (CocoaCookieDetails*)details { 299 - (CocoaCookieDetails*)details {
296 return details_.get(); 300 return details_.get();
297 } 301 }
298 302
299 @end 303 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698