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

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

Issue 86913002: Make base::Base64Encode() return void (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: One more chromeos-specific fix. Created 7 years 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
« no previous file with comments | « base/base64_unittest.cc ('k') | chrome/browser/chromeos/settings/device_settings_cache.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) 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/bookmarks/bookmark_html_writer.h" 5 #include "chrome/browser/bookmarks/bookmark_html_writer.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 std::string favicon_string; 264 std::string favicon_string;
265 BookmarkFaviconFetcher::URLFaviconMap::iterator itr = 265 BookmarkFaviconFetcher::URLFaviconMap::iterator itr =
266 favicons_map_->find(url_string); 266 favicons_map_->find(url_string);
267 if (itr != favicons_map_->end()) { 267 if (itr != favicons_map_->end()) {
268 scoped_refptr<base::RefCountedMemory> data(itr->second.get()); 268 scoped_refptr<base::RefCountedMemory> data(itr->second.get());
269 std::string favicon_data; 269 std::string favicon_data;
270 favicon_data.assign(reinterpret_cast<const char*>(data->front()), 270 favicon_data.assign(reinterpret_cast<const char*>(data->front()),
271 data->size()); 271 data->size());
272 std::string favicon_base64_encoded; 272 std::string favicon_base64_encoded;
273 if (base::Base64Encode(favicon_data, &favicon_base64_encoded)) { 273 base::Base64Encode(favicon_data, &favicon_base64_encoded);
274 GURL favicon_url("data:image/png;base64," + favicon_base64_encoded); 274 GURL favicon_url("data:image/png;base64," + favicon_base64_encoded);
275 favicon_string = favicon_url.spec(); 275 favicon_string = favicon_url.spec();
276 }
277 } 276 }
278 277
279 if (!WriteIndent() || 278 if (!WriteIndent() ||
280 !Write(kBookmarkStart) || 279 !Write(kBookmarkStart) ||
281 !Write(url_string, ATTRIBUTE_VALUE) || 280 !Write(url_string, ATTRIBUTE_VALUE) ||
282 !Write(kAddDate) || 281 !Write(kAddDate) ||
283 !WriteTime(date_added_string) || 282 !WriteTime(date_added_string) ||
284 (!favicon_string.empty() && 283 (!favicon_string.empty() &&
285 (!Write(kIcon) || 284 (!Write(kIcon) ||
286 !Write(favicon_string, ATTRIBUTE_VALUE))) || 285 !Write(favicon_string, ATTRIBUTE_VALUE))) ||
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // BookmarkModel isn't thread safe (nor would we want to lock it down 501 // BookmarkModel isn't thread safe (nor would we want to lock it down
503 // for the duration of the write), as such we make a copy of the 502 // for the duration of the write), as such we make a copy of the
504 // BookmarkModel using BookmarkCodec then write from that. 503 // BookmarkModel using BookmarkCodec then write from that.
505 if (fetcher == NULL) { 504 if (fetcher == NULL) {
506 fetcher = new BookmarkFaviconFetcher(profile, path, observer); 505 fetcher = new BookmarkFaviconFetcher(profile, path, observer);
507 fetcher->ExportBookmarks(); 506 fetcher->ExportBookmarks();
508 } 507 }
509 } 508 }
510 509
511 } // namespace bookmark_html_writer 510 } // namespace bookmark_html_writer
OLDNEW
« no previous file with comments | « base/base64_unittest.cc ('k') | chrome/browser/chromeos/settings/device_settings_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698