Index: chrome/browser/extensions/app_host_installer_impl_win.h |
diff --git a/chrome/browser/extensions/app_host_installer_impl_win.h b/chrome/browser/extensions/app_host_installer_impl_win.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..52cf0d968d2bb13e3732a36c44c2a4e9ceee2b8b |
--- /dev/null |
+++ b/chrome/browser/extensions/app_host_installer_impl_win.h |
@@ -0,0 +1,58 @@ |
+// Copyright (c) 2012 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. |
+ |
+#ifndef CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_ |
+#define CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/callback_forward.h" |
+#include "base/win/object_watcher.h" |
+#include "content/public/browser/browser_thread.h" |
+ |
+namespace extensions { |
+ |
+class Extension; |
+ |
+// App Host installation is necessary if |
+// (1) |extension| is platform app, and |
+// (2) app_host_exe is not installed. |
+// (1) can be checked anywhere, but (2) must be checked in the FILE thread. |
+// App Host installation is also launched in the FILE thread as an |
+// asynchronous process. Once installation completes, QuickEnableWatcher |
+// is notified (on the FILE thread). This in turn notifies the caller thread |
+// which then proceed with the next step specified by |completion_callback|, |
+// on the caller thread. |
+class AppHostInstallerImpl { |
+ public: |
+ AppHostInstallerImpl(); |
+ |
+ // Implements AppHostInstaller::InstallAppHostIfNecessary(). |
+ void InstallAppHostIfNecessary( |
+ const Extension& extension, |
+ const base::Callback<void(bool)>& completion_callback); |
+ |
+ private: |
+ ~AppHostInstallerImpl(); |
+ |
+ // Moves to the FILE thread. Continues InstallAppHostIfNecessary(). |
+ void InstallAppHostIfNecessaryInternal(); |
+ |
+ // Runs on the FILE thread. Installs App Host. |
+ void InstallAppHost(); |
+ |
+ // Moves to the caller thread, calls |completion_callback| with |success|. |
+ void Finish(bool success); |
+ |
+ base::win::ScopedHandle process_; |
+ base::win::ObjectWatcher watcher_; |
+ scoped_ptr<base::win::ObjectWatcher::Delegate> delegate_; |
+ content::BrowserThread::ID caller_thread_id_; |
+ base::Callback<void(bool)> completion_callback_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AppHostInstallerImpl); |
+}; |
+ |
+} // namespace extensions |
+ |
+#endif // CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_ |