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 18 matching lines...) Expand all Loading... |
50 } | 49 } |
51 | 50 |
52 void URLDataSourceImpl::SendResponseOnIOThread( | 51 void URLDataSourceImpl::SendResponseOnIOThread( |
53 int request_id, | 52 int request_id, |
54 scoped_refptr<base::RefCountedMemory> bytes) { | 53 scoped_refptr<base::RefCountedMemory> bytes) { |
55 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 54 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
56 if (backend_) | 55 if (backend_) |
57 backend_->DataAvailable(request_id, bytes.get()); | 56 backend_->DataAvailable(request_id, bytes.get()); |
58 } | 57 } |
59 | 58 |
| 59 const ui::TemplateReplacements* URLDataSourceImpl::GetReplacements() const { |
| 60 return nullptr; |
| 61 } |
| 62 |
60 } // namespace content | 63 } // namespace content |
OLD | NEW |