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

Side by Side Diff: chrome/default_plugin/plugin_install_job_monitor.h

Issue 8851007: WIP / Do not commit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H_
6 #define CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H_
7 #pragma once
8
9 #include <windows.h>
10
11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/threading/thread.h"
14
15 // Provides the plugin installation job monitoring functionality.
16 // The PluginInstallationJobMonitorThread class represents a background
17 // thread which monitors the install job completion port which is associated
18 // with the job when an instance of this class is initialized.
19 class PluginInstallationJobMonitorThread :
20 public base::Thread,
21 public base::RefCountedThreadSafe<PluginInstallationJobMonitorThread> {
22
23 public:
24 PluginInstallationJobMonitorThread();
25
26 // Initializes the plugin install job. This involves creating the job object
27 // and starting the thread which monitors the job completion port.
28 // Returns true on success.
29 bool Initialize();
30
31 // Stops job monitoring and invokes the base Stop function.
32 void Stop();
33
34 // Simple setter/getters for the plugin window handle.
35 void set_plugin_window(HWND plugin_window) {
36 DCHECK(::IsWindow(plugin_window));
37 plugin_window_ = plugin_window;
38 }
39
40 HWND plugin_window() const {
41 return plugin_window_;
42 }
43
44 // Adds a process to the job object.
45 //
46 // Parameters:
47 // process_handle
48 // Handle to the process which is to be added to the plugin install job.
49 // Returns true on success.
50 bool AssignProcessToJob(HANDLE process_handle);
51
52 protected:
53 // Installs a task on our thread to call WaitForJobThread(). We
54 // can't call it directly since we would deadlock (thread which
55 // creates me blocks until Start() returns, and Start() doesn't
56 // return until Init() does).
57 virtual void Init();
58
59 // Blocks on the plugin installation job completion port by invoking the
60 // GetQueuedCompletionStatus API.
61 // We return from this function when the job monitoring thread is stopped.
62 virtual void WaitForJobThread();
63
64 private:
65 friend class base::RefCountedThreadSafe<PluginInstallationJobMonitorThread>;
66
67 virtual ~PluginInstallationJobMonitorThread();
68
69 // The install job completion port. Created in Init.
70 HANDLE install_job_completion_port_;
71 // Indicates that job monitoring is to be stopped
72 bool stop_job_monitoring_;
73 // The install job. Should be created before the job monitor thread
74 // is started.
75 HANDLE install_job_;
76 // The plugin window handle.
77 HWND plugin_window_;
78
79 DISALLOW_COPY_AND_ASSIGN(PluginInstallationJobMonitorThread);
80 };
81
82 #endif // CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H_
OLDNEW
« no previous file with comments | « chrome/default_plugin/plugin_impl_win.cc ('k') | chrome/default_plugin/plugin_install_job_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698