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

Side by Side Diff: chrome/browser/net/crl_set_fetcher.cc

Issue 391783003: Enabling CRLSet for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Correcting BUG= Created 6 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) 2012 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/net/crl_set_fetcher.h" 5 #include "chrome/browser/net/crl_set_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/browser/component_updater/component_updater_service.h" 15 #include "chrome/browser/component_updater/component_updater_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_manager.h"
17 #include "chrome/common/chrome_constants.h" 18 #include "chrome/common/chrome_constants.h"
18 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "net/cert/crl_set.h" 21 #include "net/cert/crl_set.h"
21 #include "net/cert/crl_set_storage.h" 22 #include "net/cert/crl_set_storage.h"
22 #include "net/ssl/ssl_config_service.h" 23 #include "net/ssl/ssl_config_service.h"
24 #if defined(OS_CHROMEOS)
25 #include "chrome/browser/chromeos/profiles/profile_helper.h"
26 #endif
23 27
24 using component_updater::ComponentUpdateService; 28 using component_updater::ComponentUpdateService;
25 using content::BrowserThread; 29 using content::BrowserThread;
26 30
27 CRLSetFetcher::CRLSetFetcher() : cus_(NULL) {} 31 CRLSetFetcher::CRLSetFetcher() : cus_(NULL) {}
28 32
29 bool CRLSetFetcher::GetCRLSetFilePath(base::FilePath* path) const { 33 bool CRLSetFetcher::GetCRLSetFilePath(base::FilePath* path) const {
34
30 bool ok = PathService::Get(chrome::DIR_USER_DATA, path); 35 bool ok = PathService::Get(chrome::DIR_USER_DATA, path);
36
31 if (!ok) { 37 if (!ok) {
32 NOTREACHED(); 38 NOTREACHED();
33 return false; 39 return false;
34 } 40 }
41 // 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
42 #if defined(OS_CHROMEOS)
43 Profile* profile = ProfileManager::GetPrimaryUserProfile();
44 if (!profile)
45 return false;
46 std::string hash =
47 chromeos::ProfileHelper::GetUserIdHashFromProfile(profile);
48 if (hash.empty())
49 return false;
50 *path = path->Append(chromeos::ProfileHelper::GetUserProfileDir(hash));
51 #endif
35 *path = path->Append(chrome::kCRLSetFilename); 52 *path = path->Append(chrome::kCRLSetFilename);
36 return true; 53 return true;
37 } 54 }
38 55
39 void CRLSetFetcher::StartInitialLoad(ComponentUpdateService* cus) { 56 void CRLSetFetcher::StartInitialLoad(ComponentUpdateService* cus) {
40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
41 58
42 cus_ = cus; 59 cus_ = cus;
43 60
44 if (!BrowserThread::PostTask( 61 if (!BrowserThread::PostTask(
(...skipping 10 matching lines...) Expand all
55 BrowserThread::FILE, FROM_HERE, 72 BrowserThread::FILE, FROM_HERE,
56 base::Bind(&CRLSetFetcher::DoDeleteFromDisk, this))) { 73 base::Bind(&CRLSetFetcher::DoDeleteFromDisk, this))) {
57 NOTREACHED(); 74 NOTREACHED();
58 } 75 }
59 } 76 }
60 77
61 void CRLSetFetcher::DoInitialLoadFromDisk() { 78 void CRLSetFetcher::DoInitialLoadFromDisk() {
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
63 80
64 base::FilePath crl_set_file_path; 81 base::FilePath crl_set_file_path;
65 if (!GetCRLSetFilePath(&crl_set_file_path)) 82 uint32 sequence_of_loaded_crl = 0;
66 return;
67 83
68 LoadFromDisk(crl_set_file_path, &crl_set_); 84 if (GetCRLSetFilePath(&crl_set_file_path)) {
69 85 LoadFromDisk(crl_set_file_path, &crl_set_);
70 uint32 sequence_of_loaded_crl = 0; 86 if (crl_set_.get())
71 if (crl_set_.get()) 87 sequence_of_loaded_crl = crl_set_->sequence();
72 sequence_of_loaded_crl = crl_set_->sequence(); 88 }
89 // Even if we couldnt load from disk we still register.
90 // This is needed for ChromeOS as crl_set_file_path will not be valid
91 // until a user logs in.
Ryan Sleevi 2014/07/14 23:29:00 1) Pronouns generally considered harmful in commen
73 92
74 // Get updates, advertising the sequence number of the CRL set that we just 93 // Get updates, advertising the sequence number of the CRL set that we just
75 // loaded, if any. 94 // loaded, if any.
76 if (!BrowserThread::PostTask( 95 if (!BrowserThread::PostTask(
77 BrowserThread::UI, FROM_HERE, 96 BrowserThread::UI, FROM_HERE,
78 base::Bind( 97 base::Bind(
79 &CRLSetFetcher::RegisterComponent, 98 &CRLSetFetcher::RegisterComponent,
80 this, 99 this,
81 sequence_of_loaded_crl))) { 100 sequence_of_loaded_crl))) {
82 NOTREACHED(); 101 NOTREACHED();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 253
235 return true; 254 return true;
236 } 255 }
237 256
238 bool CRLSetFetcher::GetInstalledFile( 257 bool CRLSetFetcher::GetInstalledFile(
239 const std::string& file, base::FilePath* installed_file) { 258 const std::string& file, base::FilePath* installed_file) {
240 return false; 259 return false;
241 } 260 }
242 261
243 CRLSetFetcher::~CRLSetFetcher() {} 262 CRLSetFetcher::~CRLSetFetcher() {}
OLDNEW
« chrome/browser/chrome_browser_main.cc ('K') | « chrome/browser/chrome_browser_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698