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> |
(...skipping 28 matching lines...) Expand all Loading... |
39 // Should be used only by WriteBookmarks function. | 39 // Should be used only by WriteBookmarks function. |
40 class BookmarkFaviconFetcher: public content::NotificationObserver { | 40 class BookmarkFaviconFetcher: public content::NotificationObserver { |
41 public: | 41 public: |
42 // Map of URL and corresponding favicons. | 42 // Map of URL and corresponding favicons. |
43 typedef std::map<std::string, scoped_refptr<base::RefCountedMemory> > | 43 typedef std::map<std::string, scoped_refptr<base::RefCountedMemory> > |
44 URLFaviconMap; | 44 URLFaviconMap; |
45 | 45 |
46 BookmarkFaviconFetcher(Profile* profile, | 46 BookmarkFaviconFetcher(Profile* profile, |
47 const base::FilePath& path, | 47 const base::FilePath& path, |
48 BookmarksExportObserver* observer); | 48 BookmarksExportObserver* observer); |
49 virtual ~BookmarkFaviconFetcher(); | 49 ~BookmarkFaviconFetcher() override; |
50 | 50 |
51 // Executes bookmark export process. | 51 // Executes bookmark export process. |
52 void ExportBookmarks(); | 52 void ExportBookmarks(); |
53 | 53 |
54 // content::NotificationObserver implementation. | 54 // content::NotificationObserver implementation. |
55 virtual void Observe(int type, | 55 void Observe(int type, |
56 const content::NotificationSource& source, | 56 const content::NotificationSource& source, |
57 const content::NotificationDetails& details) override; | 57 const content::NotificationDetails& details) override; |
58 | 58 |
59 private: | 59 private: |
60 // Recursively extracts URLs from bookmarks. | 60 // Recursively extracts URLs from bookmarks. |
61 void ExtractUrls(const BookmarkNode* node); | 61 void ExtractUrls(const BookmarkNode* node); |
62 | 62 |
63 // Executes Writer task that writes bookmarks data to html file. | 63 // Executes Writer task that writes bookmarks data to html file. |
64 void ExecuteWriter(); | 64 void ExecuteWriter(); |
65 | 65 |
66 // Starts async fetch for the next bookmark favicon. | 66 // Starts async fetch for the next bookmark favicon. |
67 // Takes single url from bookmark_urls_ and removes it from the list. | 67 // Takes single url from bookmark_urls_ and removes it from the list. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // thread is used. | 103 // thread is used. |
104 // Before writing to the file favicons are fetched on the main thread. | 104 // Before writing to the file favicons are fetched on the main thread. |
105 // TODO(sky): need a callback on failure. | 105 // TODO(sky): need a callback on failure. |
106 void WriteBookmarks(Profile* profile, | 106 void WriteBookmarks(Profile* profile, |
107 const base::FilePath& path, | 107 const base::FilePath& path, |
108 BookmarksExportObserver* observer); | 108 BookmarksExportObserver* observer); |
109 | 109 |
110 } // namespace bookmark_html_writer | 110 } // namespace bookmark_html_writer |
111 | 111 |
112 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_HTML_WRITER_H_ | 112 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_HTML_WRITER_H_ |
OLD | NEW |