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

Side by Side Diff: chrome/browser/importer/profile_writer.h

Issue 3522004: FBTF: Move ctors/dtors into implementation files. Adds ctors/dtors to non-POD structs. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 2 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
OLDNEW
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 #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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 30 matching lines...) Expand all
41 // URL with the same url, path and title. 41 // URL with the same url, path and title.
42 ADD_IF_UNIQUE = 1 << 0, 42 ADD_IF_UNIQUE = 1 << 0,
43 43
44 // Indicates the bookmarks should be added to the bookmark bar. 44 // Indicates the bookmarks should be added to the bookmark bar.
45 IMPORT_TO_BOOKMARK_BAR = 1 << 1, 45 IMPORT_TO_BOOKMARK_BAR = 1 << 1,
46 46
47 // Indicates the bookmark bar is not shown. 47 // Indicates the bookmark bar is not shown.
48 BOOKMARK_BAR_DISABLED = 1 << 2 48 BOOKMARK_BAR_DISABLED = 1 << 2
49 }; 49 };
50 50
51 explicit ProfileWriter(Profile* profile) : profile_(profile) {}
52
53 // These functions return true if the corresponding model has been loaded.
54 // If the models haven't been loaded, the importer waits to run until they've
55 // completed.
56 virtual bool BookmarkModelIsLoaded() const;
57 virtual bool TemplateURLModelIsLoaded() const;
58
59 // A bookmark entry. 51 // A bookmark entry.
60 // TODO(mirandac): remove instances of wstring from ProfileWriter 52 // TODO(mirandac): remove instances of wstring from ProfileWriter
61 // (http://crbug.com/43460). 53 // (http://crbug.com/43460).
62 struct BookmarkEntry { 54 struct BookmarkEntry {
63 BookmarkEntry() : in_toolbar(false) {} 55 BookmarkEntry();
56 ~BookmarkEntry();
57
64 bool in_toolbar; 58 bool in_toolbar;
65 GURL url; 59 GURL url;
66 std::vector<std::wstring> path; 60 std::vector<std::wstring> path;
67 std::wstring title; 61 std::wstring title;
68 base::Time creation_time; 62 base::Time creation_time;
69 }; 63 };
70 64
65 explicit ProfileWriter(Profile* profile);
66
67 // These functions return true if the corresponding model has been loaded.
68 // If the models haven't been loaded, the importer waits to run until they've
69 // completed.
70 virtual bool BookmarkModelIsLoaded() const;
71 virtual bool TemplateURLModelIsLoaded() const;
72
71 // Helper methods for adding data to local stores. 73 // Helper methods for adding data to local stores.
72 virtual void AddPasswordForm(const webkit_glue::PasswordForm& form); 74 virtual void AddPasswordForm(const webkit_glue::PasswordForm& form);
73 #if defined(OS_WIN) 75 #if defined(OS_WIN)
74 virtual void AddIE7PasswordInfo(const IE7PasswordInfo& info); 76 virtual void AddIE7PasswordInfo(const IE7PasswordInfo& info);
75 #endif 77 #endif
76 virtual void AddHistoryPage(const std::vector<history::URLRow>& page, 78 virtual void AddHistoryPage(const std::vector<history::URLRow>& page,
77 history::VisitSource visit_source); 79 history::VisitSource visit_source);
78 virtual void AddHomepage(const GURL& homepage); 80 virtual void AddHomepage(const GURL& homepage);
79 // Adds the bookmarks to the BookmarkModel. 81 // Adds the bookmarks to the BookmarkModel.
80 // |options| is a bitmask of BookmarkOptions and dictates how and 82 // |options| is a bitmask of BookmarkOptions and dictates how and
(...skipping 27 matching lines...) Expand all
108 bool unique_on_host_and_path); 110 bool unique_on_host_and_path);
109 111
110 // Shows the bookmarks toolbar. 112 // Shows the bookmarks toolbar.
111 void ShowBookmarkBar(); 113 void ShowBookmarkBar();
112 114
113 Profile* profile() const { return profile_; } 115 Profile* profile() const { return profile_; }
114 116
115 protected: 117 protected:
116 friend class base::RefCountedThreadSafe<ProfileWriter>; 118 friend class base::RefCountedThreadSafe<ProfileWriter>;
117 119
118 virtual ~ProfileWriter() {} 120 virtual ~ProfileWriter();
119 121
120 private: 122 private:
121 // Generates a unique folder name. If folder_name is not unique, then this 123 // Generates a unique folder name. If folder_name is not unique, then this
122 // repeatedly tests for '|folder_name| + (i)' until a unique name is found. 124 // repeatedly tests for '|folder_name| + (i)' until a unique name is found.
123 std::wstring GenerateUniqueFolderName(BookmarkModel* model, 125 std::wstring GenerateUniqueFolderName(BookmarkModel* model,
124 const std::wstring& folder_name); 126 const std::wstring& folder_name);
125 127
126 // Returns true if a bookmark exists with the same url, title and path 128 // Returns true if a bookmark exists with the same url, title and path
127 // as |entry|. |first_folder_name| is the name to use for the first 129 // as |entry|. |first_folder_name| is the name to use for the first
128 // path entry if |import_to_bookmark_bar| is true. 130 // path entry if |import_to_bookmark_bar| is true.
129 bool DoesBookmarkExist(BookmarkModel* model, 131 bool DoesBookmarkExist(BookmarkModel* model,
130 const BookmarkEntry& entry, 132 const BookmarkEntry& entry,
131 const std::wstring& first_folder_name, 133 const std::wstring& first_folder_name,
132 bool import_to_bookmark_bar); 134 bool import_to_bookmark_bar);
133 135
134 Profile* const profile_; 136 Profile* const profile_;
135 137
136 DISALLOW_COPY_AND_ASSIGN(ProfileWriter); 138 DISALLOW_COPY_AND_ASSIGN(ProfileWriter);
137 }; 139 };
138 140
139 #endif // CHROME_BROWSER_IMPORTER_PROFILE_WRITER_H_ 141 #endif // CHROME_BROWSER_IMPORTER_PROFILE_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698