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

Unified Diff: chrome/browser/extensions/external_pref_extension_loader.cc

Issue 6265014: Handles path absence instead of CHECKing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/external_pref_extension_loader.cc
diff --git a/chrome/browser/extensions/external_pref_extension_loader.cc b/chrome/browser/extensions/external_pref_extension_loader.cc
index fc84b1ebf6df8b9023c67fba18696c0fd0069688..0d246b01c50735cfaca21b472616272377238262 100644
--- a/chrome/browser/extensions/external_pref_extension_loader.cc
+++ b/chrome/browser/extensions/external_pref_extension_loader.cc
@@ -60,19 +60,22 @@ void ExternalPrefExtensionLoader::StartLoading() {
void ExternalPrefExtensionLoader::LoadOnFileThread() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- CHECK(PathService::Get(base_path_key_, &base_path_));
+ scoped_ptr<DictionaryValue> prefs;
- FilePath json_file;
- json_file = base_path_.Append(FILE_PATH_LITERAL("external_extensions.json"));
+ if (PathService::Get(base_path_key_, &base_path_)) {
+ FilePath json_file;
+ json_file =
+ base_path_.Append(FILE_PATH_LITERAL("external_extensions.json"));
- scoped_ptr<DictionaryValue> prefs;
- if (file_util::PathExists(json_file)) {
- JSONFileValueSerializer serializer(json_file);
- prefs.reset(ExtractPrefs(&serializer));
- } else {
- prefs.reset(new DictionaryValue());
+ if (file_util::PathExists(json_file)) {
+ JSONFileValueSerializer serializer(json_file);
+ prefs.reset(ExtractPrefs(&serializer));
+ }
}
+ if (!prefs.get())
+ prefs.reset(new DictionaryValue());
+
prefs_.reset(prefs.release());
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698