OLD | NEW |
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_UTILITY_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_UTILITY_PROCESS_HOST_H_ |
6 #define CHROME_BROWSER_UTILITY_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_UTILITY_PROCESS_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 virtual void OnIDBKeysFromValuesAndKeyPathFailed(int id) {} | 90 virtual void OnIDBKeysFromValuesAndKeyPathFailed(int id) {} |
91 | 91 |
92 protected: | 92 protected: |
93 friend class base::RefCountedThreadSafe<Client>; | 93 friend class base::RefCountedThreadSafe<Client>; |
94 | 94 |
95 virtual ~Client() {} | 95 virtual ~Client() {} |
96 | 96 |
97 private: | 97 private: |
98 friend class UtilityProcessHost; | 98 friend class UtilityProcessHost; |
99 | 99 |
100 void OnMessageReceived(const IPC::Message& message); | 100 bool OnMessageReceived(const IPC::Message& message); |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(Client); | 102 DISALLOW_COPY_AND_ASSIGN(Client); |
103 }; | 103 }; |
104 | 104 |
105 UtilityProcessHost(ResourceDispatcherHost* rdh, Client* client, | 105 UtilityProcessHost(ResourceDispatcherHost* rdh, Client* client, |
106 BrowserThread::ID client_thread_id); | 106 BrowserThread::ID client_thread_id); |
107 virtual ~UtilityProcessHost(); | 107 virtual ~UtilityProcessHost(); |
108 | 108 |
109 // Start a process to unpack the extension at the given path. The process | 109 // Start a process to unpack the extension at the given path. The process |
110 // will be given access to the directory subtree that the extension file is | 110 // will be given access to the directory subtree that the extension file is |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 protected: | 142 protected: |
143 // Allow these methods to be overridden for tests. | 143 // Allow these methods to be overridden for tests. |
144 virtual FilePath GetUtilityProcessCmd(); | 144 virtual FilePath GetUtilityProcessCmd(); |
145 | 145 |
146 private: | 146 private: |
147 // Starts a process if necessary. Returns true if it succeeded or a process | 147 // Starts a process if necessary. Returns true if it succeeded or a process |
148 // has already been started via StartBatchMode(). | 148 // has already been started via StartBatchMode(). |
149 bool StartProcess(const FilePath& exposed_dir); | 149 bool StartProcess(const FilePath& exposed_dir); |
150 | 150 |
151 // IPC messages: | 151 // IPC messages: |
152 virtual void OnMessageReceived(const IPC::Message& message); | 152 virtual bool OnMessageReceived(const IPC::Message& message); |
153 | 153 |
154 // BrowserChildProcessHost: | 154 // BrowserChildProcessHost: |
155 virtual void OnProcessCrashed(int exit_code); | 155 virtual void OnProcessCrashed(int exit_code); |
156 virtual bool CanShutdown(); | 156 virtual bool CanShutdown(); |
157 | 157 |
158 // A pointer to our client interface, who will be informed of progress. | 158 // A pointer to our client interface, who will be informed of progress. |
159 scoped_refptr<Client> client_; | 159 scoped_refptr<Client> client_; |
160 BrowserThread::ID client_thread_id_; | 160 BrowserThread::ID client_thread_id_; |
161 // True when running in batch mode, i.e., StartBatchMode() has been called | 161 // True when running in batch mode, i.e., StartBatchMode() has been called |
162 // and the utility process will run until EndBatchMode(). | 162 // and the utility process will run until EndBatchMode(). |
163 bool is_batch_mode_; | 163 bool is_batch_mode_; |
164 | 164 |
165 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHost); | 165 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHost); |
166 }; | 166 }; |
167 | 167 |
168 #endif // CHROME_BROWSER_UTILITY_PROCESS_HOST_H_ | 168 #endif // CHROME_BROWSER_UTILITY_PROCESS_HOST_H_ |
OLD | NEW |