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

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, 9 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 <string>
10 #include <vector>
11
12 #include "base/shared_memory.h"
13 #include "base/timer.h"
14 #include "content/renderer/render_process_observer.h"
15 #include "chrome/common/extensions/extension_set.h"
16
17 class GURL;
18 class ListValue;
19 class RenderThread;
20 class URLPattern;
21 class UserScriptSlave;
22 struct ExtensionMsg_Loaded_Params;
23
24 // Dispatches extension control messages sent to the renderer. Object will
25 // delete itself when the renderer shuts down.
26 class ExtensionDispatcher : public RenderProcessObserver {
27 public:
28 // Returns the ExtensionDispatcher for this process.
29 static ExtensionDispatcher* Get();
30
31 ExtensionDispatcher();
32 virtual ~ExtensionDispatcher();
33
34 bool is_extension_process() const { return is_extension_process_; }
35 const ExtensionSet* extensions() const { return &extensions_; }
36 UserScriptSlave* user_script_slave() { return user_script_slave_.get(); }
37
38 private:
39 // RenderProcessObserver implementation:
40 virtual bool OnControlMessageReceived(const IPC::Message& message);
41 virtual void OnRenderProcessShutdown();
42 virtual void WebKitInitialized();
43 virtual bool AllowScriptExtension(const std::string& v8_extension_name,
44 const GURL& url,
45 int extension_group);
46 virtual void IdleNotification();
47
48 void OnMessageInvoke(const std::string& extension_id,
49 const std::string& function_name,
50 const ListValue& args,
51 const GURL& event_url);
52 void OnSetFunctionNames(const std::vector<std::string>& names);
53 void OnLoaded(const ExtensionMsg_Loaded_Params& params);
54 void OnUnloaded(const std::string& id);
55 void OnSetScriptingWhitelist(
56 const Extension::ScriptingWhitelist& extension_ids);
57 void OnPageActionsUpdated(const std::string& extension_id,
58 const std::vector<std::string>& page_actions);
59 void OnSetAPIPermissions(const std::string& extension_id,
60 const std::set<std::string>& permissions);
61 void OnSetHostPermissions(const GURL& extension_url,
62 const std::vector<URLPattern>& permissions);
63 void OnUpdateUserScripts(base::SharedMemoryHandle table);
64
65 // Update the list of active extensions that will be reported when we crash.
66 void UpdateActiveExtensions();
67
68 // True if this renderer is running extensions.
69 bool is_extension_process_;
70
71 // Contains all loaded extensions. This is essentially the renderer
72 // counterpart to ExtensionService in the browser. It contains information
73 // about all extensions currently loaded by the browser.
74 ExtensionSet extensions_;
75
76 scoped_ptr<UserScriptSlave> user_script_slave_;
77
78 // Same as above, but on a longer timer and will run even if the process is
79 // not idle, to ensure that IdleHandle gets called eventually.
80 base::RepeatingTimer<RenderThread> forced_idle_timer_;
81
82 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher);
83 };
84
85 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698