OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/common/chrome_content_client.h" | 5 #include "chrome/common/chrome_content_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 ::AssignProcessToJobObject(job, process); | 245 ::AssignProcessToJobObject(job, process); |
246 // Yes, we are leaking the object here. Read comment above. | 246 // Yes, we are leaking the object here. Read comment above. |
247 } else { | 247 } else { |
248 ::CloseHandle(job); | 248 ::CloseHandle(job); |
249 return false; | 249 return false; |
250 } | 250 } |
251 | 251 |
252 ::CloseHandle(process); | 252 ::CloseHandle(process); |
253 return true; | 253 return true; |
254 } | 254 } |
| 255 |
| 256 // Must be dynamically loaded to avoid startup failures on Win XP. |
| 257 typedef BOOL (WINAPI *ChangeWindowMessageFilterFunction)( |
| 258 UINT message, |
| 259 DWORD flag); |
| 260 ChangeWindowMessageFilterFunction g_ChangeWindowMessageFilter; |
| 261 |
255 #endif // OS_WIN | 262 #endif // OS_WIN |
256 | 263 |
257 } // namespace | 264 } // namespace |
258 | 265 |
259 namespace chrome { | 266 namespace chrome { |
260 | 267 |
261 const char* ChromeContentClient::kPDFPluginName = ::kPDFPluginName; | 268 const char* ChromeContentClient::kPDFPluginName = ::kPDFPluginName; |
262 const char* ChromeContentClient::kNaClPluginName = ::kNaClPluginName; | 269 const char* ChromeContentClient::kNaClPluginName = ::kNaClPluginName; |
263 | 270 |
264 void ChromeContentClient::SetActiveURL(const GURL& url) { | 271 void ChromeContentClient::SetActiveURL(const GURL& url) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 if (result != sandbox::SBOX_ALL_OK) { | 362 if (result != sandbox::SBOX_ALL_OK) { |
356 NOTREACHED(); | 363 NOTREACHED(); |
357 return false; | 364 return false; |
358 } | 365 } |
359 | 366 |
360 // Spawn the flash broker and apply sandbox policy. | 367 // Spawn the flash broker and apply sandbox policy. |
361 if (LoadFlashBroker(plugin_path, command_line)) { | 368 if (LoadFlashBroker(plugin_path, command_line)) { |
362 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); | 369 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); |
363 policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, | 370 policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, |
364 sandbox::USER_INTERACTIVE); | 371 sandbox::USER_INTERACTIVE); |
| 372 // Allow the Flash plugin to forward some messages back to Chrome. |
| 373 if (base::win::GetVersion() == base::win::VERSION_VISTA) { |
| 374 if (!g_ChangeWindowMessageFilter) { |
| 375 g_ChangeWindowMessageFilter = |
| 376 reinterpret_cast<ChangeWindowMessageFilterFunction>( |
| 377 ::GetProcAddress(::GetModuleHandle(L"user32.dll"), |
| 378 "ChangeWindowMessageFilter")); |
| 379 } |
| 380 // Per-window message filters required on Win7 or later must be added to: |
| 381 // render_widget_host_view_win.cc RenderWidgetHostViewWin::ReparentWindow |
| 382 g_ChangeWindowMessageFilter(WM_MOUSEWHEEL, MSGFLT_ADD); |
| 383 } |
365 policy->SetIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); | 384 policy->SetIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); |
366 } else { | 385 } else { |
367 // Could not start the broker, use a very weak policy instead. | 386 // Could not start the broker, use a very weak policy instead. |
368 DLOG(WARNING) << "Failed to start flash broker"; | 387 DLOG(WARNING) << "Failed to start flash broker"; |
369 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); | 388 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); |
370 policy->SetTokenLevel( | 389 policy->SetTokenLevel( |
371 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); | 390 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); |
372 } | 391 } |
373 | 392 |
374 return true; | 393 return true; |
375 } | 394 } |
376 #endif | 395 #endif |
377 | 396 |
378 } // namespace chrome | 397 } // namespace chrome |
OLD | NEW |