OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/callback_forward.h" |
| 10 #include "base/win/object_watcher.h" |
| 11 #include "content/public/browser/browser_thread.h" |
| 12 |
| 13 namespace extensions { |
| 14 |
| 15 class Extension; |
| 16 |
| 17 // App Host installation is necessary if |
| 18 // (1) |extension| is platform app, and |
| 19 // (2) app_host_exe is not installed. |
| 20 // (1) can be checked anywhere, but (2) must be checked in the FILE thread. |
| 21 // App Host installation is also launched in the FILE thread as an |
| 22 // asynchronous process. Once installation completes, QuickEnableWatcher |
| 23 // is notified (on the FILE thread). This in turn notifies the caller thread |
| 24 // which then proceed with the next step specified by |completion_callback|, |
| 25 // on the caller thread. |
| 26 class AppHostInstallerImpl { |
| 27 public: |
| 28 AppHostInstallerImpl(); |
| 29 |
| 30 // Implements AppHostInstaller::InstallAppHostIfNecessary(). |
| 31 void InstallAppHostIfNecessary( |
| 32 const Extension& extension, |
| 33 const base::Callback<void(bool)>& completion_callback); |
| 34 |
| 35 private: |
| 36 ~AppHostInstallerImpl(); |
| 37 |
| 38 // Moves to the FILE thread. Continues InstallAppHostIfNecessary(). |
| 39 void InstallAppHostIfNecessaryInternal(); |
| 40 |
| 41 // Runs on the FILE thread. Installs App Host. |
| 42 void InstallAppHost(); |
| 43 |
| 44 // Moves to the caller thread, calls |completion_callback| with |success|. |
| 45 void Finish(bool success); |
| 46 |
| 47 base::win::ScopedHandle process_; |
| 48 base::win::ObjectWatcher watcher_; |
| 49 scoped_ptr<base::win::ObjectWatcher::Delegate> delegate_; |
| 50 content::BrowserThread::ID caller_thread_id_; |
| 51 base::Callback<void(bool)> completion_callback_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(AppHostInstallerImpl); |
| 54 }; |
| 55 |
| 56 } // namespace extensions |
| 57 |
| 58 #endif // CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_ |
OLD | NEW |