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

Side by Side Diff: chrome/renderer/extensions/extension_dispatcher.h

Issue 6765011: Move the dispatching of extension messages out of RenderThread. This also moves a bunch of exten... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #ifndef CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
7 #pragma once
8
9 #include <set>
10 #include <string>
11 #include <vector>
12
13 #include "base/shared_memory.h"
14 #include "base/timer.h"
15 #include "content/renderer/render_process_observer.h"
16 #include "chrome/common/extensions/extension_set.h"
17
18 class GURL;
19 class ListValue;
20 class RenderThread;
21 class URLPattern;
22 class UserScriptSlave;
23 struct ExtensionMsg_Loaded_Params;
24
25 namespace v8 {
26 class Extension;
27 }
28
29 // Dispatches extension control messages sent to the renderer and stores
30 // renderer extension related state. Object will delete itself when the
31 // renderer shuts down.
32 class ExtensionDispatcher : public RenderProcessObserver {
33 public:
34 // Returns the ExtensionDispatcher for this process.
35 static ExtensionDispatcher* Get();
36
37 ExtensionDispatcher();
38 virtual ~ExtensionDispatcher();
39
40 bool is_extension_process() const { return is_extension_process_; }
41 const ExtensionSet* extensions() const { return &extensions_; }
42 UserScriptSlave* user_script_slave() { return user_script_slave_.get(); }
43
44 private:
45 friend class RenderViewTest;
46
47 // RenderProcessObserver implementation:
48 virtual bool OnControlMessageReceived(const IPC::Message& message);
49 virtual void OnRenderProcessShutdown();
50 virtual void WebKitInitialized();
51 virtual bool AllowScriptExtension(const std::string& v8_extension_name,
52 const GURL& url,
53 int extension_group);
54 virtual void IdleNotification();
55
56 void OnMessageInvoke(const std::string& extension_id,
57 const std::string& function_name,
58 const ListValue& args,
59 const GURL& event_url);
60 void OnSetFunctionNames(const std::vector<std::string>& names);
61 void OnLoaded(const ExtensionMsg_Loaded_Params& params);
62 void OnUnloaded(const std::string& id);
63 void OnSetScriptingWhitelist(
64 const Extension::ScriptingWhitelist& extension_ids);
65 void OnPageActionsUpdated(const std::string& extension_id,
66 const std::vector<std::string>& page_actions);
67 void OnSetAPIPermissions(const std::string& extension_id,
68 const std::set<std::string>& permissions);
69 void OnSetHostPermissions(const GURL& extension_url,
70 const std::vector<URLPattern>& permissions);
71 void OnUpdateUserScripts(base::SharedMemoryHandle table);
72
73 // Update the list of active extensions that will be reported when we crash.
74 void UpdateActiveExtensions();
75
76 // Calls RenderThread's RegisterExtension and keeps tracks of which v8
77 // extension is for Chrome Extensions only.
78 void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions);
79
80 // True if this renderer is running extensions.
81 bool is_extension_process_;
82
83 // Contains all loaded extensions. This is essentially the renderer
84 // counterpart to ExtensionService in the browser. It contains information
85 // about all extensions currently loaded by the browser.
86 ExtensionSet extensions_;
87
88 scoped_ptr<UserScriptSlave> user_script_slave_;
89
90 // Same as above, but on a longer timer and will run even if the process is
91 // not idle, to ensure that IdleHandle gets called eventually.
92 base::RepeatingTimer<RenderThread> forced_idle_timer_;
93
94 // The v8 extensions which are restricted to extension-related contexts.
95 std::set<std::string> restricted_v8_extensions_;
96
97 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher);
98 };
99
100 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/event_bindings.cc ('k') | chrome/renderer/extensions/extension_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698