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