| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_RENDERER_RENDER_THREAD_H_ | 5 #ifndef CHROME_RENDERER_RENDER_THREAD_H_ |
| 6 #define CHROME_RENDERER_RENDER_THREAD_H_ | 6 #define CHROME_RENDERER_RENDER_THREAD_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/shared_memory.h" | 13 #include "base/shared_memory.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/timer.h" | 15 #include "base/timer.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/common/child_thread.h" | 17 #include "chrome/common/child_thread.h" |
| 18 #include "chrome/common/css_colors.h" | 18 #include "chrome/common/css_colors.h" |
| 19 #include "chrome/common/gpu_info.h" | 19 #include "chrome/common/gpu_info.h" |
| 20 #include "chrome/renderer/extensions/extension_renderer_info.h" |
| 20 #include "chrome/renderer/visitedlink_slave.h" | 21 #include "chrome/renderer/visitedlink_slave.h" |
| 21 #include "gfx/native_widget_types.h" | 22 #include "gfx/native_widget_types.h" |
| 22 #include "ipc/ipc_channel_proxy.h" | 23 #include "ipc/ipc_channel_proxy.h" |
| 23 #include "ipc/ipc_platform_file.h" | 24 #include "ipc/ipc_platform_file.h" |
| 24 | 25 |
| 25 class AppCacheDispatcher; | 26 class AppCacheDispatcher; |
| 26 class CookieMessageFilter; | 27 class CookieMessageFilter; |
| 27 class DBMessageFilter; | 28 class DBMessageFilter; |
| 28 class DevToolsAgentFilter; | 29 class DevToolsAgentFilter; |
| 30 class ExtensionRendererInfo; |
| 29 class FilePath; | 31 class FilePath; |
| 30 class GpuChannelHost; | 32 class GpuChannelHost; |
| 31 class IndexedDBDispatcher; | 33 class IndexedDBDispatcher; |
| 32 class ListValue; | 34 class ListValue; |
| 33 class RendererHistogram; | 35 class RendererHistogram; |
| 34 class RendererHistogramSnapshots; | 36 class RendererHistogramSnapshots; |
| 35 class RendererNetPredictor; | 37 class RendererNetPredictor; |
| 36 class RendererWebKitClientImpl; | 38 class RendererWebKitClientImpl; |
| 37 class SpellCheck; | 39 class SpellCheck; |
| 38 class SkBitmap; | 40 class SkBitmap; |
| 39 class UserScriptSlave; | 41 class UserScriptSlave; |
| 40 class URLPattern; | 42 class URLPattern; |
| 41 class WebDatabaseObserverImpl; | 43 class WebDatabaseObserverImpl; |
| 42 | 44 |
| 43 struct ContentSettings; | 45 struct ContentSettings; |
| 44 struct RendererPreferences; | 46 struct RendererPreferences; |
| 45 struct DOMStorageMsg_Event_Params; | 47 struct DOMStorageMsg_Event_Params; |
| 46 struct ViewMsg_ExtensionsUpdated_Params; | 48 struct ViewMsg_ExtensionLoaded_Params; |
| 47 struct ViewMsg_New_Params; | 49 struct ViewMsg_New_Params; |
| 48 struct WebPreferences; | 50 struct WebPreferences; |
| 49 | 51 |
| 50 namespace base { | 52 namespace base { |
| 51 class MessageLoopProxy; | 53 class MessageLoopProxy; |
| 52 template<class T> class ScopedCallbackFactory; | 54 template<class T> class ScopedCallbackFactory; |
| 53 class Thread; | 55 class Thread; |
| 54 } | 56 } |
| 55 | 57 |
| 56 namespace IPC { | 58 namespace IPC { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // browser process. These need the ::current() paradigm. So instead, we should | 98 // browser process. These need the ::current() paradigm. So instead, we should |
| 97 // probably remove the render_thread_ parameter to RenderView/Widget in | 99 // probably remove the render_thread_ parameter to RenderView/Widget in |
| 98 // preference to just getting the global singleton. We can make it easier to | 100 // preference to just getting the global singleton. We can make it easier to |
| 99 // understand by moving everything to the abstract interface and saying that | 101 // understand by moving everything to the abstract interface and saying that |
| 100 // there should never be a NULL RenderThread::current(). Tests would be | 102 // there should never be a NULL RenderThread::current(). Tests would be |
| 101 // responsible for setting up the mock one. | 103 // responsible for setting up the mock one. |
| 102 class RenderThreadBase { | 104 class RenderThreadBase { |
| 103 public: | 105 public: |
| 104 virtual ~RenderThreadBase() {} | 106 virtual ~RenderThreadBase() {} |
| 105 | 107 |
| 108 // Information about currently loaded extensions. This is essentially the |
| 109 // renderer counterpart to ExtensionService in the browser. It contains |
| 110 // information about all extensions currently loaded by the browser. |
| 111 virtual const ExtensionRendererInfo* GetExtensions() const = 0; |
| 112 |
| 106 virtual bool Send(IPC::Message* msg) = 0; | 113 virtual bool Send(IPC::Message* msg) = 0; |
| 107 | 114 |
| 108 // Called to add or remove a listener for a particular message routing ID. | 115 // Called to add or remove a listener for a particular message routing ID. |
| 109 // These methods normally get delegated to a MessageRouter. | 116 // These methods normally get delegated to a MessageRouter. |
| 110 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) = 0; | 117 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) = 0; |
| 111 virtual void RemoveRoute(int32 routing_id) = 0; | 118 virtual void RemoveRoute(int32 routing_id) = 0; |
| 112 | 119 |
| 113 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter) = 0; | 120 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter) = 0; |
| 114 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) = 0; | 121 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) = 0; |
| 115 | 122 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // TODO(brettw) this should be on the abstract base class instead of here, | 155 // TODO(brettw) this should be on the abstract base class instead of here, |
| 149 // and return the base class' interface instead. Currently this causes | 156 // and return the base class' interface instead. Currently this causes |
| 150 // problems with testing. See the comment above RenderThreadBase above. | 157 // problems with testing. See the comment above RenderThreadBase above. |
| 151 static RenderThread* current(); | 158 static RenderThread* current(); |
| 152 | 159 |
| 153 // Returns the routing ID of the RenderWidget containing the current script | 160 // Returns the routing ID of the RenderWidget containing the current script |
| 154 // execution context (corresponding to WebFrame::frameForCurrentContext). | 161 // execution context (corresponding to WebFrame::frameForCurrentContext). |
| 155 static int32 RoutingIDForCurrentContext(); | 162 static int32 RoutingIDForCurrentContext(); |
| 156 | 163 |
| 157 // Overridden from RenderThreadBase. | 164 // Overridden from RenderThreadBase. |
| 165 virtual const ExtensionRendererInfo* GetExtensions() const; |
| 158 virtual bool Send(IPC::Message* msg); | 166 virtual bool Send(IPC::Message* msg); |
| 159 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); | 167 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); |
| 160 virtual void RemoveRoute(int32 routing_id); | 168 virtual void RemoveRoute(int32 routing_id); |
| 161 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter); | 169 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter); |
| 162 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); | 170 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); |
| 163 virtual void WidgetHidden(); | 171 virtual void WidgetHidden(); |
| 164 virtual void WidgetRestored(); | 172 virtual void WidgetRestored(); |
| 165 virtual bool IsExtensionProcess() const; | 173 virtual bool IsExtensionProcess() const; |
| 166 virtual bool IsIncognitoProcess() const; | 174 virtual bool IsIncognitoProcess() const; |
| 167 | 175 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 void Init(); | 267 void Init(); |
| 260 | 268 |
| 261 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); | 269 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); |
| 262 void OnAddVisitedLinks(const VisitedLinkSlave::Fingerprints& fingerprints); | 270 void OnAddVisitedLinks(const VisitedLinkSlave::Fingerprints& fingerprints); |
| 263 void OnResetVisitedLinks(); | 271 void OnResetVisitedLinks(); |
| 264 void OnSetZoomLevelForCurrentURL(const GURL& url, double zoom_level); | 272 void OnSetZoomLevelForCurrentURL(const GURL& url, double zoom_level); |
| 265 void OnSetContentSettingsForCurrentURL( | 273 void OnSetContentSettingsForCurrentURL( |
| 266 const GURL& url, const ContentSettings& content_settings); | 274 const GURL& url, const ContentSettings& content_settings); |
| 267 void OnUpdateUserScripts(base::SharedMemoryHandle table); | 275 void OnUpdateUserScripts(base::SharedMemoryHandle table); |
| 268 void OnSetExtensionFunctionNames(const std::vector<std::string>& names); | 276 void OnSetExtensionFunctionNames(const std::vector<std::string>& names); |
| 269 void OnExtensionsUpdated( | 277 void OnExtensionLoaded(const ViewMsg_ExtensionLoaded_Params& params); |
| 270 const ViewMsg_ExtensionsUpdated_Params& params); | 278 void OnExtensionUnloaded(const std::string& id); |
| 271 void OnPageActionsUpdated(const std::string& extension_id, | 279 void OnPageActionsUpdated(const std::string& extension_id, |
| 272 const std::vector<std::string>& page_actions); | 280 const std::vector<std::string>& page_actions); |
| 273 void OnDOMStorageEvent(const DOMStorageMsg_Event_Params& params); | 281 void OnDOMStorageEvent(const DOMStorageMsg_Event_Params& params); |
| 274 void OnExtensionSetAPIPermissions( | 282 void OnExtensionSetAPIPermissions( |
| 275 const std::string& extension_id, | 283 const std::string& extension_id, |
| 276 const std::set<std::string>& permissions); | 284 const std::set<std::string>& permissions); |
| 277 void OnExtensionSetHostPermissions( | 285 void OnExtensionSetHostPermissions( |
| 278 const GURL& extension_url, | 286 const GURL& extension_url, |
| 279 const std::vector<URLPattern>& permissions); | 287 const std::vector<URLPattern>& permissions); |
| 280 void OnSetNextPageID(int32 next_page_id); | 288 void OnSetNextPageID(int32 next_page_id); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 scoped_refptr<GpuChannelHost> gpu_channel_; | 411 scoped_refptr<GpuChannelHost> gpu_channel_; |
| 404 | 412 |
| 405 // A lazily initiated thread on which file operations are run. | 413 // A lazily initiated thread on which file operations are run. |
| 406 scoped_ptr<base::Thread> file_thread_; | 414 scoped_ptr<base::Thread> file_thread_; |
| 407 | 415 |
| 408 // Map of registered v8 extensions. The key is the extension name. The value | 416 // Map of registered v8 extensions. The key is the extension name. The value |
| 409 // is true if the extension should be restricted to extension-related | 417 // is true if the extension should be restricted to extension-related |
| 410 // contexts. | 418 // contexts. |
| 411 std::map<std::string, bool> v8_extensions_; | 419 std::map<std::string, bool> v8_extensions_; |
| 412 | 420 |
| 421 // Contains all loaded extensions. |
| 422 ExtensionRendererInfo extensions_; |
| 423 |
| 413 DISALLOW_COPY_AND_ASSIGN(RenderThread); | 424 DISALLOW_COPY_AND_ASSIGN(RenderThread); |
| 414 }; | 425 }; |
| 415 | 426 |
| 416 #endif // CHROME_RENDERER_RENDER_THREAD_H_ | 427 #endif // CHROME_RENDERER_RENDER_THREAD_H_ |
| OLD | NEW |