OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/base/testing_profile.h" | 5 #include "chrome/test/base/testing_profile.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 } | 602 } |
603 | 603 |
604 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { | 604 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { |
605 return request_context_.get(); | 605 return request_context_.get(); |
606 } | 606 } |
607 | 607 |
608 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( | 608 net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( |
609 int renderer_child_id) { | 609 int renderer_child_id) { |
610 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 610 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
611 renderer_child_id); | 611 renderer_child_id); |
612 content::StoragePartition* storage_partition = rph->GetStoragePartition(); | 612 return rph->GetStoragePartition()->GetURLRequestContext(); |
613 | |
614 // TODO(nasko): Remove this conditional, once webview tag creates a proper | |
615 // storage partition. | |
616 if (rph->IsGuest()) { | |
617 return GetRequestContextForStoragePartition( | |
618 storage_partition->GetPath(), true); | |
619 } | |
620 | |
621 return storage_partition->GetURLRequestContext(); | |
622 } | 613 } |
623 | 614 |
624 void TestingProfile::CreateRequestContext() { | 615 void TestingProfile::CreateRequestContext() { |
625 if (!request_context_) | 616 if (!request_context_) |
626 request_context_ = | 617 request_context_ = |
627 new TestURLRequestContextGetter( | 618 new TestURLRequestContextGetter( |
628 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 619 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
629 } | 620 } |
630 | 621 |
631 void TestingProfile::ResetRequestContext() { | 622 void TestingProfile::ResetRequestContext() { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 816 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
826 DCHECK(!build_called_); | 817 DCHECK(!build_called_); |
827 build_called_ = true; | 818 build_called_ = true; |
828 return scoped_ptr<TestingProfile>(new TestingProfile( | 819 return scoped_ptr<TestingProfile>(new TestingProfile( |
829 path_, | 820 path_, |
830 delegate_, | 821 delegate_, |
831 extension_policy_, | 822 extension_policy_, |
832 pref_service_.Pass(), | 823 pref_service_.Pass(), |
833 user_cloud_policy_manager_.Pass())); | 824 user_cloud_policy_manager_.Pass())); |
834 } | 825 } |
OLD | NEW |