OLD | NEW |
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 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_HTML_WRITER_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_HTML_WRITER_H_ |
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_HTML_WRITER_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_HTML_WRITER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/ref_counted_memory.h" | 14 #include "base/memory/ref_counted_memory.h" |
15 #include "chrome/common/cancelable_task_tracker.h" | 15 #include "base/task/cancelable_task_tracker.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 | 18 |
19 class BookmarkNode; | 19 class BookmarkNode; |
20 class Profile; | 20 class Profile; |
21 | 21 |
22 namespace chrome { | 22 namespace chrome { |
23 struct FaviconBitmapResult; | 23 struct FaviconBitmapResult; |
24 } | 24 } |
25 | 25 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 void OnFaviconDataAvailable(const chrome::FaviconBitmapResult& bitmap_result); | 72 void OnFaviconDataAvailable(const chrome::FaviconBitmapResult& bitmap_result); |
73 | 73 |
74 // The Profile object used for accessing FaviconService, bookmarks model. | 74 // The Profile object used for accessing FaviconService, bookmarks model. |
75 Profile* profile_; | 75 Profile* profile_; |
76 | 76 |
77 // All URLs that are extracted from bookmarks. Used to fetch favicons | 77 // All URLs that are extracted from bookmarks. Used to fetch favicons |
78 // for each of them. After favicon is fetched top url is removed from list. | 78 // for each of them. After favicon is fetched top url is removed from list. |
79 std::list<std::string> bookmark_urls_; | 79 std::list<std::string> bookmark_urls_; |
80 | 80 |
81 // Tracks favicon tasks. | 81 // Tracks favicon tasks. |
82 CancelableTaskTracker cancelable_task_tracker_; | 82 base::CancelableTaskTracker cancelable_task_tracker_; |
83 | 83 |
84 // Map that stores favicon per URL. | 84 // Map that stores favicon per URL. |
85 scoped_ptr<URLFaviconMap> favicons_map_; | 85 scoped_ptr<URLFaviconMap> favicons_map_; |
86 | 86 |
87 // Path where html output is stored. | 87 // Path where html output is stored. |
88 base::FilePath path_; | 88 base::FilePath path_; |
89 | 89 |
90 BookmarksExportObserver* observer_; | 90 BookmarksExportObserver* observer_; |
91 | 91 |
92 content::NotificationRegistrar registrar_; | 92 content::NotificationRegistrar registrar_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(BookmarkFaviconFetcher); | 94 DISALLOW_COPY_AND_ASSIGN(BookmarkFaviconFetcher); |
95 }; | 95 }; |
96 | 96 |
97 namespace bookmark_html_writer { | 97 namespace bookmark_html_writer { |
98 | 98 |
99 // Writes the bookmarks out in the 'bookmarks.html' format understood by | 99 // Writes the bookmarks out in the 'bookmarks.html' format understood by |
100 // Firefox and IE. The results are written to the file at |path|. The file | 100 // Firefox and IE. The results are written to the file at |path|. The file |
101 // thread is used. | 101 // thread is used. |
102 // Before writing to the file favicons are fetched on the main thread. | 102 // Before writing to the file favicons are fetched on the main thread. |
103 // TODO(sky): need a callback on failure. | 103 // TODO(sky): need a callback on failure. |
104 void WriteBookmarks(Profile* profile, | 104 void WriteBookmarks(Profile* profile, |
105 const base::FilePath& path, | 105 const base::FilePath& path, |
106 BookmarksExportObserver* observer); | 106 BookmarksExportObserver* observer); |
107 | 107 |
108 } // namespace bookmark_html_writer | 108 } // namespace bookmark_html_writer |
109 | 109 |
110 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_HTML_WRITER_H_ | 110 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_HTML_WRITER_H_ |
OLD | NEW |