Chromium Code Reviews| Index: chrome/browser/net/crl_set_fetcher.cc |
| diff --git a/chrome/browser/net/crl_set_fetcher.cc b/chrome/browser/net/crl_set_fetcher.cc |
| index f4c1648b59b562f35dcba067982ed6c448afb9a2..946d886bff53dddfbf9746e6b8c706c42282aa3f 100644 |
| --- a/chrome/browser/net/crl_set_fetcher.cc |
| +++ b/chrome/browser/net/crl_set_fetcher.cc |
| @@ -14,12 +14,16 @@ |
| #include "base/time/time.h" |
| #include "chrome/browser/component_updater/component_updater_service.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_paths.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "net/cert/crl_set.h" |
| #include "net/cert/crl_set_storage.h" |
| #include "net/ssl/ssl_config_service.h" |
| +#if defined(OS_CHROMEOS) |
| +#include "chrome/browser/chromeos/profiles/profile_helper.h" |
| +#endif |
| using component_updater::ComponentUpdateService; |
| using content::BrowserThread; |
| @@ -27,11 +31,24 @@ using content::BrowserThread; |
| CRLSetFetcher::CRLSetFetcher() : cus_(NULL) {} |
| bool CRLSetFetcher::GetCRLSetFilePath(base::FilePath* path) const { |
| + |
| bool ok = PathService::Get(chrome::DIR_USER_DATA, path); |
| + |
| if (!ok) { |
| NOTREACHED(); |
| return false; |
| } |
| + // For ChromeOS we place the file in the Profile Dir |
|
xiyuan
2014/07/15 01:36:17
Why ChromeOS is different from desktop chrome and
|
| +#if defined(OS_CHROMEOS) |
| + Profile* profile = ProfileManager::GetPrimaryUserProfile(); |
| + if (!profile) |
| + return false; |
| + std::string hash = |
| + chromeos::ProfileHelper::GetUserIdHashFromProfile(profile); |
| + if (hash.empty()) |
| + return false; |
| + *path = path->Append(chromeos::ProfileHelper::GetUserProfileDir(hash)); |
| +#endif |
| *path = path->Append(chrome::kCRLSetFilename); |
| return true; |
| } |
| @@ -62,14 +79,16 @@ void CRLSetFetcher::DoInitialLoadFromDisk() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| base::FilePath crl_set_file_path; |
| - if (!GetCRLSetFilePath(&crl_set_file_path)) |
| - return; |
| - |
| - LoadFromDisk(crl_set_file_path, &crl_set_); |
| - |
| uint32 sequence_of_loaded_crl = 0; |
| - if (crl_set_.get()) |
| - sequence_of_loaded_crl = crl_set_->sequence(); |
| + |
| + if (GetCRLSetFilePath(&crl_set_file_path)) { |
| + LoadFromDisk(crl_set_file_path, &crl_set_); |
| + if (crl_set_.get()) |
| + sequence_of_loaded_crl = crl_set_->sequence(); |
| + } |
| + // Even if we couldnt load from disk we still register. |
| + // This is needed for ChromeOS as crl_set_file_path will not be valid |
| + // until a user logs in. |
|
Ryan Sleevi
2014/07/14 23:29:00
1) Pronouns generally considered harmful in commen
|
| // Get updates, advertising the sequence number of the CRL set that we just |
| // loaded, if any. |