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

Side by Side Diff: content/browser/storage_partition_impl_map.cc

Issue 12049052: Move core url data manager classes to content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 7 years, 10 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
OLDNEW
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 "content/browser/storage_partition_impl_map.h" 5 #include "content/browser/storage_partition_impl_map.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/threading/sequenced_worker_pool.h" 15 #include "base/threading/sequenced_worker_pool.h"
16 #include "content/browser/appcache/chrome_appcache_service.h" 16 #include "content/browser/appcache/chrome_appcache_service.h"
17 #include "content/browser/fileapi/browser_file_system_helper.h" 17 #include "content/browser/fileapi/browser_file_system_helper.h"
18 #include "content/browser/fileapi/chrome_blob_storage_context.h" 18 #include "content/browser/fileapi/chrome_blob_storage_context.h"
19 #include "content/browser/histogram_internals_request_job.h" 19 #include "content/browser/histogram_internals_request_job.h"
20 #include "content/browser/loader/resource_request_info_impl.h" 20 #include "content/browser/loader/resource_request_info_impl.h"
21 #include "content/browser/net/view_blob_internals_job_factory.h" 21 #include "content/browser/net/view_blob_internals_job_factory.h"
22 #include "content/browser/net/view_http_cache_job_factory.h" 22 #include "content/browser/net/view_http_cache_job_factory.h"
23 #include "content/browser/resource_context_impl.h" 23 #include "content/browser/resource_context_impl.h"
24 #include "content/browser/storage_partition_impl.h" 24 #include "content/browser/storage_partition_impl.h"
25 #include "content/browser/webui/url_data_manager_backend.h"
25 #include "content/browser/tcmalloc_internals_request_job.h" 26 #include "content/browser/tcmalloc_internals_request_job.h"
26 #include "content/public/browser/browser_context.h" 27 #include "content/public/browser/browser_context.h"
27 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/content_browser_client.h" 29 #include "content/public/browser/content_browser_client.h"
29 #include "content/public/browser/storage_partition.h" 30 #include "content/public/browser/storage_partition.h"
30 #include "content/public/common/content_constants.h" 31 #include "content/public/common/content_constants.h"
31 #include "content/public/common/url_constants.h" 32 #include "content/public/common/url_constants.h"
32 #include "crypto/sha2.h" 33 #include "crypto/sha2.h"
33 #include "net/url_request/url_request_context_getter.h" 34 #include "net/url_request/url_request_context_getter.h"
34 #include "net/url_request/url_request_context.h" 35 #include "net/url_request/url_request_context.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 141
141 private: 142 private:
142 AppCacheService* appcache_service_; 143 AppCacheService* appcache_service_;
143 BlobStorageController* blob_storage_controller_; 144 BlobStorageController* blob_storage_controller_;
144 }; 145 };
145 146
146 void InitializeURLRequestContext( 147 void InitializeURLRequestContext(
147 net::URLRequestContextGetter* context_getter, 148 net::URLRequestContextGetter* context_getter,
148 AppCacheService* appcache_service, 149 AppCacheService* appcache_service,
149 FileSystemContext* file_system_context, 150 FileSystemContext* file_system_context,
150 ChromeBlobStorageContext* blob_storage_context) { 151 ChromeBlobStorageContext* blob_storage_context,
152 ResourceContext* resource_context,
153 bool off_the_record) {
151 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
152 if (!context_getter) 155 if (!context_getter)
153 return; // tests. 156 return; // tests.
154 157
155 // This code only modifies the URLRequestJobFactory on the context 158 // This code only modifies the URLRequestJobFactory on the context
156 // to handle blob: URLs, filesystem: URLs, and to let AppCache intercept 159 // to handle blob: URLs, filesystem: URLs, and to let AppCache intercept
157 // the appropriate requests. This is in addition to the slew of other 160 // the appropriate requests. This is in addition to the slew of other
158 // initializtion that is done in during creation of the URLRequestContext. 161 // initializtion that is done in during creation of the URLRequestContext.
159 // We cannot yet centralize this code because URLRequestContext needs 162 // We cannot yet centralize this code because URLRequestContext needs
160 // to be created before the StoragePartition context. 163 // to be created before the StoragePartition context.
(...skipping 18 matching lines...) Expand all
179 DCHECK(set_protocol); 182 DCHECK(set_protocol);
180 set_protocol = job_factory->SetProtocolHandler( 183 set_protocol = job_factory->SetProtocolHandler(
181 chrome::kFileSystemScheme, 184 chrome::kFileSystemScheme,
182 CreateFileSystemProtocolHandler(file_system_context)); 185 CreateFileSystemProtocolHandler(file_system_context));
183 DCHECK(set_protocol); 186 DCHECK(set_protocol);
184 187
185 job_factory->AddInterceptor( 188 job_factory->AddInterceptor(
186 new DeveloperProtocolHandler(appcache_service, 189 new DeveloperProtocolHandler(appcache_service,
187 blob_storage_context->controller())); 190 blob_storage_context->controller()));
188 191
192 set_protocol = job_factory->SetProtocolHandler(
193 chrome::kChromeUIScheme,
194 ChromeURLDataManagerBackend::CreateProtocolHandler(
195 GetURLDataManagerForResourceContext(resource_context),
196 off_the_record));
197 DCHECK(set_protocol);
198
199 set_protocol = job_factory->SetProtocolHandler(
200 chrome::kChromeDevToolsScheme,
201 CreateDevToolsProtocolHandler(
202 GetURLDataManagerForResourceContext(resource_context),
203 off_the_record));
204 DCHECK(set_protocol);
205
189 // TODO(jam): Add the ProtocolHandlerRegistryIntercepter here! 206 // TODO(jam): Add the ProtocolHandlerRegistryIntercepter here!
190 } 207 }
191 208
192 // These constants are used to create the directory structure under the profile 209 // These constants are used to create the directory structure under the profile
193 // where renderers with a non-default storage partition keep their persistent 210 // where renderers with a non-default storage partition keep their persistent
194 // state. This will contain a set of directories that partially mirror the 211 // state. This will contain a set of directories that partially mirror the
195 // directory structure of BrowserContext::GetPath(). 212 // directory structure of BrowserContext::GetPath().
196 // 213 //
197 // The kStoragePartitionDirname contains an extensions directory which is 214 // The kStoragePartitionDirname contains an extensions directory which is
198 // further partitioned by extension id, followed by another level of directories 215 // further partitioned by extension id, followed by another level of directories
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 613
597 // Add content's URLRequestContext's hooks. 614 // Add content's URLRequestContext's hooks.
598 BrowserThread::PostTask( 615 BrowserThread::PostTask(
599 BrowserThread::IO, FROM_HERE, 616 BrowserThread::IO, FROM_HERE,
600 base::Bind( 617 base::Bind(
601 &InitializeURLRequestContext, 618 &InitializeURLRequestContext,
602 make_scoped_refptr(partition->GetURLRequestContext()), 619 make_scoped_refptr(partition->GetURLRequestContext()),
603 make_scoped_refptr(partition->GetAppCacheService()), 620 make_scoped_refptr(partition->GetAppCacheService()),
604 make_scoped_refptr(partition->GetFileSystemContext()), 621 make_scoped_refptr(partition->GetFileSystemContext()),
605 make_scoped_refptr( 622 make_scoped_refptr(
606 ChromeBlobStorageContext::GetFor(browser_context_)))); 623 ChromeBlobStorageContext::GetFor(browser_context_)),
624 browser_context_->GetResourceContext(),
625 browser_context_->IsOffTheRecord()));
607 626
608 // We do not call InitializeURLRequestContext() for media contexts because, 627 // We do not call InitializeURLRequestContext() for media contexts because,
609 // other than the HTTP cache, the media contexts share the same backing 628 // other than the HTTP cache, the media contexts share the same backing
610 // objects as their associated "normal" request context. Thus, the previous 629 // objects as their associated "normal" request context. Thus, the previous
611 // call serves to initialize the media request context for this storage 630 // call serves to initialize the media request context for this storage
612 // partition as well. 631 // partition as well.
613 } 632 }
614 } 633 }
615 634
616 } // namespace content 635 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/resource_context_impl.cc ('k') | content/browser/webui/shared_resources_data_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698