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

Side by Side Diff: chrome/browser/bookmarks/bookmark_html_writer.cc

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/bookmarks/bookmark_codec.cc ('k') | chrome/browser/bookmarks/bookmark_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bookmarks/bookmark_html_writer.h" 5 #include "chrome/browser/bookmarks/bookmark_html_writer.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/platform_file.h" 12 #include "base/platform_file.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "base/string_util.h" 14 #include "base/string_number_conversions.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "chrome/browser/bookmarks/bookmark_codec.h" 16 #include "chrome/browser/bookmarks/bookmark_codec.h"
17 #include "chrome/browser/bookmarks/bookmark_model.h" 17 #include "chrome/browser/bookmarks/bookmark_model.h"
18 #include "chrome/browser/chrome_thread.h" 18 #include "chrome/browser/chrome_thread.h"
19 #include "chrome/browser/history/history_types.h" 19 #include "chrome/browser/history/history_types.h"
20 #include "chrome/browser/profile.h" 20 #include "chrome/browser/profile.h"
21 #include "chrome/common/notification_service.h" 21 #include "chrome/common/notification_service.h"
22 #include "chrome/common/notification_source.h" 22 #include "chrome/common/notification_source.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "net/base/escape.h" 24 #include "net/base/escape.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 211 }
212 212
213 // Indents the current line. 213 // Indents the current line.
214 bool WriteIndent() { 214 bool WriteIndent() {
215 return Write(indent_); 215 return Write(indent_);
216 } 216 }
217 217
218 // Converts a time string written to the JSON codec into a time_t string 218 // Converts a time string written to the JSON codec into a time_t string
219 // (used by bookmarks.html) and writes it. 219 // (used by bookmarks.html) and writes it.
220 bool WriteTime(const std::string& time_string) { 220 bool WriteTime(const std::string& time_string) {
221 base::Time time = base::Time::FromInternalValue( 221 int64 internal_value;
222 StringToInt64(time_string)); 222 base::StringToInt64(time_string, &internal_value);
223 return Write(Int64ToString(time.ToTimeT())); 223 return Write(base::Int64ToString(
224 base::Time::FromInternalValue(internal_value).ToTimeT()));
224 } 225 }
225 226
226 // Writes the node and all its children, returning true on success. 227 // Writes the node and all its children, returning true on success.
227 bool WriteNode(const DictionaryValue& value, 228 bool WriteNode(const DictionaryValue& value,
228 BookmarkNode::Type folder_type) { 229 BookmarkNode::Type folder_type) {
229 std::string title, date_added_string, type_string; 230 std::string title, date_added_string, type_string;
230 if (!value.GetString(BookmarkCodec::kNameKey, &title) || 231 if (!value.GetString(BookmarkCodec::kNameKey, &title) ||
231 !value.GetString(BookmarkCodec::kDateAddedKey, &date_added_string) || 232 !value.GetString(BookmarkCodec::kDateAddedKey, &date_added_string) ||
232 !value.GetString(BookmarkCodec::kTypeKey, &type_string) || 233 !value.GetString(BookmarkCodec::kTypeKey, &type_string) ||
233 (type_string != BookmarkCodec::kTypeURL && 234 (type_string != BookmarkCodec::kTypeURL &&
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 // BookmarkModel isn't thread safe (nor would we want to lock it down 478 // BookmarkModel isn't thread safe (nor would we want to lock it down
478 // for the duration of the write), as such we make a copy of the 479 // for the duration of the write), as such we make a copy of the
479 // BookmarkModel using BookmarkCodec then write from that. 480 // BookmarkModel using BookmarkCodec then write from that.
480 if (fetcher == NULL) { 481 if (fetcher == NULL) {
481 fetcher = new BookmarkFaviconFetcher(profile, path, observer); 482 fetcher = new BookmarkFaviconFetcher(profile, path, observer);
482 fetcher->ExportBookmarks(); 483 fetcher->ExportBookmarks();
483 } 484 }
484 } 485 }
485 486
486 } // namespace bookmark_html_writer 487 } // namespace bookmark_html_writer
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_codec.cc ('k') | chrome/browser/bookmarks/bookmark_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698