blob: 5848be9bd0e44f27eb923565a264e3aaed036667 [file] [log] [blame]
[email protected]5df038b2012-07-16 19:03:271// 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
3// found in the LICENSE file.
4
5#include "chrome/browser/extensions/external_loader.h"
6
7#include "base/logging.h"
8#include "base/values.h"
9#include "chrome/browser/extensions/external_provider_impl.h"
10#include "content/public/browser/browser_thread.h"
11
12using content::BrowserThread;
13
14namespace extensions {
15
16ExternalLoader::ExternalLoader()
[email protected]14036d92013-07-24 17:32:2017 : owner_(NULL) {
[email protected]5df038b2012-07-16 19:03:2718}
19
20void ExternalLoader::Init(ExternalProviderImpl* owner) {
Istiaque Ahmedf6e72622017-09-08 23:14:1721 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]5df038b2012-07-16 19:03:2722 owner_ = owner;
23}
24
[email protected]650b2d52013-02-10 03:41:4525const base::FilePath ExternalLoader::GetBaseCrxFilePath() {
Istiaque Ahmedf6e72622017-09-08 23:14:1726 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]5df038b2012-07-16 19:03:2727
28 // By default, relative paths are not supported.
29 // Subclasses that wish to support them should override this method.
[email protected]650b2d52013-02-10 03:41:4530 return base::FilePath();
[email protected]5df038b2012-07-16 19:03:2731}
32
33void ExternalLoader::OwnerShutdown() {
Istiaque Ahmedf6e72622017-09-08 23:14:1734 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]5df038b2012-07-16 19:03:2735 owner_ = NULL;
36}
37
38ExternalLoader::~ExternalLoader() {}
39
Istiaque Ahmedef99c8ea2017-09-06 21:19:5740void ExternalLoader::LoadFinished(
41 std::unique_ptr<base::DictionaryValue> prefs) {
Istiaque Ahmedf6e72622017-09-08 23:14:1742 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]5df038b2012-07-16 19:03:2743 if (owner_) {
Istiaque Ahmedef99c8ea2017-09-06 21:19:5744 owner_->SetPrefs(std::move(prefs));
[email protected]5df038b2012-07-16 19:03:2745 }
46}
47
lazyboye8634172016-01-28 00:10:4848void ExternalLoader::OnUpdated(
dchengc963c7142016-04-08 03:55:2249 std::unique_ptr<base::DictionaryValue> updated_prefs) {
Istiaque Ahmedf6e72622017-09-08 23:14:1750 DCHECK_CURRENTLY_ON(BrowserThread::UI);
lazyboye8634172016-01-28 00:10:4851 if (owner_)
Istiaque Ahmeda7431b32017-08-20 18:33:3752 owner_->UpdatePrefs(std::move(updated_prefs));
lazyboye8634172016-01-28 00:10:4853}
54
[email protected]5df038b2012-07-16 19:03:2755} // namespace extensions