| 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_source_impl.h" | 5 #include "content/browser/webui/url_data_source_impl.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 10 #include "content/browser/webui/url_data_manager_backend.h" | 12 #include "content/browser/webui/url_data_manager_backend.h" |
| 11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/browser/url_data_source.h" | 14 #include "content/public/browser/url_data_source.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 URLDataSourceImpl::URLDataSourceImpl(const std::string& source_name, | 18 URLDataSourceImpl::URLDataSourceImpl(const std::string& source_name, |
| 17 URLDataSource* source) | 19 URLDataSource* source) |
| 18 : source_name_(source_name), | 20 : source_name_(source_name), backend_(nullptr), source_(source) {} |
| 19 backend_(NULL), | |
| 20 source_(source) { | |
| 21 } | |
| 22 | 21 |
| 23 URLDataSourceImpl::~URLDataSourceImpl() { | 22 URLDataSourceImpl::~URLDataSourceImpl() { |
| 24 } | 23 } |
| 25 | 24 |
| 26 void URLDataSourceImpl::SendResponse( | 25 void URLDataSourceImpl::SendResponse( |
| 27 int request_id, | 26 int request_id, |
| 28 scoped_refptr<base::RefCountedMemory> bytes) { | 27 scoped_refptr<base::RefCountedMemory> bytes) { |
| 29 if (URLDataManager::IsScheduledForDeletion(this)) { | 28 if (URLDataManager::IsScheduledForDeletion(this)) { |
| 30 // We're scheduled for deletion. Servicing the request would result in | 29 // We're scheduled for deletion. Servicing the request would result in |
| 31 // this->AddRef being invoked, even though the ref count is 0 and 'this' is | 30 // this->AddRef being invoked, even though the ref count is 0 and 'this' is |
| (...skipping 14 matching lines...) Expand all Loading... |
| 46 } | 45 } |
| 47 | 46 |
| 48 void URLDataSourceImpl::SendResponseOnIOThread( | 47 void URLDataSourceImpl::SendResponseOnIOThread( |
| 49 int request_id, | 48 int request_id, |
| 50 scoped_refptr<base::RefCountedMemory> bytes) { | 49 scoped_refptr<base::RefCountedMemory> bytes) { |
| 51 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 50 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 52 if (backend_) | 51 if (backend_) |
| 53 backend_->DataAvailable(request_id, bytes.get()); | 52 backend_->DataAvailable(request_id, bytes.get()); |
| 54 } | 53 } |
| 55 | 54 |
| 55 const ui::TemplateReplacements* URLDataSourceImpl::GetReplacements() const { |
| 56 return nullptr; |
| 57 } |
| 58 |
| 56 } // namespace content | 59 } // namespace content |
| OLD | NEW |