| 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 "content/browser/webui/url_data_manager_backend.h" | 5 #include "content/browser/webui/url_data_manager_backend.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 : public net::URLRequestJobFactory::ProtocolHandler { | 334 : public net::URLRequestJobFactory::ProtocolHandler { |
| 335 public: | 335 public: |
| 336 // |is_incognito| should be set for incognito profiles. | 336 // |is_incognito| should be set for incognito profiles. |
| 337 explicit ChromeProtocolHandler(content::ResourceContext* resource_context, | 337 explicit ChromeProtocolHandler(content::ResourceContext* resource_context, |
| 338 bool is_incognito); | 338 bool is_incognito); |
| 339 virtual ~ChromeProtocolHandler(); | 339 virtual ~ChromeProtocolHandler(); |
| 340 | 340 |
| 341 virtual net::URLRequestJob* MaybeCreateJob( | 341 virtual net::URLRequestJob* MaybeCreateJob( |
| 342 net::URLRequest* request, | 342 net::URLRequest* request, |
| 343 net::NetworkDelegate* network_delegate) const OVERRIDE; | 343 net::NetworkDelegate* network_delegate) const OVERRIDE; |
| 344 virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE; |
| 344 | 345 |
| 345 private: | 346 private: |
| 346 // These members are owned by ProfileIOData, which owns this ProtocolHandler. | 347 // These members are owned by ProfileIOData, which owns this ProtocolHandler. |
| 347 content::ResourceContext* const resource_context_; | 348 content::ResourceContext* const resource_context_; |
| 348 | 349 |
| 349 // True when generated from an incognito profile. | 350 // True when generated from an incognito profile. |
| 350 const bool is_incognito_; | 351 const bool is_incognito_; |
| 351 | 352 |
| 352 DISALLOW_COPY_AND_ASSIGN(ChromeProtocolHandler); | 353 DISALLOW_COPY_AND_ASSIGN(ChromeProtocolHandler); |
| 353 }; | 354 }; |
| 354 | 355 |
| 355 ChromeProtocolHandler::ChromeProtocolHandler( | 356 ChromeProtocolHandler::ChromeProtocolHandler( |
| 356 content::ResourceContext* resource_context, bool is_incognito) | 357 content::ResourceContext* resource_context, bool is_incognito) |
| 357 : resource_context_(resource_context), is_incognito_(is_incognito) {} | 358 : resource_context_(resource_context), is_incognito_(is_incognito) {} |
| 358 | 359 |
| 359 ChromeProtocolHandler::~ChromeProtocolHandler() {} | 360 ChromeProtocolHandler::~ChromeProtocolHandler() {} |
| 360 | 361 |
| 361 net::URLRequestJob* ChromeProtocolHandler::MaybeCreateJob( | 362 net::URLRequestJob* ChromeProtocolHandler::MaybeCreateJob( |
| 362 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 363 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
| 363 DCHECK(request); | 364 DCHECK(request); |
| 364 | 365 |
| 365 // Fall back to using a custom handler | 366 // Fall back to using a custom handler |
| 366 return new URLRequestChromeJob( | 367 return new URLRequestChromeJob( |
| 367 request, network_delegate, | 368 request, network_delegate, |
| 368 GetURLDataManagerForResourceContext(resource_context_), is_incognito_); | 369 GetURLDataManagerForResourceContext(resource_context_), is_incognito_); |
| 369 } | 370 } |
| 370 | 371 |
| 372 bool ChromeProtocolHandler::IsSafeRedirectTarget(const GURL& location) const { |
| 373 return false; |
| 374 } |
| 375 |
| 371 } // namespace | 376 } // namespace |
| 372 | 377 |
| 373 URLDataManagerBackend::URLDataManagerBackend() | 378 URLDataManagerBackend::URLDataManagerBackend() |
| 374 : next_request_id_(0) { | 379 : next_request_id_(0) { |
| 375 URLDataSource* shared_source = new SharedResourcesDataSource(); | 380 URLDataSource* shared_source = new SharedResourcesDataSource(); |
| 376 URLDataSourceImpl* source_impl = | 381 URLDataSourceImpl* source_impl = |
| 377 new URLDataSourceImpl(shared_source->GetSource(), shared_source); | 382 new URLDataSourceImpl(shared_source->GetSource(), shared_source); |
| 378 AddDataSource(source_impl); | 383 AddDataSource(source_impl); |
| 379 } | 384 } |
| 380 | 385 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 | 567 |
| 563 } // namespace | 568 } // namespace |
| 564 | 569 |
| 565 net::URLRequestJobFactory::ProtocolHandler* | 570 net::URLRequestJobFactory::ProtocolHandler* |
| 566 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 571 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
| 567 bool is_incognito) { | 572 bool is_incognito) { |
| 568 return new DevToolsJobFactory(resource_context, is_incognito); | 573 return new DevToolsJobFactory(resource_context, is_incognito); |
| 569 } | 574 } |
| 570 | 575 |
| 571 } // namespace content | 576 } // namespace content |
| OLD | NEW |