diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 19:36:41 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 19:36:41 +0000 |
commit | 46f36a49b661fe4af87e95befb659464e3b1fbbc (patch) | |
tree | 86a774a4175c32c882460e61ec9081800fa0ca56 /chrome | |
parent | bf19ce759d2e46e7f1f8839c9f2791f5f7661929 (diff) | |
download | chromium_src-46f36a49b661fe4af87e95befb659464e3b1fbbc.zip chromium_src-46f36a49b661fe4af87e95befb659464e3b1fbbc.tar.gz chromium_src-46f36a49b661fe4af87e95befb659464e3b1fbbc.tar.bz2 |
Header cleanup in chrome/renderer/.
In renderer_webkit_client_impl, several impl classes got moved to the
implementation file.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3032027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53996 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/renderer/pepper_widget.cc | 3 | ||||
-rw-r--r-- | chrome/renderer/render_process_impl.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/render_process_impl.h | 6 | ||||
-rw-r--r-- | chrome/renderer/render_thread.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/render_thread.h | 7 | ||||
-rw-r--r-- | chrome/renderer/render_widget.h | 11 | ||||
-rw-r--r-- | chrome/renderer/renderer_histogram_snapshots.cc | 3 | ||||
-rw-r--r-- | chrome/renderer/renderer_histogram_snapshots.h | 5 | ||||
-rw-r--r-- | chrome/renderer/renderer_webkitclient_impl.cc | 77 | ||||
-rw-r--r-- | chrome/renderer/renderer_webkitclient_impl.h | 77 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.h | 9 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.h | 16 |
14 files changed, 132 insertions, 92 deletions
diff --git a/chrome/renderer/pepper_widget.cc b/chrome/renderer/pepper_widget.cc index cf2710a..9f05f2b 100644 --- a/chrome/renderer/pepper_widget.cc +++ b/chrome/renderer/pepper_widget.cc @@ -8,6 +8,7 @@ #include "base/lazy_instance.h" #include "chrome/renderer/pepper_scrollbar_widget.h" #include "chrome/renderer/webplugin_delegate_pepper.h" +#include "skia/ext/platform_canvas.h" #include "webkit/glue/plugins/plugin_instance.h" #include "webkit/glue/plugins/webplugin.h" #include "webkit/glue/plugins/webplugin_delegate.h" @@ -25,7 +26,7 @@ NPError NPCreateWidget(NPP instance, void* params, NPWidgetID* id) { PepperWidget* widget; - switch(type) { + switch (type) { case NPWidgetTypeScrollbar: widget = new PepperScrollbarWidget( *static_cast<NPScrollbarCreateParams*>(params)); diff --git a/chrome/renderer/render_process_impl.cc b/chrome/renderer/render_process_impl.cc index 0085ae7..2c12e03 100644 --- a/chrome/renderer/render_process_impl.cc +++ b/chrome/renderer/render_process_impl.cc @@ -25,12 +25,14 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/render_messages.h" #include "chrome/common/nacl_types.h" +#include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view.h" #include "ipc/ipc_channel.h" #include "ipc/ipc_message_utils.h" #include "media/base/media.h" #include "media/base/media_switches.h" #include "native_client/src/trusted/plugin/nacl_entry_points.h" +#include "skia/ext/platform_canvas.h" #include "webkit/glue/plugins/plugin_instance.h" #include "webkit/glue/plugins/plugin_lib.h" #include "webkit/glue/webkit_glue.h" diff --git a/chrome/renderer/render_process_impl.h b/chrome/renderer/render_process_impl.h index bd6e335..dcb6a5a 100644 --- a/chrome/renderer/render_process_impl.h +++ b/chrome/renderer/render_process_impl.h @@ -8,9 +8,11 @@ #include "base/timer.h" #include "chrome/renderer/render_process.h" -#include "chrome/renderer/render_thread.h" #include "native_client/src/shared/imc/nacl_imc.h" -#include "skia/ext/platform_canvas.h" + +namespace skia { +class PlatformCanvas; +} // Implementation of the RenderProcess interface for the regular browser. // See also MockRenderProcess which implements the active "RenderProcess" when diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 14bb3a0..03e468a 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -17,6 +17,7 @@ #include "base/shared_memory.h" #include "base/stats_table.h" #include "base/string_util.h" +#include "base/task.h" #include "base/thread_local.h" #include "chrome/common/appcache/appcache_dispatcher.h" #include "chrome/common/child_process_logging.h" @@ -59,6 +60,7 @@ #include "chrome/renderer/renderer_webkitclient_impl.h" #include "chrome/renderer/spellchecker/spellcheck.h" #include "chrome/renderer/user_script_slave.h" +#include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message.h" #include "ipc/ipc_platform_file.h" #include "net/base/net_util.h" diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h index 22b38be..55d53d6 100644 --- a/chrome/renderer/render_thread.h +++ b/chrome/renderer/render_thread.h @@ -6,13 +6,11 @@ #define CHROME_RENDERER_RENDER_THREAD_H_ #pragma once -#include <set> #include <string> #include <vector> #include "base/shared_memory.h" #include "base/string16.h" -#include "base/task.h" #include "base/time.h" #include "base/timer.h" #include "build/build_config.h" @@ -20,7 +18,6 @@ #include "chrome/common/css_colors.h" #include "chrome/renderer/visitedlink_slave.h" #include "gfx/native_widget_types.h" -#include "ipc/ipc_channel_handle.h" #include "ipc/ipc_platform_file.h" class AppCacheDispatcher; @@ -49,6 +46,10 @@ struct ViewMsg_ExtensionExtentsUpdated_Params; struct ViewMsg_New_Params; struct WebPreferences; +namespace IPC { +struct ChannelHandle; +} + namespace WebKit { class WebStorageEventDispatcher; } diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index e7af65a..d8482ea 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -11,15 +11,12 @@ #include "app/surface/transport_dib.h" #include "base/basictypes.h" #include "base/ref_counted.h" -#include "base/shared_memory.h" #include "chrome/renderer/paint_aggregator.h" #include "chrome/renderer/render_process.h" #include "gfx/native_widget_types.h" -#include "gfx/point.h" #include "gfx/rect.h" #include "gfx/size.h" #include "ipc/ipc_channel.h" -#include "skia/ext/platform_canvas.h" #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" @@ -32,6 +29,14 @@ class RenderThreadBase; struct ViewHostMsg_ShowPopup_Params; +namespace gfx { +class Point; +} + +namespace skia { +class PlatformCanvas; +} + namespace WebKit { struct WebPopupMenuInfo; } diff --git a/chrome/renderer/renderer_histogram_snapshots.cc b/chrome/renderer/renderer_histogram_snapshots.cc index 5b8165a..cd0206d 100644 --- a/chrome/renderer/renderer_histogram_snapshots.cc +++ b/chrome/renderer/renderer_histogram_snapshots.cc @@ -21,6 +21,9 @@ RendererHistogramSnapshots::RendererHistogramSnapshots() renderer_histogram_snapshots_factory_(this)) { } +RendererHistogramSnapshots::~RendererHistogramSnapshots() { +} + // Send data quickly! void RendererHistogramSnapshots::SendHistograms(int sequence_number) { RenderThread::current()->message_loop()->PostTask(FROM_HERE, diff --git a/chrome/renderer/renderer_histogram_snapshots.h b/chrome/renderer/renderer_histogram_snapshots.h index 9a20198..98c8680 100644 --- a/chrome/renderer/renderer_histogram_snapshots.h +++ b/chrome/renderer/renderer_histogram_snapshots.h @@ -6,9 +6,7 @@ #define CHROME_RENDERER_RENDERER_HISTOGRAM_SNAPSHOTS_H_ #pragma once -#include <list> #include <map> -#include <set> #include <string> #include <vector> @@ -21,8 +19,7 @@ class RendererHistogramSnapshots { public: RendererHistogramSnapshots(); - - ~RendererHistogramSnapshots() {} + ~RendererHistogramSnapshots(); // Send the histogram data. void SendHistograms(int sequence_number); diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc index 8537d65..f2d6a9e 100644 --- a/chrome/renderer/renderer_webkitclient_impl.cc +++ b/chrome/renderer/renderer_webkitclient_impl.cc @@ -21,6 +21,7 @@ #include "chrome/renderer/visitedlink_slave.h" #include "chrome/renderer/webgles2context_impl.h" #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" +#include "chrome/renderer/websharedworkerrepository_impl.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_sync_message_filter.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" @@ -29,15 +30,28 @@ #include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" +#include "webkit/glue/simple_webmimeregistry_impl.h" +#include "webkit/glue/webclipboard_impl.h" +#include "webkit/glue/webfilesystem_impl.h" #include "webkit/glue/webkit_glue.h" +#if defined(OS_WIN) +#include "third_party/WebKit/WebKit/chromium/public/win/WebSandboxSupport.h" +#endif + #if defined(OS_MACOSX) #include "chrome/common/font_descriptor_mac.h" #include "chrome/common/font_loader_mac.h" +#include "third_party/WebKit/WebKit/chromium/public/mac/WebSandboxSupport.h" #endif #if defined(OS_LINUX) +#include <string> +#include <map> + +#include "base/lock.h" #include "chrome/renderer/renderer_sandbox_support_linux.h" +#include "third_party/WebKit/WebKit/chromium/public/linux/WebSandboxSupport.h" #endif #if defined(OS_POSIX) @@ -54,8 +68,59 @@ using WebKit::WebString; using WebKit::WebURL; using WebKit::WebVector; +//------------------------------------------------------------------------------ + +class RendererWebKitClientImpl::MimeRegistry + : public webkit_glue::SimpleWebMimeRegistryImpl { + public: + virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&); + virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); + virtual WebKit::WebString preferredExtensionForMIMEType( + const WebKit::WebString&); +}; + +class RendererWebKitClientImpl::FileSystem + : public webkit_glue::WebFileSystemImpl { + public: + virtual bool getFileSize(const WebKit::WebString& path, long long& result); + virtual bool getFileModificationTime(const WebKit::WebString& path, + double& result); + virtual base::PlatformFile openFile(const WebKit::WebString& path, + int mode); +}; + +class RendererWebKitClientImpl::SandboxSupport + : public WebKit::WebSandboxSupport { + public: +#if defined(OS_WIN) + virtual bool ensureFontLoaded(HFONT); +#elif defined(OS_MACOSX) + virtual bool loadFont(NSFont* srcFont, ATSFontContainerRef* out); +#elif defined(OS_LINUX) + virtual WebKit::WebString getFontFamilyForCharacters( + const WebKit::WebUChar* characters, size_t numCharacters); + virtual void getRenderStyleForStrike( + const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out); + + private: + // WebKit likes to ask us for the correct font family to use for a set of + // unicode code points. It needs this information frequently so we cache it + // here. The key in this map is an array of 16-bit UTF16 values from WebKit. + // The value is a string containing the correct font family. + Lock unicode_font_families_mutex_; + std::map<std::string, std::string> unicode_font_families_; +#endif +}; + +//------------------------------------------------------------------------------ + RendererWebKitClientImpl::RendererWebKitClientImpl() - : sudden_termination_disables_(0) { + : clipboard_(new webkit_glue::WebClipboardImpl), + file_system_(new RendererWebKitClientImpl::FileSystem), + mime_registry_(new RendererWebKitClientImpl::MimeRegistry), + sandbox_support_(new RendererWebKitClientImpl::SandboxSupport), + sudden_termination_disables_(0), + shared_worker_repository_(new WebSharedWorkerRepositoryImpl) { } RendererWebKitClientImpl::~RendererWebKitClientImpl() { @@ -64,19 +129,19 @@ RendererWebKitClientImpl::~RendererWebKitClientImpl() { //------------------------------------------------------------------------------ WebKit::WebClipboard* RendererWebKitClientImpl::clipboard() { - return &clipboard_; + return clipboard_.get(); } WebKit::WebMimeRegistry* RendererWebKitClientImpl::mimeRegistry() { - return &mime_registry_; + return mime_registry_.get(); } WebKit::WebFileSystem* RendererWebKitClientImpl::fileSystem() { - return &file_system_; + return file_system_.get(); } WebKit::WebSandboxSupport* RendererWebKitClientImpl::sandboxSupport() { - return &sandbox_support_; + return sandbox_support_.get(); } WebKit::WebCookieJar* RendererWebKitClientImpl::cookieJar() { @@ -385,7 +450,7 @@ WebKit::WebSharedWorkerRepository* RendererWebKitClientImpl::sharedWorkerRepository() { if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableSharedWorkers)) { - return &shared_worker_repository_; + return shared_worker_repository_.get(); } else { return NULL; } diff --git a/chrome/renderer/renderer_webkitclient_impl.h b/chrome/renderer/renderer_webkitclient_impl.h index 5d58641..c93666c 100644 --- a/chrome/renderer/renderer_webkitclient_impl.h +++ b/chrome/renderer/renderer_webkitclient_impl.h @@ -8,27 +8,18 @@ #include "base/platform_file.h" #include "base/scoped_ptr.h" -#include "chrome/renderer/websharedworkerrepository_impl.h" -#include "webkit/glue/simple_webmimeregistry_impl.h" -#include "webkit/glue/webclipboard_impl.h" -#include "webkit/glue/webfilesystem_impl.h" #include "webkit/glue/webkitclient_impl.h" -#if defined(OS_WIN) -#include "third_party/WebKit/WebKit/chromium/public/win/WebSandboxSupport.h" -#elif defined(OS_LINUX) -#include <string> -#include <map> -#include "base/lock.h" -#include "third_party/WebKit/WebKit/chromium/public/linux/WebSandboxSupport.h" -#elif defined(OS_MACOSX) -#include "third_party/WebKit/WebKit/chromium/public/mac/WebSandboxSupport.h" -#endif +class WebSharedWorkerRepositoryImpl; namespace IPC { class SyncMessage; } +namespace webkit_glue { +class WebClipboardImpl; +} + class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl { public: RendererWebKitClientImpl(); @@ -76,63 +67,21 @@ class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl { virtual WebKit::WebGLES2Context* createGLES2Context(); private: - class MimeRegistry : public webkit_glue::SimpleWebMimeRegistryImpl { - public: - virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&); - virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); - virtual WebKit::WebString preferredExtensionForMIMEType( - const WebKit::WebString&); - }; - - class FileSystem : public webkit_glue::WebFileSystemImpl { - public: - virtual bool getFileSize(const WebKit::WebString& path, long long& result); - virtual bool getFileModificationTime(const WebKit::WebString& path, - double& result); - virtual base::PlatformFile openFile(const WebKit::WebString& path, - int mode); - }; - bool CheckPreparsedJsCachingEnabled() const; -#if defined(OS_WIN) - class SandboxSupport : public WebKit::WebSandboxSupport { - public: - virtual bool ensureFontLoaded(HFONT); - }; -#elif defined(OS_LINUX) - class SandboxSupport : public WebKit::WebSandboxSupport { - public: - virtual WebKit::WebString getFontFamilyForCharacters( - const WebKit::WebUChar* characters, size_t numCharacters); - virtual void getRenderStyleForStrike( - const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out); - - private: - // WebKit likes to ask us for the correct font family to use for a set of - // unicode code points. It needs this information frequently so we cache it - // here. The key in this map is an array of 16-bit UTF16 values from WebKit. - // The value is a string containing the correct font family. - Lock unicode_font_families_mutex_; - std::map<std::string, std::string> unicode_font_families_; - }; -#elif defined(OS_MACOSX) - class SandboxSupport : public WebKit::WebSandboxSupport { - public: - virtual bool loadFont(NSFont* srcFont, ATSFontContainerRef* out); - }; -#endif - // Helper function to send synchronous message from any thread. static bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg); - webkit_glue::WebClipboardImpl clipboard_; + scoped_ptr<webkit_glue::WebClipboardImpl> clipboard_; - FileSystem file_system_; + class FileSystem; + scoped_ptr<FileSystem> file_system_; - MimeRegistry mime_registry_; + class MimeRegistry; + scoped_ptr<MimeRegistry> mime_registry_; - SandboxSupport sandbox_support_; + class SandboxSupport; + scoped_ptr<SandboxSupport> sandbox_support_; // This counter keeps track of the number of times sudden termination is // enabled or disabled. It starts at 0 (enabled) and for every disable @@ -142,7 +91,7 @@ class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl { // Implementation of the WebSharedWorkerRepository APIs (provides an interface // to WorkerService on the browser thread. - WebSharedWorkerRepositoryImpl shared_worker_repository_; + scoped_ptr<WebSharedWorkerRepositoryImpl> shared_worker_repository_; scoped_ptr<WebKit::WebIndexedDatabase> web_indexed_database_; }; diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 58f1a23..9916ca0 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -13,6 +13,7 @@ #include <unistd.h> #endif +#include "base/file_path.h" #include "base/file_util.h" #include "base/keyboard_codes.h" #if defined(OS_MACOSX) @@ -28,11 +29,13 @@ #include "base/scoped_ptr.h" #include "base/stats_counters.h" #include "base/string_util.h" +#include "base/task.h" #include "base/time.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/render_messages.h" #include "chrome/renderer/pepper_widget.h" #include "chrome/renderer/render_thread.h" +#include "chrome/renderer/render_view.h" #if defined(OS_LINUX) #include "chrome/renderer/renderer_sandbox_support_linux.h" #endif @@ -55,6 +58,7 @@ #include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/plugins/plugin_host.h" #include "webkit/glue/plugins/plugin_stream_url.h" +#include "webkit/glue/webcursor.h" #include "webkit/glue/webkit_glue.h" #if defined(ENABLE_GPU) diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h index 0d4c877..a0103a0 100644 --- a/chrome/renderer/webplugin_delegate_pepper.h +++ b/chrome/renderer/webplugin_delegate_pepper.h @@ -12,20 +12,21 @@ #include <string> #include <vector> -#include "base/file_path.h" #include "base/id_map.h" #include "base/ref_counted.h" -#include "base/task.h" #include "base/weak_ptr.h" #include "chrome/renderer/pepper_devices.h" -#include "chrome/renderer/render_view.h" #include "chrome/renderer/command_buffer_proxy.h" #include "gfx/native_widget_types.h" #include "gfx/rect.h" #include "third_party/npapi/bindings/npapi.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h" #include "webkit/glue/plugins/webplugin_delegate.h" -#include "webkit/glue/webcursor.h" + +class FilePath; +class RenderView; +class WebCursor; +class WebPluginDelegateProxy; namespace NPAPI { class PluginInstance; diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 8847957..fb893ab 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -27,6 +27,7 @@ #include "chrome/plugin/npobject_stub.h" #include "chrome/plugin/npobject_util.h" #include "chrome/renderer/command_buffer_proxy.h" +#include "chrome/renderer/plugin_channel_host.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view.h" #include "gfx/blit.h" @@ -37,6 +38,7 @@ #include "grit/renderer_resources.h" #include "net/base/mime_util.h" #include "printing/native_metafile.h" +#include "skia/ext/platform_canvas.h" #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h index 2e2050d..1660556 100644 --- a/chrome/renderer/webplugin_delegate_proxy.h +++ b/chrome/renderer/webplugin_delegate_proxy.h @@ -10,17 +10,14 @@ #include <vector> #include "app/surface/transport_dib.h" -#include "base/file_path.h" #include "base/ref_counted.h" +#include "base/scoped_ptr.h" #include "base/weak_ptr.h" -#include "chrome/renderer/plugin_channel_host.h" #include "gfx/native_widget_types.h" #include "gfx/rect.h" #include "googleurl/src/gurl.h" -#include "gpu/command_buffer/common/command_buffer.h" +#include "ipc/ipc_channel.h" #include "ipc/ipc_message.h" -#include "skia/ext/platform_canvas.h" -#include "webkit/glue/plugins/webplugin.h" #include "webkit/glue/plugins/webplugininfo.h" #include "webkit/glue/plugins/webplugin_delegate.h" @@ -33,6 +30,7 @@ class CommandBufferProxy; struct NPObject; class NPObjectStub; struct NPVariant_Param; +class PluginChannelHost; struct PluginHostMsg_URLRequest_Params; class RenderView; class SkBitmap; @@ -42,6 +40,14 @@ class SharedMemory; class WaitableEvent; } +namespace skia { +class PlatformCanvas; +} + +namespace webkit_glue { +class WebPlugin; +} + // An implementation of WebPluginDelegate that proxies all calls to // the plugin process. class WebPluginDelegateProxy |