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 // App Host installation is necessary if | |
erikwright (departed)
2012/10/09 19:24:48
This level of detail is inappropriate for the decl
huangs
2012/10/09 21:09:15
Done.
| |
20 // (1) |extension| is platform app, and | |
21 // (2) app_host_exe is not installed. | |
22 // (1) can be checked anywhere, but (2) must be checked in the FILE thread. | |
23 // App Host installation is also launched in the FILE thread as an | |
24 // asynchronous process. Once installation completes, QuickEnableWatcher | |
25 // is notified (on the FILE thread). This in turn notifies the caller thread | |
26 // which then proceed with the next step specified by |completion_callback|, | |
27 // on the caller thread. | |
28 class AppHostInstallerImpl { | |
29 public: | |
30 AppHostInstallerImpl(); | |
erikwright (departed)
2012/10/09 19:24:48
private
huangs
2012/10/09 21:09:15
Done. Added two parameters.
| |
31 | |
32 // Implements AppHostInstaller::InstallAppHostIfNecessary(). | |
erikwright (departed)
2012/10/09 19:24:48
// Asynchronously checks the system state and inst
huangs
2012/10/09 21:09:15
Done.
| |
33 void InstallAppHostIfNecessary( | |
erikwright (departed)
2012/10/09 19:24:48
static, and rename to EnsureAppHostInstalled, sinc
huangs
2012/10/09 21:09:15
Done.
| |
34 const Extension& extension, | |
35 const base::Callback<void(bool)>& completion_callback); | |
36 | |
37 private: | |
38 ~AppHostInstallerImpl(); | |
39 | |
40 // Moves to the FILE thread. Continues InstallAppHostIfNecessary(). | |
erikwright (departed)
2012/10/09 19:24:48
// Checks the system state on the FILE thread. Wil
huangs
2012/10/09 21:09:15
Done.
| |
41 void InstallAppHostIfNecessaryInternal(); | |
erikwright (departed)
2012/10/09 19:24:48
Rename to "EnsureAppHostInstalledInternal"
huangs
2012/10/09 21:09:15
Done.
| |
42 | |
43 // Runs on the FILE thread. Installs App Host. | |
erikwright (departed)
2012/10/09 19:24:48
// Asynchronously triggers the App Host installati
huangs
2012/10/09 21:09:15
Done.
| |
44 void InstallAppHost(); | |
45 | |
46 // Moves to the caller thread, calls |completion_callback| with |success|. | |
47 void Finish(bool success); | |
erikwright (departed)
2012/10/09 19:24:48
// Passes |success| to |completion_callback| on th
huangs
2012/10/09 21:09:15
Done.
| |
48 | |
49 base::win::ScopedHandle process_; | |
50 base::win::ObjectWatcher watcher_; | |
51 scoped_ptr<base::win::ObjectWatcher::Delegate> delegate_; | |
52 content::BrowserThread::ID caller_thread_id_; | |
53 base::Callback<void(bool)> completion_callback_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(AppHostInstallerImpl); | |
56 }; | |
57 | |
58 } // namespace app_host_installer | |
59 | |
60 } // namespace extensions | |
61 | |
62 #endif // CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_ | |
OLD | NEW |