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

Side by Side Diff: chrome/browser/extensions/pack_extension_job.h

Issue 345023: Get rid of MessageLoop* caching in extensions code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
OLDNEW
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_UI_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_PACK_EXTENSION_JOB_UI_H_
6 #define CHROME_BROWSER_EXTENSIONS_PACK_EXTENSION_JOB_UI_H_ 6 #define CHROME_BROWSER_EXTENSIONS_PACK_EXTENSION_JOB_UI_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "chrome/browser/chrome_thread.h"
12 13
13 class MessageLoop;
14 14
15 // Manages packing an extension on the file thread and reporting the result 15 // Manages packing an extension on the file thread and reporting the result
16 // back to the UI. 16 // back to the UI.
17 class PackExtensionJob : public base::RefCountedThreadSafe<PackExtensionJob> { 17 class PackExtensionJob : public base::RefCountedThreadSafe<PackExtensionJob> {
18 public: 18 public:
19 19
20 // Interface for people who want to use PackExtensionJob to implement. 20 // Interface for people who want to use PackExtensionJob to implement.
21 class Client { 21 class Client {
22 public: 22 public:
23 virtual void OnPackSuccess(const FilePath& crx_file, 23 virtual void OnPackSuccess(const FilePath& crx_file,
24 const FilePath& key_file) = 0; 24 const FilePath& key_file) = 0;
25 virtual void OnPackFailure(const std::wstring& message) = 0; 25 virtual void OnPackFailure(const std::wstring& message) = 0;
26 }; 26 };
27 27
28 PackExtensionJob(Client* client, 28 PackExtensionJob(Client* client,
29 const FilePath& root_directory, 29 const FilePath& root_directory,
30 const FilePath& key_file); 30 const FilePath& key_file);
31 31
32 // The client should call this when it is destroyed to prevent 32 // The client should call this when it is destroyed to prevent
33 // PackExtensionJob from attempting to access it. 33 // PackExtensionJob from attempting to access it.
34 void ClearClient(); 34 void ClearClient();
35 35
36 private: 36 private:
37 void RunOnFileThread(); 37 void RunOnFileThread();
38 void ReportSuccessOnUIThread(); 38 void ReportSuccessOnUIThread();
39 void ReportFailureOnUIThread(const std::string& error); 39 void ReportFailureOnUIThread(const std::string& error);
40 40
41 MessageLoop* ui_loop_; 41 ChromeThread::ID client_thread_id_;
42 Client* client_; 42 Client* client_;
43 FilePath root_directory_; 43 FilePath root_directory_;
44 FilePath key_file_; 44 FilePath key_file_;
45 FilePath crx_file_out_; 45 FilePath crx_file_out_;
46 FilePath key_file_out_; 46 FilePath key_file_out_;
47 47
48 DISALLOW_COPY_AND_ASSIGN(PackExtensionJob); 48 DISALLOW_COPY_AND_ASSIGN(PackExtensionJob);
49 }; 49 };
50 50
51 #endif // CHROME_BROWSER_EXTENSIONS_PACK_EXTENSION_JOB_UI_H_ 51 #endif // CHROME_BROWSER_EXTENSIONS_PACK_EXTENSION_JOB_UI_H_
52 52
OLDNEW
« no previous file with comments | « chrome/browser/extensions/image_loading_tracker.cc ('k') | chrome/browser/extensions/pack_extension_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698