| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "chrome/browser/profile_manager.h" | 7 #include "chrome/browser/profile_manager.h" |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "chrome/browser/browser.h" | 13 #include "chrome/browser/browser.h" |
| 14 #include "chrome/browser/browser_list.h" | 14 #include "chrome/browser/browser_list.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/browser_window.h" | 16 #include "chrome/browser/browser_window.h" |
| 17 #include "chrome/browser/chrome_thread.h" | 17 #include "chrome/browser/chrome_thread.h" |
| 18 #include "chrome/browser/net/url_request_context_getter.h" |
| 18 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
| 19 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/logging_chrome.h" | 21 #include "chrome/common/logging_chrome.h" |
| 21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/common/pref_service.h" | 23 #include "chrome/common/pref_service.h" |
| 23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 24 #include "net/http/http_transaction_factory.h" | 25 #include "net/http/http_transaction_factory.h" |
| 25 #include "net/url_request/url_request_context.h" | 26 #include "net/url_request/url_request_context.h" |
| 26 #include "net/url_request/url_request_job.h" | 27 #include "net/url_request/url_request_job.h" |
| 27 #include "net/url_request/url_request_job_tracker.h" | 28 #include "net/url_request/url_request_job_tracker.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 236 |
| 236 void ProfileManager::SuspendProfile(Profile* profile) { | 237 void ProfileManager::SuspendProfile(Profile* profile) { |
| 237 DCHECK(profile); | 238 DCHECK(profile); |
| 238 DCHECK(MessageLoop::current() == | 239 DCHECK(MessageLoop::current() == |
| 239 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 240 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
| 240 | 241 |
| 241 for (URLRequestJobTracker::JobIterator i = g_url_request_job_tracker.begin(); | 242 for (URLRequestJobTracker::JobIterator i = g_url_request_job_tracker.begin(); |
| 242 i != g_url_request_job_tracker.end(); ++i) | 243 i != g_url_request_job_tracker.end(); ++i) |
| 243 (*i)->Kill(); | 244 (*i)->Kill(); |
| 244 | 245 |
| 245 profile->GetRequestContext()->http_transaction_factory()->Suspend(true); | 246 profile->GetRequestContext()->GetURLRequestContext()-> |
| 247 http_transaction_factory()->Suspend(true); |
| 246 } | 248 } |
| 247 | 249 |
| 248 void ProfileManager::ResumeProfile(Profile* profile) { | 250 void ProfileManager::ResumeProfile(Profile* profile) { |
| 249 DCHECK(profile); | 251 DCHECK(profile); |
| 250 DCHECK(MessageLoop::current() == | 252 DCHECK(MessageLoop::current() == |
| 251 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 253 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
| 252 profile->GetRequestContext()->http_transaction_factory()->Suspend(false); | 254 profile->GetRequestContext()->GetURLRequestContext()-> |
| 255 http_transaction_factory()->Suspend(false); |
| 253 } | 256 } |
| 254 | 257 |
| 255 | 258 |
| 256 | 259 |
| 257 // static | 260 // static |
| 258 bool ProfileManager::IsProfile(const FilePath& path) { | 261 bool ProfileManager::IsProfile(const FilePath& path) { |
| 259 FilePath prefs_path = GetDefaultProfilePath(path); | 262 FilePath prefs_path = GetDefaultProfilePath(path); |
| 260 | 263 |
| 261 FilePath history_path = path; | 264 FilePath history_path = path; |
| 262 history_path = history_path.Append(chrome::kHistoryFilename); | 265 history_path = history_path.Append(chrome::kHistoryFilename); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 314 |
| 312 return profile; | 315 return profile; |
| 313 } | 316 } |
| 314 | 317 |
| 315 // static | 318 // static |
| 316 std::wstring ProfileManager::CanonicalizeID(const std::wstring& id) { | 319 std::wstring ProfileManager::CanonicalizeID(const std::wstring& id) { |
| 317 std::wstring no_whitespace; | 320 std::wstring no_whitespace; |
| 318 TrimWhitespace(id, TRIM_ALL, &no_whitespace); | 321 TrimWhitespace(id, TRIM_ALL, &no_whitespace); |
| 319 return StringToLowerASCII(no_whitespace); | 322 return StringToLowerASCII(no_whitespace); |
| 320 } | 323 } |
| OLD | NEW |