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

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

Issue 5742008: Clean up threading model of external extension providers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final rebase 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
Index: chrome/browser/extensions/external_pref_extension_provider.cc
diff --git a/chrome/browser/extensions/external_pref_extension_provider.cc b/chrome/browser/extensions/external_pref_extension_provider.cc
deleted file mode 100644
index 7ea5f4a2a05dd5ae311fd01ba168371ddaacda3e..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/external_pref_extension_provider.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/extensions/external_pref_extension_provider.h"
-
-#include "app/app_paths.h"
-#include "base/file_path.h"
-#include "base/file_util.h"
-#include "base/logging.h"
-#include "base/path_service.h"
-#include "chrome/browser/browser_thread.h"
-#include "chrome/browser/extensions/stateful_external_extension_provider.h"
-#include "chrome/common/json_value_serializer.h"
-
-ExternalPrefExtensionProvider::ExternalPrefExtensionProvider()
- : StatefulExternalExtensionProvider(Extension::EXTERNAL_PREF,
- Extension::EXTERNAL_PREF_DOWNLOAD) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- FilePath json_file;
- PathService::Get(app::DIR_EXTERNAL_EXTENSIONS, &json_file);
- json_file = json_file.Append(FILE_PATH_LITERAL("external_extensions.json"));
-
- if (file_util::PathExists(json_file)) {
- JSONFileValueSerializer serializer(json_file);
- SetPreferences(&serializer);
- } else {
- set_prefs(new DictionaryValue());
- }
-}
-
-ExternalPrefExtensionProvider::~ExternalPrefExtensionProvider() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-}
-
-void ExternalPrefExtensionProvider::SetPreferencesForTesting(
- const std::string& json_data_for_testing) {
- JSONStringValueSerializer serializer(json_data_for_testing);
- SetPreferences(&serializer);
-}
-
-void ExternalPrefExtensionProvider::SetPreferences(
- ValueSerializer* serializer) {
- std::string error_msg;
- Value* extensions = serializer->Deserialize(NULL, &error_msg);
- scoped_ptr<DictionaryValue> dictionary(new DictionaryValue());
- if (!extensions) {
- LOG(WARNING) << "Unable to deserialize json data: " << error_msg;
- } else {
- if (!extensions->IsType(Value::TYPE_DICTIONARY)) {
- NOTREACHED() << "Invalid json data";
- } else {
- dictionary.reset(static_cast<DictionaryValue*>(extensions));
- }
- }
- set_prefs(dictionary.release());
-}

Powered by Google App Engine
This is Rietveld 408576698