diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-01 03:17:42 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-01 03:17:42 +0000 |
commit | 13a8961bf84b7132e2ae588ea644bf7b8012fe75 (patch) | |
tree | a73821a3f05a106d64dfb583b729726bf75b90c8 /chrome/browser/extensions/pack_extension_job.h | |
parent | 38570a4a25452eaa63d0556456f80d33c0e231df (diff) | |
download | chromium_src-13a8961bf84b7132e2ae588ea644bf7b8012fe75.zip chromium_src-13a8961bf84b7132e2ae588ea644bf7b8012fe75.tar.gz chromium_src-13a8961bf84b7132e2ae588ea644bf7b8012fe75.tar.bz2 |
A few more fixes to chrome://extensions/.
* Pull PackExtensionJob out into its own file so that it could
more easily be reused in the future.
* Disable OK button while PackExtnesionJob is running to give
a bit of feedback that something is happening.
* Fix title-casing. Apparently sentence-casing is Google UX
stanard.
Review URL: http://codereview.chromium.org/176047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/pack_extension_job.h')
-rw-r--r-- | chrome/browser/extensions/pack_extension_job.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/chrome/browser/extensions/pack_extension_job.h b/chrome/browser/extensions/pack_extension_job.h new file mode 100644 index 0000000..ec00f21 --- /dev/null +++ b/chrome/browser/extensions/pack_extension_job.h @@ -0,0 +1,48 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <string> + +#include "base/file_path.h" +#include "base/ref_counted.h" + +class MessageLoop; + +// Manages packing an extension on the file thread and reporting the result +// back to the UI. +class PackExtensionJob : public base::RefCounted<PackExtensionJob> { + public: + + // Interface for people who want to use PackExtensionJob to implement. + class Client { + public: + virtual void OnPackSuccess(const FilePath& crx_file, + const FilePath& key_file) = 0; + virtual void OnPackFailure(const std::wstring& message) = 0; + }; + + PackExtensionJob(Client* client, + const FilePath& root_directory, + const FilePath& key_file, + MessageLoop* file_loop); + + // The client should call this when it is destroyed to prevent + // PackExtensionJob from attempting to access it. + void ClearClient(); + + private: + void RunOnFileThread(); + void ReportSuccessOnUIThread(); + void ReportFailureOnUIThread(const std::string& error); + + MessageLoop* ui_loop_; + MessageLoop* file_loop_; + Client* client_; + FilePath root_directory_; + FilePath key_file_; + FilePath crx_file_out_; + FilePath key_file_out_; + + DISALLOW_COPY_AND_ASSIGN(PackExtensionJob); +}; |