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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "content/child/child_process.h" | 12 #include "content/child/child_process.h" |
13 #include "content/child/webkitplatformsupport_impl.h" | 13 #include "content/child/webkitplatformsupport_impl.h" |
14 #include "content/common/child_process_messages.h" | 14 #include "content/common/child_process_messages.h" |
15 #include "content/common/plugin_list.h" | 15 #include "content/common/plugin_list.h" |
16 #include "content/common/utility_messages.h" | 16 #include "content/common/utility_messages.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
18 #include "content/public/utility/content_utility_client.h" | 18 #include "content/public/utility/content_utility_client.h" |
19 #include "ipc/ipc_sync_channel.h" | 19 #include "ipc/ipc_sync_channel.h" |
20 #include "third_party/WebKit/public/web/WebKit.h" | 20 #include "third_party/WebKit/public/web/WebKit.h" |
21 | 21 |
22 #if defined(TOOLKIT_GTK) | 22 #if defined(TOOLKIT_GTK) |
23 #include <gtk/gtk.h> | 23 #include <gtk/gtk.h> |
24 | 24 |
25 #include "ui/gfx/gtk_util.h" | 25 #include "ui/gfx/gtk_util.h" |
26 #endif | 26 #endif |
27 | 27 |
| 28 #if defined(OS_WIN) |
| 29 #include <Shlobj.h> |
| 30 #endif |
| 31 |
28 namespace content { | 32 namespace content { |
29 | 33 |
30 namespace { | 34 namespace { |
31 | 35 |
32 template<typename SRC, typename DEST> | 36 template<typename SRC, typename DEST> |
33 void ConvertVector(const SRC& src, DEST* dest) { | 37 void ConvertVector(const SRC& src, DEST* dest) { |
34 dest->reserve(src.size()); | 38 dest->reserve(src.size()); |
35 for (typename SRC::const_iterator i = src.begin(); i != src.end(); ++i) | 39 for (typename SRC::const_iterator i = src.begin(); i != src.end(); ++i) |
36 dest->push_back(typename DEST::value_type(*i)); | 40 dest->push_back(typename DEST::value_type(*i)); |
37 } | 41 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (GetContentClient()->utility()->OnMessageReceived(msg)) | 111 if (GetContentClient()->utility()->OnMessageReceived(msg)) |
108 return true; | 112 return true; |
109 | 113 |
110 bool handled = true; | 114 bool handled = true; |
111 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) | 115 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) |
112 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) | 116 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) |
113 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) | 117 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) |
114 #if defined(OS_POSIX) | 118 #if defined(OS_POSIX) |
115 IPC_MESSAGE_HANDLER(UtilityMsg_LoadPlugins, OnLoadPlugins) | 119 IPC_MESSAGE_HANDLER(UtilityMsg_LoadPlugins, OnLoadPlugins) |
116 #endif // OS_POSIX | 120 #endif // OS_POSIX |
| 121 IPC_MESSAGE_HANDLER(UtilityMsg_EffectiveUser, OnEffectiveUser) |
117 IPC_MESSAGE_UNHANDLED(handled = false) | 122 IPC_MESSAGE_UNHANDLED(handled = false) |
118 IPC_END_MESSAGE_MAP() | 123 IPC_END_MESSAGE_MAP() |
119 return handled; | 124 return handled; |
120 } | 125 } |
121 | 126 |
122 void UtilityThreadImpl::OnBatchModeStarted() { | 127 void UtilityThreadImpl::OnBatchModeStarted() { |
123 batch_mode_ = true; | 128 batch_mode_ = true; |
124 } | 129 } |
125 | 130 |
126 void UtilityThreadImpl::OnBatchModeFinished() { | 131 void UtilityThreadImpl::OnBatchModeFinished() { |
(...skipping 28 matching lines...) Expand all Loading... |
155 plugin_paths[i], &plugins, &plugin)) | 160 plugin_paths[i], &plugins, &plugin)) |
156 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); | 161 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); |
157 else | 162 else |
158 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); | 163 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); |
159 } | 164 } |
160 | 165 |
161 ReleaseProcessIfNeeded(); | 166 ReleaseProcessIfNeeded(); |
162 } | 167 } |
163 #endif | 168 #endif |
164 | 169 |
| 170 void UtilityThreadImpl::OnEffectiveUser() { |
| 171 if (IsUserAnAdmin()) { |
| 172 Send(new UtilityHostMsg_EffectiveUser(0)); |
| 173 } else { |
| 174 Send(new UtilityHostMsg_EffectiveUser(1337)); |
| 175 } |
| 176 } |
| 177 |
165 } // namespace content | 178 } // namespace content |
OLD | NEW |