| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 ::AssignProcessToJobObject(job, process); | 233 ::AssignProcessToJobObject(job, process); |
| 234 // Yes, we are leaking the object here. Read comment above. | 234 // Yes, we are leaking the object here. Read comment above. |
| 235 } else { | 235 } else { |
| 236 ::CloseHandle(job); | 236 ::CloseHandle(job); |
| 237 return false; | 237 return false; |
| 238 } | 238 } |
| 239 | 239 |
| 240 ::CloseHandle(process); | 240 ::CloseHandle(process); |
| 241 return true; | 241 return true; |
| 242 } | 242 } |
| 243 |
| 244 // Must be dynamically loaded to avoid startup failures on Win XP. |
| 245 typedef BOOL (WINAPI *ChangeWindowMessageFilterFunction)( |
| 246 UINT message, |
| 247 DWORD flag); |
| 248 ChangeWindowMessageFilterFunction g_ChangeWindowMessageFilter; |
| 249 |
| 243 #endif // OS_WIN | 250 #endif // OS_WIN |
| 244 | 251 |
| 245 } // namespace | 252 } // namespace |
| 246 | 253 |
| 247 namespace chrome { | 254 namespace chrome { |
| 248 | 255 |
| 249 const char* ChromeContentClient::kPDFPluginName = ::kPDFPluginName; | 256 const char* ChromeContentClient::kPDFPluginName = ::kPDFPluginName; |
| 250 const char* ChromeContentClient::kNaClPluginName = ::kNaClPluginName; | 257 const char* ChromeContentClient::kNaClPluginName = ::kNaClPluginName; |
| 251 | 258 |
| 252 void ChromeContentClient::SetActiveURL(const GURL& url) { | 259 void ChromeContentClient::SetActiveURL(const GURL& url) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 if (result != sandbox::SBOX_ALL_OK) { | 326 if (result != sandbox::SBOX_ALL_OK) { |
| 320 NOTREACHED(); | 327 NOTREACHED(); |
| 321 return false; | 328 return false; |
| 322 } | 329 } |
| 323 | 330 |
| 324 // Spawn the flash broker and apply sandbox policy. | 331 // Spawn the flash broker and apply sandbox policy. |
| 325 if (LoadFlashBroker(plugin_path, command_line)) { | 332 if (LoadFlashBroker(plugin_path, command_line)) { |
| 326 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); | 333 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); |
| 327 policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, | 334 policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, |
| 328 sandbox::USER_INTERACTIVE); | 335 sandbox::USER_INTERACTIVE); |
| 336 // Allow the Flash plugin to forward some messages back to Chrome. |
| 337 if (base::win::GetVersion() == base::win::VERSION_VISTA) { |
| 338 if (!g_ChangeWindowMessageFilter) { |
| 339 g_ChangeWindowMessageFilter = |
| 340 reinterpret_cast<ChangeWindowMessageFilterFunction>( |
| 341 ::GetProcAddress(::GetModuleHandle(L"user32.dll"), |
| 342 "ChangeWindowMessageFilter")); |
| 343 } |
| 344 // Per-window message filters required on Win7 or later must be added to: |
| 345 // render_widget_host_view_win.cc RenderWidgetHostViewWin::ReparentWindow |
| 346 g_ChangeWindowMessageFilter(WM_MOUSEWHEEL, MSGFLT_ADD); |
| 347 } |
| 329 policy->SetIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); | 348 policy->SetIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); |
| 330 } else { | 349 } else { |
| 331 // Could not start the broker, use a very weak policy instead. | 350 // Could not start the broker, use a very weak policy instead. |
| 332 DLOG(WARNING) << "Failed to start flash broker"; | 351 DLOG(WARNING) << "Failed to start flash broker"; |
| 333 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); | 352 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); |
| 334 policy->SetTokenLevel( | 353 policy->SetTokenLevel( |
| 335 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); | 354 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); |
| 336 } | 355 } |
| 337 | 356 |
| 338 return true; | 357 return true; |
| 339 } | 358 } |
| 340 #endif | 359 #endif |
| 341 | 360 |
| 342 } // namespace chrome | 361 } // namespace chrome |
| OLD | NEW |