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

Side by Side Diff: chrome/browser/net/chrome_url_request_context_getter.cc

Issue 2458093003: Add DCHECKs to validate ProfileIOData's list of protocols.
Patch Set: Merge remote-tracking branch 'origin/master' into detect_unregistered_schemes Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/net/chrome_url_request_context_getter.h" 5 #include "chrome/browser/net/chrome_url_request_context_getter.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Factory that creates the main URLRequestContext. 42 // Factory that creates the main URLRequestContext.
43 class FactoryForMain : public ChromeURLRequestContextFactory { 43 class FactoryForMain : public ChromeURLRequestContextFactory {
44 public: 44 public:
45 FactoryForMain( 45 FactoryForMain(
46 const ProfileIOData* profile_io_data, 46 const ProfileIOData* profile_io_data,
47 content::ProtocolHandlerMap* protocol_handlers, 47 content::ProtocolHandlerMap* protocol_handlers,
48 content::URLRequestInterceptorScopedVector request_interceptors) 48 content::URLRequestInterceptorScopedVector request_interceptors)
49 : profile_io_data_(profile_io_data), 49 : profile_io_data_(profile_io_data),
50 request_interceptors_(std::move(request_interceptors)) { 50 request_interceptors_(std::move(request_interceptors)) {
51 std::swap(protocol_handlers_, *protocol_handlers); 51 std::swap(protocol_handlers_, *protocol_handlers);
52 #if DCHECK_IS_ON()
53 for (const auto& handler : protocol_handlers_)
54 DCHECK(ProfileIOData::IsBuiltInProtocol(handler.first));
55 #endif
52 } 56 }
53 57
54 net::URLRequestContext* Create() override { 58 net::URLRequestContext* Create() override {
55 profile_io_data_->Init(&protocol_handlers_, 59 profile_io_data_->Init(&protocol_handlers_,
56 std::move(request_interceptors_)); 60 std::move(request_interceptors_));
57 return profile_io_data_->GetMainRequestContext(); 61 return profile_io_data_->GetMainRequestContext();
58 } 62 }
59 63
60 private: 64 private:
61 const ProfileIOData* const profile_io_data_; 65 const ProfileIOData* const profile_io_data_;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 ChromeURLRequestContextGetter* 261 ChromeURLRequestContextGetter*
258 ChromeURLRequestContextGetter::CreateForIsolatedMedia( 262 ChromeURLRequestContextGetter::CreateForIsolatedMedia(
259 Profile* profile, 263 Profile* profile,
260 ChromeURLRequestContextGetter* app_context, 264 ChromeURLRequestContextGetter* app_context,
261 const ProfileIOData* profile_io_data, 265 const ProfileIOData* profile_io_data,
262 const StoragePartitionDescriptor& partition_descriptor) { 266 const StoragePartitionDescriptor& partition_descriptor) {
263 return new ChromeURLRequestContextGetter( 267 return new ChromeURLRequestContextGetter(
264 new FactoryForIsolatedMedia( 268 new FactoryForIsolatedMedia(
265 profile_io_data, partition_descriptor, app_context)); 269 profile_io_data, partition_descriptor, app_context));
266 } 270 }
OLDNEW
« no previous file with comments | « chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698