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

Side by Side Diff: chrome/browser/extensions/app_host_installer_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: Also need virtual (but without OVERRIDE). Created 8 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/extensions/app_host_installer_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_WIN_H_
6 #define CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_WIN_H_
7
8 #include "base/basictypes.h"
9 #include "base/callback_forward.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/win/object_watcher.h"
12 #include "base/win/scoped_handle.h"
13 #include "chrome/browser/extensions/app_host_installer_win.h"
14 #include "content/public/browser/browser_thread.h"
15
16 namespace extensions {
17
18 class Extension;
19
20 // Called on the original calling thread after InstallAppHostIfNecessary()
21 // is complete. A boolean flag is passed, which is false iff the installation
22 // was required but failed.
23 typedef base::Callback<void(bool)> OnAppHostInstallationCompleteCallback;
24
25 // Determines if the App Host is installed and, if not, installs it.
26 class AppHostInstaller {
27 public:
28 // Asynchronously checks the system state and installs the App Host if not
29 // present. |completion_callback| will be notified on the caller's thread
30 // when the installation process completes, and is passed a boolean to
31 // indicate success or failure of installation.
32 // No timeout is used - thus |completion_callback| may be held for an
33 // arbitrarily long time, including past browser shutdown.
34 static void EnsureAppHostInstalled(
35 const OnAppHostInstallationCompleteCallback& completion_callback);
36
37 private:
38 // Constructs an AppHostInstaller, which will call |completion_callback|
39 // on the specified thread upon installation completion.
40 AppHostInstaller(
41 const OnAppHostInstallationCompleteCallback& completion_callback,
42 content::BrowserThread::ID caller_thread_id);
43
44 ~AppHostInstaller();
45
46 // Checks the system state on the FILE thread. Will call
47 // InstallAppHostOnFileThread() if App Host is not installed.
48 void EnsureAppHostInstalledInternal();
49
50 // Runs on the FILE thread. Installs App Host by asynchronously triggering
51 // App Host installation. Will call FinishOnCallerThread() upon completion
52 // (successful or otherwise).
53 void InstallAppHostOnFileThread();
54
55 // Passes |success| to |completion_callback| on the original caller thread.
56 // Deletes the AppHostInstaller.
57 void FinishOnCallerThread(bool success);
58
59 OnAppHostInstallationCompleteCallback completion_callback_;
60 content::BrowserThread::ID caller_thread_id_;
61 base::win::ScopedHandle process_;
62 scoped_ptr<base::win::ObjectWatcher::Delegate> delegate_;
63 base::win::ObjectWatcher watcher_;
64
65 DISALLOW_COPY_AND_ASSIGN(AppHostInstaller);
66 };
67
68 } // namespace extensions
69
70 #endif // CHROME_BROWSER_EXTENSIONS_APP_HOST_INSTALLER_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/app_host_installer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698