Chromium Code Reviews| 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..39ec0bf746f0e24457910bbf70f845cd6278d36e |
| --- /dev/null |
| +++ b/chrome/browser/extensions/app_host_installer_impl_win.h |
| @@ -0,0 +1,71 @@ |
| +// 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; |
| + |
| +namespace app_host_installer { |
| + |
| +using content::BrowserThread; |
| + |
| +// Determines if the App Host is installed and, if not, installs it. |
| +class AppHostInstallerImpl { |
| + public: |
| + // Asynchronously checks the system state and installs the App Host if not |
| + // present. |completion_callback| will be notified on the caller's thread |
| + // when the installation process completes. No timeout is used - thus |
| + // |completion_callback| may be held for an arbitrarily long time, |
| + // including past browser shutdown. |
| + static void EnsureAppHostInstalled( |
| + const base::Callback<void(bool)>& completion_callback); |
| + |
| + private: |
| + AppHostInstallerImpl(const base::Callback<void(bool)>& completion_callback, |
|
erikwright (departed)
2012/10/09 21:51:52
// Constructs an AppHostInstallerImpl which will c
huangs
2012/10/09 22:44:26
Done.
|
| + BrowserThread::ID caller_thread_id); |
| + |
| + ~AppHostInstallerImpl(); |
| + |
| + // Checks the system state on the FILE thread. Will trigger InstallAppHost() |
| + // if App Host is not installed. |
| + void EnsureAppHostInstalledInternal(); |
| + |
| + // Runs on the FILE thread. Installs App Host. |
| + void InstallAppHost(); |
| + |
| + // Passes |success| to |completion_callback| on the original caller thread. |
| + // Deletes the AppHostInstallerImpl. |
| + void Finish(bool success); |
| + |
| + // Callback that should be invoked on install completion on the caller thread. |
|
erikwright (departed)
2012/10/09 21:51:52
My personal opinion is that comments are unnecessa
huangs
2012/10/09 22:44:26
Okay, I'll wait. I realized that crx_installer.h
benwells
2012/10/10 03:22:04
I agree with Erik, commenting private member varia
huangs
2012/10/10 14:39:49
Done.
|
| + base::Callback<void(bool)> completion_callback_; |
| + |
| + // The caller thread that |completion_callback_| should be called on. |
| + BrowserThread::ID caller_thread_id_; |
| + |
| + // The process handle of the command to install App Host. |
| + base::win::ScopedHandle process_; |
| + |
| + // The delegate to be signaled when |process_| completes. |
| + scoped_ptr<base::win::ObjectWatcher::Delegate> delegate_; |
| + |
| + // Watcher for |process_|. |
| + base::win::ObjectWatcher watcher_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AppHostInstallerImpl); |
| +}; |
| + |
| +} // namespace app_host_installer |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_ |