| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/webui/chrome_url_data_manager.h" | 5 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" |
| 9 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "chrome/browser/net/chrome_url_request_context.h" | 17 #include "chrome/browser/net/chrome_url_request_context.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 19 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 43 : backend_(backend) { | 44 : backend_(backend) { |
| 44 } | 45 } |
| 45 | 46 |
| 46 ChromeURLDataManager::~ChromeURLDataManager() { | 47 ChromeURLDataManager::~ChromeURLDataManager() { |
| 47 } | 48 } |
| 48 | 49 |
| 49 void ChromeURLDataManager::AddDataSource(DataSource* source) { | 50 void ChromeURLDataManager::AddDataSource(DataSource* source) { |
| 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 51 BrowserThread::PostTask( | 52 BrowserThread::PostTask( |
| 52 BrowserThread::IO, FROM_HERE, | 53 BrowserThread::IO, FROM_HERE, |
| 53 NewRunnableFunction(AddDataSourceOnIOThread, | 54 base::Bind(&AddDataSourceOnIOThread, |
| 54 backend_, | 55 backend_, make_scoped_refptr(source))); |
| 55 make_scoped_refptr(source))); | |
| 56 } | 56 } |
| 57 | 57 |
| 58 // static | 58 // static |
| 59 void ChromeURLDataManager::DeleteDataSources() { | 59 void ChromeURLDataManager::DeleteDataSources() { |
| 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 61 DataSources sources; | 61 DataSources sources; |
| 62 { | 62 { |
| 63 base::AutoLock lock(delete_lock_); | 63 base::AutoLock lock(delete_lock_); |
| 64 if (!data_sources_) | 64 if (!data_sources_) |
| 65 return; | 65 return; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 base::i18n::IsRTL() ? "rtl" : "ltr"); | 170 base::i18n::IsRTL() ? "rtl" : "ltr"); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void ChromeURLDataManager::DataSource::SendResponseOnIOThread( | 173 void ChromeURLDataManager::DataSource::SendResponseOnIOThread( |
| 174 int request_id, | 174 int request_id, |
| 175 scoped_refptr<RefCountedMemory> bytes) { | 175 scoped_refptr<RefCountedMemory> bytes) { |
| 176 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 176 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 177 if (backend_) | 177 if (backend_) |
| 178 backend_->DataAvailable(request_id, bytes); | 178 backend_->DataAvailable(request_id, bytes); |
| 179 } | 179 } |
| OLD | NEW |