OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ | 5 #ifndef CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ |
6 #define CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ | 6 #define CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "content/browser/plugin_service_impl.h" | 15 #include "content/browser/plugin_service_impl.h" |
16 #include "content/public/browser/utility_process_host_client.h" | 16 #include "content/public/browser/utility_process_host_client.h" |
| 17 #include "content/public/common/webplugininfo.h" |
17 #include "ipc/ipc_sender.h" | 18 #include "ipc/ipc_sender.h" |
18 #include "webkit/plugins/webplugininfo.h" | |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class MessageLoopProxy; | 21 class MessageLoopProxy; |
22 } | 22 } |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 class UtilityProcessHost; | 25 class UtilityProcessHost; |
26 | 26 |
27 // This class is responsible for managing the out-of-process plugin loading on | 27 // This class is responsible for managing the out-of-process plugin loading on |
28 // POSIX systems. It primarily lives on the IO thread, but has a brief stay on | 28 // POSIX systems. It primarily lives on the IO thread, but has a brief stay on |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 virtual ~PluginLoaderPosix(); | 76 virtual ~PluginLoaderPosix(); |
77 | 77 |
78 // Called on the FILE thread to get the list of plugin paths to probe. | 78 // Called on the FILE thread to get the list of plugin paths to probe. |
79 void GetPluginsToLoad(); | 79 void GetPluginsToLoad(); |
80 | 80 |
81 // Must be called on the IO thread. | 81 // Must be called on the IO thread. |
82 virtual void LoadPluginsInternal(); | 82 virtual void LoadPluginsInternal(); |
83 | 83 |
84 // Message handlers. | 84 // Message handlers. |
85 void OnPluginLoaded(uint32 index, const webkit::WebPluginInfo& plugin); | 85 void OnPluginLoaded(uint32 index, const WebPluginInfo& plugin); |
86 void OnPluginLoadFailed(uint32 index, const base::FilePath& plugin_path); | 86 void OnPluginLoadFailed(uint32 index, const base::FilePath& plugin_path); |
87 | 87 |
88 // Checks if the plugin path is an internal plugin, and, if it is, adds it to | 88 // Checks if the plugin path is an internal plugin, and, if it is, adds it to |
89 // |loaded_plugins_|. | 89 // |loaded_plugins_|. |
90 bool MaybeAddInternalPlugin(const base::FilePath& plugin_path); | 90 bool MaybeAddInternalPlugin(const base::FilePath& plugin_path); |
91 | 91 |
92 // Runs all the registered callbacks on each's target loop if the condition | 92 // Runs all the registered callbacks on each's target loop if the condition |
93 // for ending the load process is done (i.e. the |next_load_index_| is outside | 93 // for ending the load process is done (i.e. the |next_load_index_| is outside |
94 // the range of the |canonical_list_|). | 94 // the range of the |canonical_list_|). |
95 bool MaybeRunPendingCallbacks(); | 95 bool MaybeRunPendingCallbacks(); |
96 | 96 |
97 // The process host for which this is a client. | 97 // The process host for which this is a client. |
98 base::WeakPtr<UtilityProcessHost> process_host_; | 98 base::WeakPtr<UtilityProcessHost> process_host_; |
99 | 99 |
100 // A list of paths to plugins which will be loaded by the utility process, in | 100 // A list of paths to plugins which will be loaded by the utility process, in |
101 // the order specified by this vector. | 101 // the order specified by this vector. |
102 std::vector<base::FilePath> canonical_list_; | 102 std::vector<base::FilePath> canonical_list_; |
103 | 103 |
104 // The index in |canonical_list_| of the plugin that the child process will | 104 // The index in |canonical_list_| of the plugin that the child process will |
105 // attempt to load next. | 105 // attempt to load next. |
106 size_t next_load_index_; | 106 size_t next_load_index_; |
107 | 107 |
108 // Internal plugins that have been registered at the time of loading. | 108 // Internal plugins that have been registered at the time of loading. |
109 std::vector<webkit::WebPluginInfo> internal_plugins_; | 109 std::vector<WebPluginInfo> internal_plugins_; |
110 | 110 |
111 // A vector of plugins that have been loaded successfully. | 111 // A vector of plugins that have been loaded successfully. |
112 std::vector<webkit::WebPluginInfo> loaded_plugins_; | 112 std::vector<WebPluginInfo> loaded_plugins_; |
113 | 113 |
114 // The callback and message loop on which the callback will be run when the | 114 // The callback and message loop on which the callback will be run when the |
115 // plugin loading process has been completed. | 115 // plugin loading process has been completed. |
116 std::deque<PendingCallback> callbacks_; | 116 std::deque<PendingCallback> callbacks_; |
117 | 117 |
118 // The time at which plugin loading started. | 118 // The time at which plugin loading started. |
119 base::TimeTicks load_start_time_; | 119 base::TimeTicks load_start_time_; |
120 | 120 |
121 friend class MockPluginLoaderPosix; | 121 friend class MockPluginLoaderPosix; |
122 DISALLOW_COPY_AND_ASSIGN(PluginLoaderPosix); | 122 DISALLOW_COPY_AND_ASSIGN(PluginLoaderPosix); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace content | 125 } // namespace content |
126 | 126 |
127 #endif // CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ | 127 #endif // CONTENT_BROWSER_PLUGIN_LOADER_POSIX_H_ |
OLD | NEW |