Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / external_component_loader.h
blobb27d50485bb6a3e8c44de31fb9c795f3d70313e2
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_
8 #include <string>
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> {
29 public:
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);
37 protected:
38 virtual void StartLoading() OVERRIDE;
40 private:
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.
46 Profile* 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_;
56 #endif
58 DISALLOW_COPY_AND_ASSIGN(ExternalComponentLoader);
61 } // namespace extensions
63 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_COMPONENT_LOADER_H_