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/bind.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/net/chrome_url_request_context.h" | 17 #include "chrome/browser/net/chrome_url_request_context.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 19 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "grit/platform_locale_settings.h" | 21 #include "grit/platform_locale_settings.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 | 23 |
24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
25 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
26 #endif | 26 #endif |
27 | 27 |
| 28 using content::BrowserThread; |
| 29 |
28 // static | 30 // static |
29 base::Lock ChromeURLDataManager::delete_lock_; | 31 base::Lock ChromeURLDataManager::delete_lock_; |
30 | 32 |
31 // static | 33 // static |
32 ChromeURLDataManager::DataSources* ChromeURLDataManager::data_sources_ = NULL; | 34 ChromeURLDataManager::DataSources* ChromeURLDataManager::data_sources_ = NULL; |
33 | 35 |
34 // Invoked on the IO thread to do the actual adding of the DataSource. | 36 // Invoked on the IO thread to do the actual adding of the DataSource. |
35 static void AddDataSourceOnIOThread( | 37 static void AddDataSourceOnIOThread( |
36 const base::Callback<ChromeURLDataManagerBackend*(void)>& backend, | 38 const base::Callback<ChromeURLDataManagerBackend*(void)>& backend, |
37 scoped_refptr<ChromeURLDataManager::DataSource> data_source) { | 39 scoped_refptr<ChromeURLDataManager::DataSource> data_source) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 base::i18n::IsRTL() ? "rtl" : "ltr"); | 171 base::i18n::IsRTL() ? "rtl" : "ltr"); |
170 } | 172 } |
171 | 173 |
172 void ChromeURLDataManager::DataSource::SendResponseOnIOThread( | 174 void ChromeURLDataManager::DataSource::SendResponseOnIOThread( |
173 int request_id, | 175 int request_id, |
174 scoped_refptr<RefCountedMemory> bytes) { | 176 scoped_refptr<RefCountedMemory> bytes) { |
175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 177 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
176 if (backend_) | 178 if (backend_) |
177 backend_->DataAvailable(request_id, bytes); | 179 backend_->DataAvailable(request_id, bytes); |
178 } | 180 } |
OLD | NEW |