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

Side by Side Diff: chrome/browser/profile_import_process_host.h

Issue 2885017: Moved common parts of ChildProcessHost into chrome/common and created a Brows... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Code review changes Created 10 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/plugin_service.cc ('k') | chrome/browser/profile_import_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
13 #include "base/task.h" 13 #include "base/task.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/child_process_host.h" 15 #include "chrome/browser/browser_child_process_host.h"
16 #include "chrome/browser/chrome_thread.h" 16 #include "chrome/browser/chrome_thread.h"
17 #include "chrome/browser/history/history_types.h" 17 #include "chrome/browser/history/history_types.h"
18 #include "chrome/browser/importer/importer_data_types.h" 18 #include "chrome/browser/importer/importer_data_types.h"
19 #include "chrome/browser/importer/profile_writer.h" 19 #include "chrome/browser/importer/profile_writer.h"
20 #include "ipc/ipc_channel.h" 20 #include "ipc/ipc_channel.h"
21 21
22 namespace webkit_glue { 22 namespace webkit_glue {
23 struct PasswordForm; 23 struct PasswordForm;
24 } 24 }
25 25
26 // Browser-side host to a profile import process. This class lives only on 26 // Browser-side host to a profile import process. This class lives only on
27 // the IO thread. It passes messages back to the |thread_id_| thread through 27 // the IO thread. It passes messages back to the |thread_id_| thread through
28 // a client object. 28 // a client object.
29 class ProfileImportProcessHost : public ChildProcessHost { 29 class ProfileImportProcessHost : public BrowserChildProcessHost {
30 public: 30 public:
31 31
32 // An interface that must be implemented by consumers of the profile import 32 // An interface that must be implemented by consumers of the profile import
33 // process in order to get results back from the process host. The 33 // process in order to get results back from the process host. The
34 // ProfileImportProcessHost calls the client's functions on the thread passed 34 // ProfileImportProcessHost calls the client's functions on the thread passed
35 // to it when it's created. 35 // to it when it's created.
36 class ImportProcessClient : 36 class ImportProcessClient :
37 public base::RefCountedThreadSafe<ImportProcessClient> { 37 public base::RefCountedThreadSafe<ImportProcessClient> {
38 public: 38 public:
39 ImportProcessClient() {} 39 ImportProcessClient() {}
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ChildProcessHost class to manage 90 // |resource_dispatcher| is used in the base BrowserChildProcessHost class to
91 // 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 101
(...skipping 15 matching lines...) Expand all
117 virtual FilePath GetProfileImportProcessCmd(); 117 virtual FilePath GetProfileImportProcessCmd();
118 118
119 private: 119 private:
120 // Launch the new process. 120 // Launch the new process.
121 bool StartProcess(); 121 bool StartProcess();
122 122
123 // Called by the external importer process to send messages back to the 123 // Called by the external importer process to send messages back to the
124 // ImportProcessClient. 124 // ImportProcessClient.
125 void OnMessageReceived(const IPC::Message& message); 125 void OnMessageReceived(const IPC::Message& message);
126 126
127 // Overridden from ChildProcessHost: 127 // Overridden from BrowserChildProcessHost:
128 virtual void OnProcessCrashed(); 128 virtual void OnProcessCrashed();
129 virtual bool CanShutdown() { return true; } 129 virtual bool CanShutdown() { return true; }
130 virtual URLRequestContext* GetRequestContext( 130 virtual URLRequestContext* GetRequestContext(
131 uint32 request_id, 131 uint32 request_id,
132 const ViewHostMsg_Resource_Request& request_data) { 132 const ViewHostMsg_Resource_Request& request_data) {
133 return NULL; 133 return NULL;
134 } 134 }
135 135
136 // Receives messages to be passed back to the importer host. 136 // Receives messages to be passed back to the importer host.
137 scoped_refptr<ImportProcessClient> import_process_client_; 137 scoped_refptr<ImportProcessClient> import_process_client_;
138 138
139 // The thread where the import_process_client_ lives. 139 // The thread where the import_process_client_ lives.
140 ChromeThread::ID thread_id_; 140 ChromeThread::ID thread_id_;
141 141
142 DISALLOW_COPY_AND_ASSIGN(ProfileImportProcessHost); 142 DISALLOW_COPY_AND_ASSIGN(ProfileImportProcessHost);
143 }; 143 };
144 144
145 #endif // CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_ 145 #endif // CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/plugin_service.cc ('k') | chrome/browser/profile_import_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698