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

Unified 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: Not Registering for Users without a username_hash 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 side-by-side diff with in-line comments
Download patch
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..93b1bd4f216662e937ee0099051cb0007e1f2779 100644
--- a/chrome/browser/net/crl_set_fetcher.cc
+++ b/chrome/browser/net/crl_set_fetcher.cc
@@ -20,40 +20,71 @@
#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;
CRLSetFetcher::CRLSetFetcher() : cus_(NULL) {}
-bool CRLSetFetcher::GetCRLSetFilePath(base::FilePath* path) const {
- bool ok = PathService::Get(chrome::DIR_USER_DATA, path);
+bool CRLSetFetcher::SetCRLSetFilePath(const std::string* user_id_hash) {
+
+ base::FilePath path;
+ bool ok = PathService::Get(chrome::DIR_USER_DATA, &path);
if (!ok) {
NOTREACHED();
return false;
}
- *path = path->Append(chrome::kCRLSetFilename);
+#if defined(OS_CHROMEOS)
Ryan Sleevi 2014/07/16 19:39:28 Every #ifdef makes for a sad panda. We should try
+ if (user_id_hash)
+ path =
+ path.Append(chromeos::ProfileHelper::GetUserProfileDir(*user_id_hash));
Jorge Lucangeli Obes 2014/07/16 16:36:34 Four-space indentation (double indentation) after
+#endif
+ crl_path_ = path.Append(chrome::kCRLSetFilename);
return true;
}
+base::FilePath CRLSetFetcher::GetCRLSetFilePath() const {
+ return crl_path_;
+}
+
void CRLSetFetcher::StartInitialLoad(ComponentUpdateService* cus) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- cus_ = cus;
+ if (!SetCRLSetFilePath(NULL))
+ return;
+ PostInitialLoad(cus);
+}
+
+void CRLSetFetcher::StartInitialLoadWithHash(ComponentUpdateService* cus,
+ const std::string& user_id_hash) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (!SetCRLSetFilePath(&user_id_hash))
+ return;
+ PostInitialLoad(cus);
+}
+
+void CRLSetFetcher::DeleteFromDisk() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ if (!SetCRLSetFilePath(NULL))
+ return;
if (!BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
- base::Bind(&CRLSetFetcher::DoInitialLoadFromDisk, this))) {
+ base::Bind(&CRLSetFetcher::DoDeleteFromDisk, this))) {
NOTREACHED();
}
}
-void CRLSetFetcher::DeleteFromDisk() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+void CRLSetFetcher::PostInitialLoad(ComponentUpdateService* cus) {
+ cus_ = cus;
if (!BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
- base::Bind(&CRLSetFetcher::DoDeleteFromDisk, this))) {
+ base::Bind(&CRLSetFetcher::DoInitialLoadFromDisk, this))) {
NOTREACHED();
}
}
@@ -61,11 +92,7 @@ void CRLSetFetcher::DeleteFromDisk() {
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_);
+ LoadFromDisk(GetCRLSetFilePath(), &crl_set_);
uint32 sequence_of_loaded_crl = 0;
if (crl_set_.get())
@@ -160,11 +187,7 @@ void CRLSetFetcher::RegisterComponent(uint32 sequence_of_loaded_crl) {
void CRLSetFetcher::DoDeleteFromDisk() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- base::FilePath crl_set_file_path;
- if (!GetCRLSetFilePath(&crl_set_file_path))
- return;
-
- DeleteFile(crl_set_file_path, false /* not recursive */);
+ DeleteFile(GetCRLSetFilePath(), false /* not recursive */);
}
void CRLSetFetcher::OnUpdateError(int error) {
@@ -176,9 +199,7 @@ bool CRLSetFetcher::Install(const base::DictionaryValue& manifest,
const base::FilePath& unpack_path) {
base::FilePath crl_set_file_path =
unpack_path.Append(FILE_PATH_LITERAL("crl-set"));
- base::FilePath save_to;
- if (!GetCRLSetFilePath(&save_to))
- return true;
+ base::FilePath save_to = GetCRLSetFilePath();
std::string crl_set_bytes;
if (!base::ReadFileToString(crl_set_file_path, &crl_set_bytes)) {
« chrome/browser/net/crl_set_fetcher.h ('K') | « chrome/browser/net/crl_set_fetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698