OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser/plugin_process_host.h" | 5 #include "chrome/browser/plugin_process_host.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 372 } |
373 | 373 |
374 void PluginProcessHost::OnAccessFiles(int renderer_id, | 374 void PluginProcessHost::OnAccessFiles(int renderer_id, |
375 const std::vector<std::string>& files, | 375 const std::vector<std::string>& files, |
376 bool* allowed) { | 376 bool* allowed) { |
377 ChildProcessSecurityPolicy* policy = | 377 ChildProcessSecurityPolicy* policy = |
378 ChildProcessSecurityPolicy::GetInstance(); | 378 ChildProcessSecurityPolicy::GetInstance(); |
379 | 379 |
380 for (size_t i = 0; i < files.size(); ++i) { | 380 for (size_t i = 0; i < files.size(); ++i) { |
381 const FilePath path = FilePath::FromWStringHack(UTF8ToWide(files[i])); | 381 const FilePath path = FilePath::FromWStringHack(UTF8ToWide(files[i])); |
382 if (!policy->CanUploadFile(renderer_id, path)) { | 382 if (!policy->CanReadFile(renderer_id, path)) { |
383 LOG(INFO) << "Denied unauthorized request for file " << files[i]; | 383 LOG(INFO) << "Denied unauthorized request for file " << files[i]; |
384 *allowed = false; | 384 *allowed = false; |
385 return; | 385 return; |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 *allowed = true; | 389 *allowed = true; |
390 } | 390 } |
391 | 391 |
392 void PluginProcessHost::OnResolveProxy(const GURL& url, | 392 void PluginProcessHost::OnResolveProxy(const GURL& url, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 const std::vector<uint8>& data) { | 466 const std::vector<uint8>& data) { |
467 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 467 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
468 | 468 |
469 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 469 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
470 if (chrome_plugin) { | 470 if (chrome_plugin) { |
471 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 471 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
472 uint32 data_len = static_cast<uint32>(data.size()); | 472 uint32 data_len = static_cast<uint32>(data.size()); |
473 chrome_plugin->functions().on_message(data_ptr, data_len); | 473 chrome_plugin->functions().on_message(data_ptr, data_len); |
474 } | 474 } |
475 } | 475 } |
OLD | NEW |