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

Side by Side Diff: chrome/browser/profile_import_process_host.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_PROFILE_IMPORT_PROCESS_HOST_H_ 5 #ifndef CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_
6 #define CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_ 6 #define CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 17 matching lines...) Expand all
28 class ProfileImportProcessHost : public BrowserChildProcessHost { 28 class ProfileImportProcessHost : public BrowserChildProcessHost {
29 public: 29 public:
30 30
31 // An interface that must be implemented by consumers of the profile import 31 // An interface that must be implemented by consumers of the profile import
32 // process in order to get results back from the process host. The 32 // process in order to get results back from the process host. The
33 // ProfileImportProcessHost calls the client's functions on the thread passed 33 // ProfileImportProcessHost calls the client's functions on the thread passed
34 // to it when it's created. 34 // to it when it's created.
35 class ImportProcessClient : 35 class ImportProcessClient :
36 public base::RefCountedThreadSafe<ImportProcessClient> { 36 public base::RefCountedThreadSafe<ImportProcessClient> {
37 public: 37 public:
38 ImportProcessClient() {} 38 ImportProcessClient();
39 39
40 // These methods are used by the ProfileImportProcessHost to pass messages 40 // These methods are used by the ProfileImportProcessHost to pass messages
41 // received from the external process back to the ImportProcessClient in 41 // received from the external process back to the ImportProcessClient in
42 // ImporterHost. 42 // ImporterHost.
43 virtual void OnProcessCrashed() {} 43 virtual void OnProcessCrashed() {}
44 virtual void OnImportStart() {} 44 virtual void OnImportStart() {}
45 virtual void OnImportFinished(bool succeeded, std::string error_msg) {} 45 virtual void OnImportFinished(bool succeeded, std::string error_msg) {}
46 virtual void OnImportItemStart(int item) {} 46 virtual void OnImportItemStart(int item) {}
47 virtual void OnImportItemFinished(int item) {} 47 virtual void OnImportItemFinished(int item) {}
48 virtual void OnImportItemFailed(std::string error_msg) {} 48 virtual void OnImportItemFailed(std::string error_msg) {}
(...skipping 23 matching lines...) Expand all
72 72
73 virtual void OnKeywordsImportReady( 73 virtual void OnKeywordsImportReady(
74 const std::vector<TemplateURL>& template_urls, 74 const std::vector<TemplateURL>& template_urls,
75 int default_keyword_index, bool unique_on_host_and_path) {} 75 int default_keyword_index, bool unique_on_host_and_path) {}
76 76
77 virtual void OnMessageReceived(const IPC::Message& message); 77 virtual void OnMessageReceived(const IPC::Message& message);
78 78
79 protected: 79 protected:
80 friend class base::RefCountedThreadSafe<ImportProcessClient>; 80 friend class base::RefCountedThreadSafe<ImportProcessClient>;
81 81
82 virtual ~ImportProcessClient() {} 82 virtual ~ImportProcessClient();
83 83
84 private: 84 private:
85 friend class ProfileImportProcessHost; 85 friend class ProfileImportProcessHost;
86 86
87 DISALLOW_COPY_AND_ASSIGN(ImportProcessClient); 87 DISALLOW_COPY_AND_ASSIGN(ImportProcessClient);
88 }; 88 };
89 89
90 // |resource_dispatcher| is used in the base BrowserChildProcessHost class to 90 // |resource_dispatcher| is used in the base BrowserChildProcessHost class to
91 // manage IPC requests. 91 // manage IPC requests.
92 // |import_process_client| implements callbacks which are triggered by 92 // |import_process_client| implements callbacks which are triggered by
93 // incoming IPC messages. This client creates an interface between IPC 93 // incoming IPC messages. This client creates an interface between IPC
94 // messages received by the ProfileImportProcessHost and the internal 94 // messages received by the ProfileImportProcessHost and the internal
95 // importer_bridge. 95 // importer_bridge.
96 // |thread_id| gives the thread where the client lives. The 96 // |thread_id| gives the thread where the client lives. The
97 // ProfileImportProcessHost spawns tasks on this thread for the client. 97 // ProfileImportProcessHost spawns tasks on this thread for the client.
98 ProfileImportProcessHost(ResourceDispatcherHost* resource_dispatcher, 98 ProfileImportProcessHost(ResourceDispatcherHost* resource_dispatcher,
99 ImportProcessClient* import_process_client, 99 ImportProcessClient* import_process_client,
100 ChromeThread::ID thread_id); 100 ChromeThread::ID thread_id);
101 virtual ~ProfileImportProcessHost();
101 102
102 // |profile_info|, |items|, and |import_to_bookmark_bar| are all needed by 103 // |profile_info|, |items|, and |import_to_bookmark_bar| are all needed by
103 // the external importer process. 104 // the external importer process.
104 bool StartProfileImportProcess(const importer::ProfileInfo& profile_info, 105 bool StartProfileImportProcess(const importer::ProfileInfo& profile_info,
105 int items, bool import_to_bookmark_bar); 106 int items, bool import_to_bookmark_bar);
106 107
107 // Cancel the external import process. 108 // Cancel the external import process.
108 bool CancelProfileImportProcess(); 109 bool CancelProfileImportProcess();
109 110
110 // Report that an item has been successfully imported. We need to make 111 // Report that an item has been successfully imported. We need to make
111 // sure that all import messages have come across the wire before the 112 // sure that all import messages have come across the wire before the
112 // external import process shuts itself down. 113 // external import process shuts itself down.
113 bool ReportImportItemFinished(importer::ImportItem item); 114 bool ReportImportItemFinished(importer::ImportItem item);
114 115
115 protected: 116 protected:
116 // Allow these methods to be overridden for tests. 117 // Allow these methods to be overridden for tests.
117 virtual FilePath GetProfileImportProcessCmd(); 118 virtual FilePath GetProfileImportProcessCmd();
118 119
119 private: 120 private:
120 // Launch the new process. 121 // Launch the new process.
121 bool StartProcess(); 122 bool StartProcess();
122 123
123 // Called by the external importer process to send messages back to the 124 // Called by the external importer process to send messages back to the
124 // ImportProcessClient. 125 // ImportProcessClient.
125 void OnMessageReceived(const IPC::Message& message); 126 void OnMessageReceived(const IPC::Message& message);
126 127
127 // Overridden from BrowserChildProcessHost: 128 // Overridden from BrowserChildProcessHost:
128 virtual void OnProcessCrashed(); 129 virtual void OnProcessCrashed();
129 virtual bool CanShutdown() { return true; } 130 virtual bool CanShutdown();
130 virtual URLRequestContext* GetRequestContext( 131 virtual URLRequestContext* GetRequestContext(
131 uint32 request_id, 132 uint32 request_id,
132 const ViewHostMsg_Resource_Request& request_data) { 133 const ViewHostMsg_Resource_Request& request_data);
133 return NULL;
134 }
135 134
136 // Receives messages to be passed back to the importer host. 135 // Receives messages to be passed back to the importer host.
137 scoped_refptr<ImportProcessClient> import_process_client_; 136 scoped_refptr<ImportProcessClient> import_process_client_;
138 137
139 // The thread where the import_process_client_ lives. 138 // The thread where the import_process_client_ lives.
140 ChromeThread::ID thread_id_; 139 ChromeThread::ID thread_id_;
141 140
142 DISALLOW_COPY_AND_ASSIGN(ProfileImportProcessHost); 141 DISALLOW_COPY_AND_ASSIGN(ProfileImportProcessHost);
143 }; 142 };
144 143
145 #endif // CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_ 144 #endif // CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698