OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_EXTENSIONS_PACK_EXTENSION_JOB_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_PACK_EXTENSION_JOB_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_PACK_EXTENSION_JOB_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_PACK_EXTENSION_JOB_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/string16.h" |
13 #include "chrome/browser/browser_thread.h" | 14 #include "chrome/browser/browser_thread.h" |
14 | 15 |
15 | 16 |
16 // Manages packing an extension on the file thread and reporting the result | 17 // Manages packing an extension on the file thread and reporting the result |
17 // back to the UI. | 18 // back to the UI. |
18 class PackExtensionJob : public base::RefCountedThreadSafe<PackExtensionJob> { | 19 class PackExtensionJob : public base::RefCountedThreadSafe<PackExtensionJob> { |
19 public: | 20 public: |
20 | 21 |
21 // Interface for people who want to use PackExtensionJob to implement. | 22 // Interface for people who want to use PackExtensionJob to implement. |
22 class Client { | 23 class Client { |
(...skipping 11 matching lines...) Expand all Loading... |
34 const FilePath& key_file); | 35 const FilePath& key_file); |
35 | 36 |
36 // Starts the packing job. | 37 // Starts the packing job. |
37 void Start(); | 38 void Start(); |
38 | 39 |
39 // The client should call this when it is destroyed to prevent | 40 // The client should call this when it is destroyed to prevent |
40 // PackExtensionJob from attempting to access it. | 41 // PackExtensionJob from attempting to access it. |
41 void ClearClient(); | 42 void ClearClient(); |
42 | 43 |
43 // The standard packing success message. | 44 // The standard packing success message. |
44 static std::wstring StandardSuccessMessage(const FilePath& crx_file, | 45 static string16 StandardSuccessMessage(const FilePath& crx_file, |
45 const FilePath& key_file); | 46 const FilePath& key_file); |
46 | 47 |
47 void set_asynchronous(bool async) { asynchronous_ = async; } | 48 void set_asynchronous(bool async) { asynchronous_ = async; } |
48 | 49 |
49 private: | 50 private: |
50 friend class base::RefCountedThreadSafe<PackExtensionJob>; | 51 friend class base::RefCountedThreadSafe<PackExtensionJob>; |
51 | 52 |
52 virtual ~PackExtensionJob(); | 53 virtual ~PackExtensionJob(); |
53 | 54 |
54 // If |asynchronous_| is false, this is run on whichever thread calls it. | 55 // If |asynchronous_| is false, this is run on whichever thread calls it. |
55 void Run(); | 56 void Run(); |
56 void ReportSuccessOnClientThread(); | 57 void ReportSuccessOnClientThread(); |
57 void ReportFailureOnClientThread(const std::string& error); | 58 void ReportFailureOnClientThread(const std::string& error); |
58 | 59 |
59 BrowserThread::ID client_thread_id_; | 60 BrowserThread::ID client_thread_id_; |
60 Client* client_; | 61 Client* client_; |
61 FilePath root_directory_; | 62 FilePath root_directory_; |
62 FilePath key_file_; | 63 FilePath key_file_; |
63 FilePath crx_file_out_; | 64 FilePath crx_file_out_; |
64 FilePath key_file_out_; | 65 FilePath key_file_out_; |
65 bool asynchronous_; | 66 bool asynchronous_; |
66 | 67 |
67 DISALLOW_COPY_AND_ASSIGN(PackExtensionJob); | 68 DISALLOW_COPY_AND_ASSIGN(PackExtensionJob); |
68 }; | 69 }; |
69 | 70 |
70 #endif // CHROME_BROWSER_EXTENSIONS_PACK_EXTENSION_JOB_H_ | 71 #endif // CHROME_BROWSER_EXTENSIONS_PACK_EXTENSION_JOB_H_ |
OLD | NEW |