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 // Constructs an AppHostInstallerImpl, which will call |completion_callback| | |
34 // on the specified thread upon installation completion. | |
35 AppHostInstallerImpl(const base::Callback<void(bool)>& completion_callback, | |
36 BrowserThread::ID caller_thread_id); | |
37 | |
38 ~AppHostInstallerImpl(); | |
39 | |
40 // Checks the system state on the FILE thread. Will trigger InstallAppHost() | |
41 // if App Host is not installed. | |
42 void EnsureAppHostInstalledInternal(); | |
43 | |
44 // Runs on the FILE thread. Installs App Host by asynchronously triggering | |
45 // App Host installation. Will call "Finish" upon completion (successful | |
46 // or otherwise). | |
47 void InstallAppHost(); | |
48 | |
49 // Passes |success| to |completion_callback| on the original caller thread. | |
50 // Deletes the AppHostInstallerImpl. | |
51 void Finish(bool success); | |
52 | |
53 base::Callback<void(bool)> completion_callback_; | |
54 | |
erikwright (departed)
2012/10/10 16:32:24
remove blank lines between member variables.
huangs
2012/10/10 17:46:42
Done.
| |
55 BrowserThread::ID caller_thread_id_; | |
56 | |
57 base::win::ScopedHandle process_; | |
58 | |
59 scoped_ptr<base::win::ObjectWatcher::Delegate> delegate_; | |
60 | |
61 base::win::ObjectWatcher watcher_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(AppHostInstallerImpl); | |
64 }; | |
65 | |
66 } // namespace app_host_installer | |
67 | |
68 } // namespace extensions | |
69 | |
70 #endif // CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_ | |
OLD | NEW |