Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(696)

Side by Side Diff: chrome/browser/ui/webui/chrome_url_data_manager.cc

Issue 7384008: Revert 92668 - Remove more unnecessary ChromeURLRequestContext members. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 11 #include "base/message_loop.h"
13 #include "base/string_util.h" 12 #include "base/string_util.h"
14 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
15 #include "base/values.h" 14 #include "base/values.h"
16 #include "chrome/browser/net/chrome_url_request_context.h" 15 #include "chrome/browser/net/chrome_url_request_context.h"
17 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" 17 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
19 #include "content/browser/browser_thread.h" 18 #include "content/browser/browser_thread.h"
20 #include "grit/platform_locale_settings.h" 19 #include "grit/platform_locale_settings.h"
21 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
22 21
23 #if defined(OS_WIN) 22 #if defined(OS_WIN)
24 #include "base/win/windows_version.h" 23 #include "base/win/windows_version.h"
25 #endif 24 #endif
26 25
27 // static 26 // static
28 base::Lock ChromeURLDataManager::delete_lock_; 27 base::Lock ChromeURLDataManager::delete_lock_;
29 28
30 // static 29 // static
31 ChromeURLDataManager::DataSources* ChromeURLDataManager::data_sources_ = NULL; 30 ChromeURLDataManager::DataSources* ChromeURLDataManager::data_sources_ = NULL;
32 31
33 // Invoked on the IO thread to do the actual adding of the DataSource. 32 // Invoked on the IO thread to do the actual adding of the DataSource.
34 static void AddDataSourceOnIOThread( 33 static void AddDataSourceOnIOThread(
35 const base::Callback<ChromeURLDataManagerBackend*(void)>& backend, 34 scoped_refptr<net::URLRequestContextGetter> context_getter,
36 scoped_refptr<ChromeURLDataManager::DataSource> data_source) { 35 scoped_refptr<ChromeURLDataManager::DataSource> data_source) {
37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
38 backend.Run()->AddDataSource(data_source.get()); 37 static_cast<ChromeURLRequestContext*>(
38 context_getter->GetURLRequestContext())->
39 chrome_url_data_manager_backend()->AddDataSource(data_source.get());
39 } 40 }
40 41
41 ChromeURLDataManager::ChromeURLDataManager( 42 ChromeURLDataManager::ChromeURLDataManager(Profile* profile)
42 const base::Callback<ChromeURLDataManagerBackend*(void)>& backend) 43 : profile_(profile) {
43 : backend_(backend) {
44 } 44 }
45 45
46 ChromeURLDataManager::~ChromeURLDataManager() { 46 ChromeURLDataManager::~ChromeURLDataManager() {
47 } 47 }
48 48
49 void ChromeURLDataManager::AddDataSource(DataSource* source) { 49 void ChromeURLDataManager::AddDataSource(DataSource* source) {
50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
51 BrowserThread::PostTask( 51 BrowserThread::PostTask(
52 BrowserThread::IO, FROM_HERE, 52 BrowserThread::IO, FROM_HERE,
53 NewRunnableFunction(AddDataSourceOnIOThread, 53 NewRunnableFunction(AddDataSourceOnIOThread,
54 backend_, 54 make_scoped_refptr(profile_->GetRequestContext()),
55 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_)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 base::i18n::IsRTL() ? "rtl" : "ltr"); 168 base::i18n::IsRTL() ? "rtl" : "ltr");
169 } 169 }
170 170
171 void ChromeURLDataManager::DataSource::SendResponseOnIOThread( 171 void ChromeURLDataManager::DataSource::SendResponseOnIOThread(
172 int request_id, 172 int request_id,
173 scoped_refptr<RefCountedMemory> bytes) { 173 scoped_refptr<RefCountedMemory> bytes) {
174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
175 if (backend_) 175 if (backend_)
176 backend_->DataAvailable(request_id, bytes); 176 backend_->DataAvailable(request_id, bytes);
177 } 177 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chrome_url_data_manager.h ('k') | chrome/browser/ui/webui/chrome_url_data_manager_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698