| OLD | NEW |
| 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 "ios/web/webui/url_data_manager_ios_backend.h" | 5 #include "ios/web/webui/url_data_manager_ios_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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 URLDataManagerIOSBackend::~URLDataManagerIOSBackend() { | 408 URLDataManagerIOSBackend::~URLDataManagerIOSBackend() { |
| 409 for (DataSourceMap::iterator i = data_sources_.begin(); | 409 for (DataSourceMap::iterator i = data_sources_.begin(); |
| 410 i != data_sources_.end(); | 410 i != data_sources_.end(); |
| 411 ++i) { | 411 ++i) { |
| 412 i->second->backend_ = NULL; | 412 i->second->backend_ = NULL; |
| 413 } | 413 } |
| 414 data_sources_.clear(); | 414 data_sources_.clear(); |
| 415 } | 415 } |
| 416 | 416 |
| 417 // static | 417 // static |
| 418 net::URLRequestJobFactory::ProtocolHandler* | 418 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 419 URLDataManagerIOSBackend::CreateProtocolHandler( | 419 URLDataManagerIOSBackend::CreateProtocolHandler(BrowserState* browser_state) { |
| 420 BrowserState* browser_state) { | |
| 421 DCHECK(browser_state); | 420 DCHECK(browser_state); |
| 422 return new ChromeProtocolHandler(browser_state, | 421 return make_scoped_ptr(new ChromeProtocolHandler( |
| 423 browser_state->IsOffTheRecord()); | 422 browser_state, browser_state->IsOffTheRecord())); |
| 424 } | 423 } |
| 425 | 424 |
| 426 void URLDataManagerIOSBackend::AddDataSource(URLDataSourceIOSImpl* source) { | 425 void URLDataManagerIOSBackend::AddDataSource(URLDataSourceIOSImpl* source) { |
| 427 DCHECK_CURRENTLY_ON_WEB_THREAD(WebThread::IO); | 426 DCHECK_CURRENTLY_ON_WEB_THREAD(WebThread::IO); |
| 428 DataSourceMap::iterator i = data_sources_.find(source->source_name()); | 427 DataSourceMap::iterator i = data_sources_.find(source->source_name()); |
| 429 if (i != data_sources_.end()) { | 428 if (i != data_sources_.end()) { |
| 430 if (!source->source()->ShouldReplaceExistingSource()) | 429 if (!source->source()->ShouldReplaceExistingSource()) |
| 431 return; | 430 return; |
| 432 i->second->backend_ = NULL; | 431 i->second->backend_ = NULL; |
| 433 } | 432 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 // Forward this data on to the pending net::URLRequest, if it exists. | 541 // Forward this data on to the pending net::URLRequest, if it exists. |
| 543 PendingRequestMap::iterator i = pending_requests_.find(request_id); | 542 PendingRequestMap::iterator i = pending_requests_.find(request_id); |
| 544 if (i != pending_requests_.end()) { | 543 if (i != pending_requests_.end()) { |
| 545 URLRequestChromeJob* job(i->second); | 544 URLRequestChromeJob* job(i->second); |
| 546 pending_requests_.erase(i); | 545 pending_requests_.erase(i); |
| 547 job->DataAvailable(bytes); | 546 job->DataAvailable(bytes); |
| 548 } | 547 } |
| 549 } | 548 } |
| 550 | 549 |
| 551 } // namespace web | 550 } // namespace web |
| OLD | NEW |