OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_IMPORTER_PROFILE_WRITER_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_PROFILE_WRITER_H_ |
6 #define CHROME_BROWSER_IMPORTER_PROFILE_WRITER_H_ | 6 #define CHROME_BROWSER_IMPORTER_PROFILE_WRITER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
27 struct IE7PasswordInfo; | 27 struct IE7PasswordInfo; |
28 #endif | 28 #endif |
29 | 29 |
30 // ProfileWriter encapsulates profile for writing entries into it. | 30 // ProfileWriter encapsulates profile for writing entries into it. |
31 // This object must be invoked on UI thread. | 31 // This object must be invoked on UI thread. |
32 class ProfileWriter : public base::RefCountedThreadSafe<ProfileWriter> { | 32 class ProfileWriter : public base::RefCountedThreadSafe<ProfileWriter> { |
33 public: | 33 public: |
34 // Used to identify how the bookmarks are added. | 34 // Used to identify how the bookmarks are added. |
35 enum BookmarkOptions { | 35 enum BookmarkOptions { |
36 // Indicates the bookmark should only be added if unique. Uniqueness | 36 // Indicates the bookmark should only be added if unique. Uniqueness is done |
37 // is done by title, url and path. That is, if this is passed to | 37 // by title, url and path. That is, if this is passed to AddBookmarks, the |
38 // AddBookmarkEntry the bookmark is added only if there is no other | 38 // bookmark is added only if there is no other URL with the same url, path |
39 // URL with the same url, path and title. | 39 // and title. |
40 ADD_IF_UNIQUE = 1 << 0, | 40 ADD_IF_UNIQUE = 1 << 0, |
41 | 41 |
42 // Indicates the bookmarks should be added to the bookmark bar. | 42 // Indicates the bookmarks should be added to the bookmark bar. |
43 IMPORT_TO_BOOKMARK_BAR = 1 << 1, | 43 IMPORT_TO_BOOKMARK_BAR = 1 << 1, |
44 | 44 |
45 // Indicates the bookmark bar is not shown. | 45 // Indicates the bookmark bar is not shown. |
46 BOOKMARK_BAR_DISABLED = 1 << 2 | 46 BOOKMARK_BAR_DISABLED = 1 << 2 |
47 }; | 47 }; |
48 | 48 |
49 struct BookmarkEntry { | 49 struct BookmarkEntry { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // which bookmarks are added. If the bitmask contains IMPORT_TO_BOOKMARK_BAR, | 83 // which bookmarks are added. If the bitmask contains IMPORT_TO_BOOKMARK_BAR, |
84 // then any entries with a value of true for in_toolbar are added to | 84 // then any entries with a value of true for in_toolbar are added to |
85 // the bookmark bar. If the bitmask does not contain IMPORT_TO_BOOKMARK_BAR | 85 // the bookmark bar. If the bitmask does not contain IMPORT_TO_BOOKMARK_BAR |
86 // then the folder name the bookmarks are added to is uniqued based on | 86 // then the folder name the bookmarks are added to is uniqued based on |
87 // |first_folder_name|. For example, if |first_folder_name| is 'foo' | 87 // |first_folder_name|. For example, if |first_folder_name| is 'foo' |
88 // and a folder with the name 'foo' already exists in the other | 88 // and a folder with the name 'foo' already exists in the other |
89 // bookmarks folder, then the folder name 'foo 2' is used. | 89 // bookmarks folder, then the folder name 'foo 2' is used. |
90 // If |options| contains ADD_IF_UNIQUE, then the bookmark is added only | 90 // If |options| contains ADD_IF_UNIQUE, then the bookmark is added only |
91 // if another bookmarks does not exist with the same title, path and | 91 // if another bookmarks does not exist with the same title, path and |
92 // url. | 92 // url. |
93 virtual void AddBookmarkEntry(const std::vector<BookmarkEntry>& bookmark, | 93 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmark, |
94 const string16& first_folder_name, | 94 const string16& first_folder_name, |
95 int options); | 95 int options); |
96 | 96 |
97 virtual void AddFavicons( | 97 virtual void AddFavicons( |
98 const std::vector<history::ImportedFaviconUsage>& favicons); | 98 const std::vector<history::ImportedFaviconUsage>& favicons); |
99 | 99 |
100 // Add the TemplateURLs in |template_urls| to the local store and make the | 100 // Add the TemplateURLs in |template_urls| to the local store and make the |
101 // TemplateURL at |default_keyword_index| the default keyword (does not set | 101 // TemplateURL at |default_keyword_index| the default keyword (does not set |
102 // a default keyword if it is -1). The local store becomes the owner of the | 102 // a default keyword if it is -1). The local store becomes the owner of the |
103 // TemplateURLs. Some TemplateURLs in |template_urls| may conflict (same | 103 // TemplateURLs. Some TemplateURLs in |template_urls| may conflict (same |
104 // keyword or same host name in the URL) with existing TemplateURLs in the | 104 // keyword or same host name in the URL) with existing TemplateURLs in the |
105 // local store, in which case the existing ones takes precedence and the | 105 // local store, in which case the existing ones takes precedence and the |
(...skipping 27 matching lines...) Expand all Loading... |
133 const BookmarkEntry& entry, | 133 const BookmarkEntry& entry, |
134 const string16& first_folder_name, | 134 const string16& first_folder_name, |
135 bool import_to_bookmark_bar); | 135 bool import_to_bookmark_bar); |
136 | 136 |
137 Profile* const profile_; | 137 Profile* const profile_; |
138 | 138 |
139 DISALLOW_COPY_AND_ASSIGN(ProfileWriter); | 139 DISALLOW_COPY_AND_ASSIGN(ProfileWriter); |
140 }; | 140 }; |
141 | 141 |
142 #endif // CHROME_BROWSER_IMPORTER_PROFILE_WRITER_H_ | 142 #endif // CHROME_BROWSER_IMPORTER_PROFILE_WRITER_H_ |
OLD | NEW |