| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/debug/alias.h" | 12 #include "base/debug/alias.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/ref_counted_memory.h" | 17 #include "base/memory/ref_counted_memory.h" |
| 17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 18 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
| 19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 21 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" |
| 22 #include "ios/web/public/browser_state.h" | 23 #include "ios/web/public/browser_state.h" |
| 23 #include "ios/web/public/web_client.h" | 24 #include "ios/web/public/web_client.h" |
| 24 #include "ios/web/public/web_thread.h" | 25 #include "ios/web/public/web_thread.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 391 |
| 391 URLDataManagerIOSBackend::~URLDataManagerIOSBackend() { | 392 URLDataManagerIOSBackend::~URLDataManagerIOSBackend() { |
| 392 for (DataSourceMap::iterator i = data_sources_.begin(); | 393 for (DataSourceMap::iterator i = data_sources_.begin(); |
| 393 i != data_sources_.end(); ++i) { | 394 i != data_sources_.end(); ++i) { |
| 394 i->second->backend_ = NULL; | 395 i->second->backend_ = NULL; |
| 395 } | 396 } |
| 396 data_sources_.clear(); | 397 data_sources_.clear(); |
| 397 } | 398 } |
| 398 | 399 |
| 399 // static | 400 // static |
| 400 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 401 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 401 URLDataManagerIOSBackend::CreateProtocolHandler(BrowserState* browser_state) { | 402 URLDataManagerIOSBackend::CreateProtocolHandler(BrowserState* browser_state) { |
| 402 DCHECK(browser_state); | 403 DCHECK(browser_state); |
| 403 return make_scoped_ptr(new ChromeProtocolHandler( | 404 return base::WrapUnique(new ChromeProtocolHandler( |
| 404 browser_state, browser_state->IsOffTheRecord())); | 405 browser_state, browser_state->IsOffTheRecord())); |
| 405 } | 406 } |
| 406 | 407 |
| 407 void URLDataManagerIOSBackend::AddDataSource(URLDataSourceIOSImpl* source) { | 408 void URLDataManagerIOSBackend::AddDataSource(URLDataSourceIOSImpl* source) { |
| 408 DCHECK_CURRENTLY_ON(WebThread::IO); | 409 DCHECK_CURRENTLY_ON(WebThread::IO); |
| 409 DataSourceMap::iterator i = data_sources_.find(source->source_name()); | 410 DataSourceMap::iterator i = data_sources_.find(source->source_name()); |
| 410 if (i != data_sources_.end()) { | 411 if (i != data_sources_.end()) { |
| 411 if (!source->source()->ShouldReplaceExistingSource()) | 412 if (!source->source()->ShouldReplaceExistingSource()) |
| 412 return; | 413 return; |
| 413 i->second->backend_ = NULL; | 414 i->second->backend_ = NULL; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 // Forward this data on to the pending net::URLRequest, if it exists. | 516 // Forward this data on to the pending net::URLRequest, if it exists. |
| 516 PendingRequestMap::iterator i = pending_requests_.find(request_id); | 517 PendingRequestMap::iterator i = pending_requests_.find(request_id); |
| 517 if (i != pending_requests_.end()) { | 518 if (i != pending_requests_.end()) { |
| 518 URLRequestChromeJob* job(i->second); | 519 URLRequestChromeJob* job(i->second); |
| 519 pending_requests_.erase(i); | 520 pending_requests_.erase(i); |
| 520 job->DataAvailable(bytes); | 521 job->DataAvailable(bytes); |
| 521 } | 522 } |
| 522 } | 523 } |
| 523 | 524 |
| 524 } // namespace web | 525 } // namespace web |
| OLD | NEW |