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 21 matching lines...) Expand all Loading... |
32 class UtilityProcessHost : public BrowserChildProcessHost { | 32 class UtilityProcessHost : public BrowserChildProcessHost { |
33 public: | 33 public: |
34 // An interface to be implemented by consumers of the utility process to | 34 // An interface to be implemented by consumers of the utility process to |
35 // get results back. All functions are called on the thread passed along | 35 // get results back. All functions are called on the thread passed along |
36 // to UtilityProcessHost. | 36 // to UtilityProcessHost. |
37 class Client : public base::RefCountedThreadSafe<Client> { | 37 class Client : public base::RefCountedThreadSafe<Client> { |
38 public: | 38 public: |
39 Client() {} | 39 Client() {} |
40 | 40 |
41 // Called when the process has crashed. | 41 // Called when the process has crashed. |
42 virtual void OnProcessCrashed() {} | 42 virtual void OnProcessCrashed(int exit_code) {} |
43 | 43 |
44 // Called when the extension has unpacked successfully. |manifest| is the | 44 // Called when the extension has unpacked successfully. |manifest| is the |
45 // parsed manifest.json file. |catalogs| contains list of all parsed | 45 // parsed manifest.json file. |catalogs| contains list of all parsed |
46 // message catalogs. |images| contains a list of decoded images and the | 46 // message catalogs. |images| contains a list of decoded images and the |
47 // associated paths where those images live on disk. | 47 // associated paths where those images live on disk. |
48 virtual void OnUnpackExtensionSucceeded(const DictionaryValue& manifest) {} | 48 virtual void OnUnpackExtensionSucceeded(const DictionaryValue& manifest) {} |
49 | 49 |
50 // Called when an error occurred while unpacking the extension. | 50 // Called when an error occurred while unpacking the extension. |
51 // |error_message| contains a description of the problem. | 51 // |error_message| contains a description of the problem. |
52 virtual void OnUnpackExtensionFailed(const std::string& error_message) {} | 52 virtual void OnUnpackExtensionFailed(const std::string& error_message) {} |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 private: | 147 private: |
148 // Starts a process if necessary. Returns true if it succeeded or a process | 148 // Starts a process if necessary. Returns true if it succeeded or a process |
149 // has already been started via StartBatchMode(). | 149 // has already been started via StartBatchMode(). |
150 bool StartProcess(const FilePath& exposed_dir); | 150 bool StartProcess(const FilePath& exposed_dir); |
151 | 151 |
152 // IPC messages: | 152 // IPC messages: |
153 virtual void OnMessageReceived(const IPC::Message& message); | 153 virtual void OnMessageReceived(const IPC::Message& message); |
154 | 154 |
155 // BrowserChildProcessHost: | 155 // BrowserChildProcessHost: |
156 virtual void OnProcessCrashed(); | 156 virtual void OnProcessCrashed(int exit_code); |
157 virtual bool CanShutdown() { return true; } | 157 virtual bool CanShutdown() { return true; } |
158 virtual URLRequestContext* GetRequestContext( | 158 virtual URLRequestContext* GetRequestContext( |
159 uint32 request_id, | 159 uint32 request_id, |
160 const ViewHostMsg_Resource_Request& request_data) { | 160 const ViewHostMsg_Resource_Request& request_data) { |
161 return NULL; | 161 return NULL; |
162 } | 162 } |
163 | 163 |
164 // A pointer to our client interface, who will be informed of progress. | 164 // A pointer to our client interface, who will be informed of progress. |
165 scoped_refptr<Client> client_; | 165 scoped_refptr<Client> client_; |
166 BrowserThread::ID client_thread_id_; | 166 BrowserThread::ID client_thread_id_; |
167 // True when running in batch mode, i.e., StartBatchMode() has been called | 167 // True when running in batch mode, i.e., StartBatchMode() has been called |
168 // and the utility process will run until EndBatchMode(). | 168 // and the utility process will run until EndBatchMode(). |
169 bool is_batch_mode_; | 169 bool is_batch_mode_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHost); | 171 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHost); |
172 }; | 172 }; |
173 | 173 |
174 #endif // CHROME_BROWSER_UTILITY_PROCESS_HOST_H_ | 174 #endif // CHROME_BROWSER_UTILITY_PROCESS_HOST_H_ |
OLD | NEW |