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..8c75a57ed22dc860758e640f1318d50976116a2d |
| --- /dev/null |
| +++ b/chrome/browser/extensions/app_host_installer_impl_win.h |
| @@ -0,0 +1,66 @@ |
| +// 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 |
|
grt (UTC plus 2)
2012/10/24 15:59:18
what does the bool arg for the completion_callback
huangs
2012/10/24 18:52:45
Done.
|
| + // 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: |
| + // Constructs an AppHostInstallerImpl, which will call |completion_callback| |
| + // on the specified thread upon installation completion. |
| + AppHostInstallerImpl(const base::Callback<void(bool)>& completion_callback, |
| + 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 by asynchronously triggering |
| + // App Host installation. Will call "Finish" upon completion (successful |
| + // or otherwise). |
| + void InstallAppHost(); |
|
grt (UTC plus 2)
2012/10/24 15:59:18
nit: There's a convention to suffix funcs that mus
huangs
2012/10/24 18:52:45
Done. Changing my code only though.
|
| + |
| + // Passes |success| to |completion_callback| on the original caller thread. |
| + // Deletes the AppHostInstallerImpl. |
| + void Finish(bool success); |
| + |
| + base::Callback<void(bool)> completion_callback_; |
| + BrowserThread::ID caller_thread_id_; |
| + base::win::ScopedHandle process_; |
| + scoped_ptr<base::win::ObjectWatcher::Delegate> delegate_; |
| + 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_ |