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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 if (result != sandbox::SBOX_ALL_OK) { | 355 if (result != sandbox::SBOX_ALL_OK) { |
356 NOTREACHED(); | 356 NOTREACHED(); |
357 return false; | 357 return false; |
358 } | 358 } |
359 | 359 |
360 // Spawn the flash broker and apply sandbox policy. | 360 // Spawn the flash broker and apply sandbox policy. |
361 if (LoadFlashBroker(plugin_path, command_line)) { | 361 if (LoadFlashBroker(plugin_path, command_line)) { |
362 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); | 362 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); |
363 policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, | 363 policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, |
364 sandbox::USER_INTERACTIVE); | 364 sandbox::USER_INTERACTIVE); |
| 365 // Allow the Flash plugin to forward some messages back to Chrome. |
| 366 if (base::win::GetVersion() == base::win::VERSION_VISTA) { |
| 367 typedef BOOL (WINAPI *ChangeWindowMessageFilterFunction)( |
| 368 UINT message, |
| 369 DWORD flag); |
| 370 static ChangeWindowMessageFilterFunction s_ChangeWindowMessageFilter = |
| 371 reinterpret_cast<ChangeWindowMessageFilterFunction>( |
| 372 ::GetProcAddress(::GetModuleHandle(L"user32.dll"), |
| 373 "ChangeWindowMessageFilter")); |
| 374 // Per-window message filters required on Win7 or later must be added to: |
| 375 // render_widget_host_view_win.cc RenderWidgetHostViewWin::ReparentWindow |
| 376 s_ChangeWindowMessageFilter(WM_MOUSEWHEEL, MSGFLT_ADD); |
| 377 } |
365 policy->SetIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); | 378 policy->SetIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); |
366 } else { | 379 } else { |
367 // Could not start the broker, use a very weak policy instead. | 380 // Could not start the broker, use a very weak policy instead. |
368 DLOG(WARNING) << "Failed to start flash broker"; | 381 DLOG(WARNING) << "Failed to start flash broker"; |
369 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); | 382 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); |
370 policy->SetTokenLevel( | 383 policy->SetTokenLevel( |
371 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); | 384 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); |
372 } | 385 } |
373 | 386 |
374 return true; | 387 return true; |
375 } | 388 } |
376 #endif | 389 #endif |
377 | 390 |
378 } // namespace chrome | 391 } // namespace chrome |
OLD | NEW |