1 // Copyright (c) 2013 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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_COMPONENT_LOADER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_COMPONENT_LOADER_H_
10 #include "base/compiler_specific.h"
11 #include "base/containers/hash_tables.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/extensions/external_loader.h"
14 #include "chrome/browser/profiles/profile.h"
16 class PrefChangeRegistrar
;
18 namespace extensions
{
20 // A specialization of the ExternalLoader that loads a hard-coded list of
21 // external extensions, that should be considered components of chrome (but
22 // unlike Component extensions, these extensions are installed from the webstore
23 // and don't get access to component only APIs.
24 // Instances of this class are expected to be created and destroyed on the UI
25 // thread and they are expecting public method calls from the UI thread.
26 class ExternalComponentLoader
27 : public ExternalLoader
,
28 public base::SupportsWeakPtr
<ExternalComponentLoader
> {
30 explicit ExternalComponentLoader(Profile
* profile
);
32 static bool IsEnhancedBookmarksExperimentEnabled();
34 // Register speech synthesis prefs for a profile.
35 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable
* registry
);
38 virtual void StartLoading() OVERRIDE
;
41 friend class base::RefCountedThreadSafe
<ExternalLoader
>;
42 virtual ~ExternalComponentLoader();
44 // The profile that this loader is associated with. It listens for
45 // preference changes for that profile.
48 #if defined(OS_CHROMEOS)
49 // The pref change registrar, so we can watch for pref changes.
50 scoped_ptr
<PrefChangeRegistrar
> pref_change_registrar_
;
52 // A map from language code to the extension id of the high-quality
53 // extension for that language in the web store, if any - for loading
54 // speech synthesis component extensions.
55 base::hash_map
<std::string
, std::string
> lang_to_extension_id_map_
;
58 DISALLOW_COPY_AND_ASSIGN(ExternalComponentLoader
);
61 } // namespace extensions
63 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_COMPONENT_LOADER_H_