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 #include "content/utility/utility_thread_impl.h" | 5 #include "content/utility/utility_thread_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 | 102 |
103 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { | 103 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
104 if (GetContentClient()->utility()->OnMessageReceived(msg)) | 104 if (GetContentClient()->utility()->OnMessageReceived(msg)) |
105 return true; | 105 return true; |
106 | 106 |
107 bool handled = true; | 107 bool handled = true; |
108 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) | 108 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) |
109 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) | 109 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) |
110 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) | 110 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) |
111 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS) | |
112 IPC_MESSAGE_HANDLER(UtilityMsg_LoadPlugins, OnLoadPlugins) | |
113 #endif | |
114 IPC_MESSAGE_UNHANDLED(handled = false) | 111 IPC_MESSAGE_UNHANDLED(handled = false) |
115 IPC_END_MESSAGE_MAP() | 112 IPC_END_MESSAGE_MAP() |
116 return handled; | 113 return handled; |
117 } | 114 } |
118 | 115 |
119 void UtilityThreadImpl::OnBatchModeStarted() { | 116 void UtilityThreadImpl::OnBatchModeStarted() { |
120 batch_mode_ = true; | 117 batch_mode_ = true; |
121 } | 118 } |
122 | 119 |
123 void UtilityThreadImpl::OnBatchModeFinished() { | 120 void UtilityThreadImpl::OnBatchModeFinished() { |
124 batch_mode_ = false; | 121 batch_mode_ = false; |
125 ReleaseProcessIfNeeded(); | 122 ReleaseProcessIfNeeded(); |
126 } | 123 } |
127 | 124 |
128 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS) | |
129 void UtilityThreadImpl::OnLoadPlugins( | |
130 const std::vector<base::FilePath>& plugin_paths) { | |
131 PluginList* plugin_list = PluginList::Singleton(); | |
132 | |
133 std::vector<WebPluginInfo> plugins; | |
134 // TODO(bauerb): If we restart loading plugins, we might mess up the logic in | |
135 // PluginList::ShouldLoadPlugin due to missing the previously loaded plugins | |
136 // in |plugin_groups|. | |
137 for (size_t i = 0; i < plugin_paths.size(); ++i) { | |
138 WebPluginInfo plugin; | |
139 if (!plugin_list->LoadPluginIntoPluginList( | |
140 plugin_paths[i], &plugins, &plugin)) | |
141 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); | |
142 else | |
143 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); | |
144 } | |
145 | |
146 ReleaseProcessIfNeeded(); | |
147 } | |
148 #endif | |
149 | |
150 void UtilityThreadImpl::BindProcessControlRequest( | 125 void UtilityThreadImpl::BindProcessControlRequest( |
151 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 126 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
152 DCHECK(process_control_); | 127 DCHECK(process_control_); |
153 process_control_bindings_.AddBinding(process_control_.get(), | 128 process_control_bindings_.AddBinding(process_control_.get(), |
154 std::move(request)); | 129 std::move(request)); |
155 } | 130 } |
156 | 131 |
157 } // namespace content | 132 } // namespace content |
OLD | NEW |