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