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

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

Issue 10272004: Move RefCountedMemory class to base namespace. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 7 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) 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"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/ref_counted_memory.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop.h" 15 #include "base/message_loop.h"
15 #include "base/platform_file.h" 16 #include "base/platform_file.h"
16 #include "base/string_number_conversions.h" 17 #include "base/string_number_conversions.h"
17 #include "base/time.h" 18 #include "base/time.h"
18 #include "base/values.h" 19 #include "base/values.h"
19 #include "chrome/browser/bookmarks/bookmark_codec.h" 20 #include "chrome/browser/bookmarks/bookmark_codec.h"
20 #include "chrome/browser/bookmarks/bookmark_model.h" 21 #include "chrome/browser/bookmarks/bookmark_model.h"
21 #include "chrome/browser/history/history_types.h" 22 #include "chrome/browser/history/history_types.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 std::string url_string; 255 std::string url_string;
255 if (!value.GetString(BookmarkCodec::kURLKey, &url_string)) { 256 if (!value.GetString(BookmarkCodec::kURLKey, &url_string)) {
256 NOTREACHED(); 257 NOTREACHED();
257 return false; 258 return false;
258 } 259 }
259 260
260 std::string favicon_string; 261 std::string favicon_string;
261 BookmarkFaviconFetcher::URLFaviconMap::iterator itr = 262 BookmarkFaviconFetcher::URLFaviconMap::iterator itr =
262 favicons_map_->find(url_string); 263 favicons_map_->find(url_string);
263 if (itr != favicons_map_->end()) { 264 if (itr != favicons_map_->end()) {
264 scoped_refptr<RefCountedMemory> data(itr->second.get()); 265 scoped_refptr<base::RefCountedMemory> data(itr->second.get());
265 std::string favicon_data; 266 std::string favicon_data;
266 favicon_data.assign(reinterpret_cast<const char*>(data->front()), 267 favicon_data.assign(reinterpret_cast<const char*>(data->front()),
267 data->size()); 268 data->size());
268 std::string favicon_base64_encoded; 269 std::string favicon_base64_encoded;
269 if (base::Base64Encode(favicon_data, &favicon_base64_encoded)) { 270 if (base::Base64Encode(favicon_data, &favicon_base64_encoded)) {
270 GURL favicon_url("data:image/png;base64," + favicon_base64_encoded); 271 GURL favicon_url("data:image/png;base64," + favicon_base64_encoded);
271 favicon_string = favicon_url.spec(); 272 favicon_string = favicon_url.spec();
272 } 273 }
273 } 274 }
274 275
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // BookmarkModel isn't thread safe (nor would we want to lock it down 494 // BookmarkModel isn't thread safe (nor would we want to lock it down
494 // for the duration of the write), as such we make a copy of the 495 // for the duration of the write), as such we make a copy of the
495 // BookmarkModel using BookmarkCodec then write from that. 496 // BookmarkModel using BookmarkCodec then write from that.
496 if (fetcher == NULL) { 497 if (fetcher == NULL) {
497 fetcher = new BookmarkFaviconFetcher(profile, path, observer); 498 fetcher = new BookmarkFaviconFetcher(profile, path, observer);
498 fetcher->ExportBookmarks(); 499 fetcher->ExportBookmarks();
499 } 500 }
500 } 501 }
501 502
502 } // namespace bookmark_html_writer 503 } // namespace bookmark_html_writer
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_html_writer.h ('k') | chrome/browser/extensions/extension_web_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698