Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: chrome/browser/plugin_process_host.cc

Issue 171050: Fix for crash bug in PluginProcessHost::OnGetCookies - it likes like this can... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/plugin_process_host.h" 7 #include "chrome/browser/plugin_process_host.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
11 #endif 11 #endif
12 12
13 #include <vector> 13 #include <vector>
14 14
15 #include "app/app_switches.h" 15 #include "app/app_switches.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #if defined(OS_POSIX) 17 #if defined(OS_POSIX)
18 #include "base/global_descriptors_posix.h" 18 #include "base/global_descriptors_posix.h"
19 #endif 19 #endif
20 #include "base/file_path.h" 20 #include "base/file_path.h"
21 #include "base/file_util.h" 21 #include "base/file_util.h"
22 #include "base/file_version_info.h" 22 #include "base/file_version_info.h"
23 #include "base/gfx/native_widget_types.h" 23 #include "base/gfx/native_widget_types.h"
24 #include "base/logging.h" 24 #include "base/logging.h"
25 #include "base/path_service.h" 25 #include "base/path_service.h"
26 #include "base/process_util.h" 26 #include "base/process_util.h"
27 #include "base/scoped_ptr.h" 27 #include "base/scoped_ptr.h"
28 #include "base/string_util.h"
28 #include "base/thread.h" 29 #include "base/thread.h"
29 #include "chrome/browser/browser_process.h" 30 #include "chrome/browser/browser_process.h"
30 #include "chrome/browser/child_process_security_policy.h" 31 #include "chrome/browser/child_process_security_policy.h"
31 #include "chrome/browser/chrome_plugin_browsing_context.h" 32 #include "chrome/browser/chrome_plugin_browsing_context.h"
32 #include "chrome/browser/chrome_thread.h" 33 #include "chrome/browser/chrome_thread.h"
33 #include "chrome/browser/plugin_service.h" 34 #include "chrome/browser/plugin_service.h"
34 #include "chrome/browser/profile.h" 35 #include "chrome/browser/profile.h"
35 #include "chrome/browser/renderer_host/browser_render_process_host.h" 36 #include "chrome/browser/renderer_host/browser_render_process_host.h"
36 #include "chrome/browser/renderer_host/render_process_host.h" 37 #include "chrome/browser/renderer_host/render_process_host.h"
37 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 38 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 const GURL& url, 521 const GURL& url,
521 std::string* cookies) { 522 std::string* cookies) {
522 URLRequestContext* context = CPBrowsingContextManager::Instance()-> 523 URLRequestContext* context = CPBrowsingContextManager::Instance()->
523 ToURLRequestContext(request_context); 524 ToURLRequestContext(request_context);
524 // TODO(mpcomplete): remove fallback case when Gears support is prevalent. 525 // TODO(mpcomplete): remove fallback case when Gears support is prevalent.
525 if (!context) 526 if (!context)
526 context = Profile::GetDefaultRequestContext(); 527 context = Profile::GetDefaultRequestContext();
527 528
528 // Note: We don't have a first_party_for_cookies check because plugins bypass 529 // Note: We don't have a first_party_for_cookies check because plugins bypass
529 // third-party cookie blocking. 530 // third-party cookie blocking.
530 *cookies = context->cookie_store()->GetCookies(url); 531 if (context && context->cookie_store()) {
532 *cookies = context->cookie_store()->GetCookies(url);
jam 2009/08/17 18:05:41 the first check is not needed since it's already c
robertshield 2009/08/17 18:10:35 It appears that Profile::GetDefaultRequestContext(
jam 2009/08/17 18:19:08 ah, I didn't know that, sorry for the noise. lgtm
533 } else {
534 DLOG(ERROR) << "Could not serve plugin cookies request.";
535 *cookies = EmptyString();
536 }
531 } 537 }
532 538
533 void PluginProcessHost::OnAccessFiles(int process_id, 539 void PluginProcessHost::OnAccessFiles(int process_id,
534 const std::vector<std::string>& files, 540 const std::vector<std::string>& files,
535 bool* allowed) { 541 bool* allowed) {
536 ChildProcessSecurityPolicy* policy = 542 ChildProcessSecurityPolicy* policy =
537 ChildProcessSecurityPolicy::GetInstance(); 543 ChildProcessSecurityPolicy::GetInstance();
538 544
539 for (size_t i = 0; i < files.size(); ++i) { 545 for (size_t i = 0; i < files.size(); ++i) {
540 const FilePath path = FilePath::FromWStringHack(UTF8ToWide(files[i])); 546 const FilePath path = FilePath::FromWStringHack(UTF8ToWide(files[i]));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 DCHECK(MessageLoop::current() == 631 DCHECK(MessageLoop::current() ==
626 ChromeThread::GetMessageLoop(ChromeThread::IO)); 632 ChromeThread::GetMessageLoop(ChromeThread::IO));
627 633
628 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); 634 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path);
629 if (chrome_plugin) { 635 if (chrome_plugin) {
630 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); 636 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
631 uint32 data_len = static_cast<uint32>(data.size()); 637 uint32 data_len = static_cast<uint32>(data.size());
632 chrome_plugin->functions().on_message(data_ptr, data_len); 638 chrome_plugin->functions().on_message(data_ptr, data_len);
633 } 639 }
634 } 640 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698