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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 7134017: Make safe browsing work in a multi-profile environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: addressed sky's nit 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/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
11 #include "chrome/browser/io_thread.h" 11 #include "chrome/browser/io_thread.h"
12 #include "chrome/browser/net/chrome_net_log.h" 12 #include "chrome/browser/net/chrome_net_log.h"
13 #include "chrome/browser/net/chrome_network_delegate.h" 13 #include "chrome/browser/net/chrome_network_delegate.h"
14 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" 14 #include "chrome/browser/net/sqlite_persistent_cookie_store.h"
15 #include "chrome/browser/prefs/pref_member.h"
15 #include "chrome/common/chrome_constants.h" 16 #include "chrome/common/chrome_constants.h"
16 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
19 #include "content/browser/browser_thread.h" 20 #include "content/browser/browser_thread.h"
20 #include "content/browser/resource_context.h" 21 #include "content/browser/resource_context.h"
21 #include "net/ftp/ftp_network_layer.h" 22 #include "net/ftp/ftp_network_layer.h"
22 #include "net/http/http_cache.h" 23 #include "net/http/http_cache.h"
23 24
24 ProfileImplIOData::Handle::Handle(Profile* profile) 25 ProfileImplIOData::Handle::Handle(Profile* profile)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
125 DCHECK(!app_id.empty()); 126 DCHECK(!app_id.empty());
126 LazyInitialize(); 127 LazyInitialize();
127 128
128 // Keep a map of request context getters, one per requested app ID. 129 // Keep a map of request context getters, one per requested app ID.
129 ChromeURLRequestContextGetterMap::iterator iter = 130 ChromeURLRequestContextGetterMap::iterator iter =
130 app_request_context_getter_map_.find(app_id); 131 app_request_context_getter_map_.find(app_id);
131 if (iter != app_request_context_getter_map_.end()) 132 if (iter != app_request_context_getter_map_.end())
132 return iter->second; 133 return iter->second;
133 134
135
134 ChromeURLRequestContextGetter* context = 136 ChromeURLRequestContextGetter* context =
135 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( 137 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
136 profile_, io_data_, app_id); 138 profile_, io_data_, app_id);
137 app_request_context_getter_map_[app_id] = context; 139 app_request_context_getter_map_[app_id] = context;
138 140
139 return context; 141 return context;
140 } 142 }
141 143
142 void ProfileImplIOData::Handle::LazyInitialize() const { 144 void ProfileImplIOData::Handle::LazyInitialize() const {
143 if (!initialized_) { 145 if (!initialized_) {
144 io_data_->InitializeProfileParams(profile_); 146 io_data_->InitializeProfileParams(profile_);
145 ChromeNetworkDelegate::InitializeReferrersEnabled( 147 ChromeNetworkDelegate::InitializeReferrersEnabled(
146 io_data_->enable_referrers(), profile_->GetPrefs()); 148 io_data_->enable_referrers(), profile_->GetPrefs());
147 io_data_->clear_local_state_on_exit()->Init( 149 io_data_->clear_local_state_on_exit()->Init(
148 prefs::kClearSiteDataOnExit, profile_->GetPrefs(), NULL); 150 prefs::kClearSiteDataOnExit, profile_->GetPrefs(), NULL);
149 io_data_->clear_local_state_on_exit()->MoveToThread(BrowserThread::IO); 151 io_data_->clear_local_state_on_exit()->MoveToThread(BrowserThread::IO);
152 #if defined(ENABLE_SAFE_BROWSING)
153 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
154 profile_->GetPrefs(), NULL);
155 io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO);
156 #endif
150 initialized_ = true; 157 initialized_ = true;
151 } 158 }
152 } 159 }
153 160
154 ProfileImplIOData::LazyParams::LazyParams() 161 ProfileImplIOData::LazyParams::LazyParams()
155 : cache_max_size(0), 162 : cache_max_size(0),
156 media_cache_max_size(0) {} 163 media_cache_max_size(0) {}
157 ProfileImplIOData::LazyParams::~LazyParams() {} 164 ProfileImplIOData::LazyParams::~LazyParams() {}
158 165
159 ProfileImplIOData::ProfileImplIOData() 166 ProfileImplIOData::ProfileImplIOData()
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 scoped_refptr<ProfileIOData::RequestContext> 375 scoped_refptr<ProfileIOData::RequestContext>
369 ProfileImplIOData::AcquireIsolatedAppRequestContext( 376 ProfileImplIOData::AcquireIsolatedAppRequestContext(
370 scoped_refptr<ChromeURLRequestContext> main_context, 377 scoped_refptr<ChromeURLRequestContext> main_context,
371 const std::string& app_id) const { 378 const std::string& app_id) const {
372 // We create per-app contexts on demand, unlike the others above. 379 // We create per-app contexts on demand, unlike the others above.
373 scoped_refptr<RequestContext> app_request_context = 380 scoped_refptr<RequestContext> app_request_context =
374 InitializeAppRequestContext(main_context, app_id); 381 InitializeAppRequestContext(main_context, app_id);
375 DCHECK(app_request_context); 382 DCHECK(app_request_context);
376 return app_request_context; 383 return app_request_context;
377 } 384 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_io_data.cc ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698