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

Side by Side Diff: chrome/browser/extensions/extension_user_script_loader.h

Issue 822453002: Introduce HostID and de-couple Extensions from "script injection System" [browser side] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the test failures. Created 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
Devlin 2015/01/14 16:45:09 year
Xi Han 2015/01/14 23:46:03 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_
7
8 #include "base/memory/shared_memory.h"
9 #include "chrome/browser/extensions/user_script_loader.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "extensions/browser/extension_registry_observer.h"
12 #include "extensions/common/extension.h"
13 #include "extensions/common/extension_set.h"
14
15 namespace content {
16 class BrowserContext;
17 }
18
19 class Profile;
20
21 namespace extensions {
22
23 class ContentVerifier;
24 class ExtensionRegistry;
25
26 // UserScriptLoader for extensions.
27 class ExtensionUserScriptLoader : public UserScriptLoader,
28 public ExtensionRegistryObserver {
29 public:
30 // The listen_for_extension_system_loaded is only set true when initilizing
31 // the Exttension System, e.g, when constructs SharedUserScriptMaster in
32 // ExtensionSystemImpl.
33 ExtensionUserScriptLoader(Profile* profile,
34 const ConsumerID& consumer_id,
35 bool listen_for_extension_system_loaded);
36 ~ExtensionUserScriptLoader() override;
37
38 private:
39 static bool LoadScriptContent(const ConsumerID& consumer_id,
Devlin 2015/01/14 16:45:09 Can this go in an anonymous namespace in the .cc?
Xi Han 2015/01/14 23:46:03 No, it can't. This static function is introduced f
40 UserScript::File* script_file,
41 const SubstitutionMap* localization_messages,
42 scoped_refptr<ContentVerifier> verifier);
43
44 // UserScriptLoader implementation.
Devlin 2015/01/14 16:45:09 nit: prefer // UserScriptLoader: (goes for everyw
Xi Han 2015/01/14 23:46:03 Done.
45 void UpdateConsumersInfo() override;
46 bool Ready() override;
47 ContentVerifier* GetContentVerifier() override;
48 LoadUserScriptsFunctionCallback GetLoadUserScriptsFunction() override;
49 void SendUpdate(content::RenderProcessHost* process,
50 base::SharedMemoryHandle handle_for_process,
51 const std::set<ConsumerID>& changed_consumers) override;
52
53 // ExtensionRegistryObserver implementation.
54 void OnExtensionUnloaded(content::BrowserContext* browser_context,
55 const Extension* extension,
56 UnloadedExtensionInfo::Reason reason) override;
57
58 // Initiates script load when we have been waiting for the extension system
59 // to be ready.
60 void OnExtensionSystemReady();
61
62 // If the extensions service has finished loading its initial set of
63 // extensions.
64 bool extension_system_ready_;
65
66 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
67 extension_registry_observer_;
68
69 base::WeakPtrFactory<ExtensionUserScriptLoader> weak_factory_;
70
71 DISALLOW_COPY_AND_ASSIGN(ExtensionUserScriptLoader);
72 };
73
74 } // namespace extensions
75
76 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698