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