OLD | NEW |
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" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 std::string url_string; | 242 std::string url_string; |
243 if (!value.GetString(BookmarkCodec::kURLKey, &url_string)) { | 243 if (!value.GetString(BookmarkCodec::kURLKey, &url_string)) { |
244 NOTREACHED(); | 244 NOTREACHED(); |
245 return false; | 245 return false; |
246 } | 246 } |
247 | 247 |
248 std::string favicon_string; | 248 std::string favicon_string; |
249 BookmarkFaviconFetcher::URLFaviconMap::iterator itr = | 249 BookmarkFaviconFetcher::URLFaviconMap::iterator itr = |
250 favicons_map_->find(url_string); | 250 favicons_map_->find(url_string); |
251 if (itr != favicons_map_->end()) { | 251 if (itr != favicons_map_->end()) { |
252 scoped_refptr<RefCountedMemory> data = itr->second.get(); | 252 scoped_refptr<RefCountedMemory> data(itr->second.get()); |
253 std::string favicon_data; | 253 std::string favicon_data; |
254 favicon_data.assign(reinterpret_cast<const char*>(data->front()), | 254 favicon_data.assign(reinterpret_cast<const char*>(data->front()), |
255 data->size()); | 255 data->size()); |
256 std::string favicon_base64_encoded; | 256 std::string favicon_base64_encoded; |
257 if (base::Base64Encode(favicon_data, &favicon_base64_encoded)) { | 257 if (base::Base64Encode(favicon_data, &favicon_base64_encoded)) { |
258 GURL favicon_url("data:image/png;base64," + favicon_base64_encoded); | 258 GURL favicon_url("data:image/png;base64," + favicon_base64_encoded); |
259 favicon_string = favicon_url.spec(); | 259 favicon_string = favicon_url.spec(); |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 // BookmarkModel isn't thread safe (nor would we want to lock it down | 479 // BookmarkModel isn't thread safe (nor would we want to lock it down |
480 // for the duration of the write), as such we make a copy of the | 480 // for the duration of the write), as such we make a copy of the |
481 // BookmarkModel using BookmarkCodec then write from that. | 481 // BookmarkModel using BookmarkCodec then write from that. |
482 if (fetcher == NULL) { | 482 if (fetcher == NULL) { |
483 fetcher = new BookmarkFaviconFetcher(profile, path, observer); | 483 fetcher = new BookmarkFaviconFetcher(profile, path, observer); |
484 fetcher->ExportBookmarks(); | 484 fetcher->ExportBookmarks(); |
485 } | 485 } |
486 } | 486 } |
487 | 487 |
488 } // namespace bookmark_html_writer | 488 } // namespace bookmark_html_writer |
OLD | NEW |