Chromium Code Reviews| 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 namespace app_host_installer { | |
| 18 | |
| 19 using content::BrowserThread; | |
| 20 | |
| 21 // Determines if the App Host is installed and, if not, installs it. | |
| 22 class AppHostInstallerImpl { | |
| 23 public: | |
| 24 // Asynchronously checks the system state and installs the App Host if not | |
| 25 // present. |completion_callback| will be notified on the caller's thread | |
| 26 // when the installation process completes. No timeout is used - thus | |
| 27 // |completion_callback| may be held for an arbitrarily long time, | |
| 28 // including past browser shutdown. | |
| 29 static void EnsureAppHostInstalled( | |
| 30 const base::Callback<void(bool)>& completion_callback); | |
| 31 | |
| 32 private: | |
| 33 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.
| |
| 34 BrowserThread::ID caller_thread_id); | |
| 35 | |
| 36 ~AppHostInstallerImpl(); | |
| 37 | |
| 38 // Checks the system state on the FILE thread. Will trigger InstallAppHost() | |
| 39 // if App Host is not installed. | |
| 40 void EnsureAppHostInstalledInternal(); | |
| 41 | |
| 42 // Runs on the FILE thread. Installs App Host. | |
| 43 void InstallAppHost(); | |
| 44 | |
| 45 // Passes |success| to |completion_callback| on the original caller thread. | |
| 46 // Deletes the AppHostInstallerImpl. | |
| 47 void Finish(bool success); | |
| 48 | |
| 49 // 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.
| |
| 50 base::Callback<void(bool)> completion_callback_; | |
| 51 | |
| 52 // The caller thread that |completion_callback_| should be called on. | |
| 53 BrowserThread::ID caller_thread_id_; | |
| 54 | |
| 55 // The process handle of the command to install App Host. | |
| 56 base::win::ScopedHandle process_; | |
| 57 | |
| 58 // The delegate to be signaled when |process_| completes. | |
| 59 scoped_ptr<base::win::ObjectWatcher::Delegate> delegate_; | |
| 60 | |
| 61 // Watcher for |process_|. | |
| 62 base::win::ObjectWatcher watcher_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(AppHostInstallerImpl); | |
| 65 }; | |
| 66 | |
| 67 } // namespace app_host_installer | |
| 68 | |
| 69 } // namespace extensions | |
| 70 | |
| 71 #endif // CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_ | |
| OLD | NEW |