Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: chrome/browser/extensions/app_host_installer_impl_win.h

Issue 11054006: Make application shortcuts point to app_host.exe, install App Host during app installation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Extracting app_host_installer_impl_win.*; proposing simplified flow to switch between threads for A… Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // Moves to the FILE thread. Continues InstallAppHostIfNecessary().
37 void InstallAppHostIfNecessaryInternal();
38
39 // Runs on the FILE thread. Installs App Host.
40 void InstallAppHost();
41
42 // Moves to the caller thread, calls |completion_callback| with |success|.
43 void Finish(bool success);
44
45 base::win::ScopedHandle process_;
46 base::win::ObjectWatcher watcher_;
47 scoped_ptr<base::win::ObjectWatcher::Delegate> delegate_;
48 content::BrowserThread::ID caller_thread_id_;
49 base::Callback<void(bool)> completion_callback_;
50
51 DISALLOW_COPY_AND_ASSIGN(AppHostInstallerImpl);
52 };
53
54 } // namespace extensions
55
56 #endif // CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_IMPL_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698