OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H_ | 5 #ifndef CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H_ |
6 #define CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H_ | 6 #define CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
11 #include "base/logging.h" | |
12 #include "base/thread.h" | 11 #include "base/thread.h" |
13 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
14 | 13 |
15 // Provides the plugin installation job monitoring functionality. | 14 // Provides the plugin installation job monitoring functionality. |
16 // The PluginInstallationJobMonitorThread class represents a background | 15 // The PluginInstallationJobMonitorThread class represents a background |
17 // thread which monitors the install job completion port which is associated | 16 // thread which monitors the install job completion port which is associated |
18 // with the job when an instance of this class is initialized. | 17 // with the job when an instance of this class is initialized. |
19 class PluginInstallationJobMonitorThread : | 18 class PluginInstallationJobMonitorThread |
20 public base::Thread, | 19 : public base::Thread, |
21 public base::RefCountedThreadSafe<PluginInstallationJobMonitorThread> { | 20 public base::RefCountedThreadSafe<PluginInstallationJobMonitorThread> { |
22 | |
23 public: | 21 public: |
24 PluginInstallationJobMonitorThread(); | 22 PluginInstallationJobMonitorThread(); |
25 | 23 |
26 // Initializes the plugin install job. This involves creating the job object | 24 // Initializes the plugin install job. This involves creating the job object |
27 // and starting the thread which monitors the job completion port. | 25 // and starting the thread which monitors the job completion port. |
28 // Returns true on success. | 26 // Returns true on success. |
29 bool Initialize(); | 27 bool Initialize(); |
30 | 28 |
31 // Stops job monitoring and invokes the base Stop function. | 29 // Stops job monitoring and invokes the base Stop function. |
32 void Stop(); | 30 void Stop(); |
33 | 31 |
34 // Simple setter/getters for the plugin window handle. | 32 // Simple setter/getters for the plugin window handle. |
35 void set_plugin_window(HWND plugin_window) { | 33 void set_plugin_window(HWND plugin_window); |
36 DCHECK(::IsWindow(plugin_window)); | |
37 plugin_window_ = plugin_window; | |
38 } | |
39 | 34 |
40 HWND plugin_window() const { | 35 HWND plugin_window() const { |
41 return plugin_window_; | 36 return plugin_window_; |
42 } | 37 } |
43 | 38 |
44 // Adds a process to the job object. | 39 // Adds a process to the job object. |
45 // | 40 // |
46 // Parameters: | 41 // Parameters: |
47 // process_handle | 42 // process_handle |
48 // Handle to the process which is to be added to the plugin install job. | 43 // Handle to the process which is to be added to the plugin install job. |
(...skipping 24 matching lines...) Expand all Loading... |
73 // The install job. Should be created before the job monitor thread | 68 // The install job. Should be created before the job monitor thread |
74 // is started. | 69 // is started. |
75 HANDLE install_job_; | 70 HANDLE install_job_; |
76 // The plugin window handle. | 71 // The plugin window handle. |
77 HWND plugin_window_; | 72 HWND plugin_window_; |
78 | 73 |
79 DISALLOW_COPY_AND_ASSIGN(PluginInstallationJobMonitorThread); | 74 DISALLOW_COPY_AND_ASSIGN(PluginInstallationJobMonitorThread); |
80 }; | 75 }; |
81 | 76 |
82 #endif // CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H_ | 77 #endif // CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H_ |
OLD | NEW |