diff options
Diffstat (limited to 'content/shell')
-rw-r--r-- | content/shell/DEPS | 3 | ||||
-rw-r--r-- | content/shell/shell_browser_main.cc | 6 | ||||
-rw-r--r-- | content/shell/shell_browser_main.h | 9 | ||||
-rw-r--r-- | content/shell/shell_content_browser_client.cc | 284 | ||||
-rw-r--r-- | content/shell/shell_content_browser_client.h | 143 | ||||
-rw-r--r-- | content/shell/shell_content_client.cc | 51 | ||||
-rw-r--r-- | content/shell/shell_content_client.h | 36 | ||||
-rw-r--r-- | content/shell/shell_content_plugin_client.cc | 16 | ||||
-rw-r--r-- | content/shell/shell_content_plugin_client.h | 22 | ||||
-rw-r--r-- | content/shell/shell_content_renderer_client.cc | 122 | ||||
-rw-r--r-- | content/shell/shell_content_renderer_client.h | 67 | ||||
-rw-r--r-- | content/shell/shell_content_utility_client.cc | 19 | ||||
-rw-r--r-- | content/shell/shell_content_utility_client.h | 23 | ||||
-rw-r--r-- | content/shell/shell_main.cc | 93 |
14 files changed, 894 insertions, 0 deletions
diff --git a/content/shell/DEPS b/content/shell/DEPS new file mode 100644 index 0000000..60dbcf4 --- /dev/null +++ b/content/shell/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+content", +] diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc new file mode 100644 index 0000000..a6a06c7 --- /dev/null +++ b/content/shell/shell_browser_main.cc @@ -0,0 +1,6 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/shell_browser_main.h" + diff --git a/content/shell/shell_browser_main.h b/content/shell/shell_browser_main.h new file mode 100644 index 0000000..baa67fd --- /dev/null +++ b/content/shell/shell_browser_main.h @@ -0,0 +1,9 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_SHELL_BROWSER_MAIN_H_ +#define CONTENT_SHELL_SHELL_BROWSER_MAIN_H_ +#pragma once + +#endif // CONTENT_SHELL_SHELL_BROWSER_MAIN_H_ diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc new file mode 100644 index 0000000..15ce376 --- /dev/null +++ b/content/shell/shell_content_browser_client.cc @@ -0,0 +1,284 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/shell_content_browser_client.h" + +#include "base/file_path.h" +#include "content/browser/webui/empty_web_ui_factory.h" +#include "googleurl/src/gurl.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/base/clipboard/clipboard.h" +#include "webkit/glue/webpreferences.h" + +namespace content { + +ShellContentBrowserClient::~ShellContentBrowserClient() { +} + +BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( + const MainFunctionParams& parameters) { + return NULL; +} + +TabContentsView* ShellContentBrowserClient::CreateTabContentsView( + TabContents* tab_contents) { + return NULL; +} + +void ShellContentBrowserClient::RenderViewHostCreated( + RenderViewHost* render_view_host) { +} + +void ShellContentBrowserClient::BrowserRenderProcessHostCreated( + BrowserRenderProcessHost* host) { +} + +void ShellContentBrowserClient::PluginProcessHostCreated( + PluginProcessHost* host) { +} + +void ShellContentBrowserClient::WorkerProcessHostCreated( + WorkerProcessHost* host) { +} + +WebUIFactory* ShellContentBrowserClient::GetWebUIFactory() { + // Return an empty factory so callsites don't have to check for NULL. + return EmptyWebUIFactory::Get(); +} + +GURL ShellContentBrowserClient::GetEffectiveURL( + content::BrowserContext* browser_context, const GURL& url) { + return GURL(); +} + +bool ShellContentBrowserClient::ShouldUseProcessPerSite( + BrowserContext* browser_context, const GURL& effective_url) { + return false; +} + +bool ShellContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) { + return false; +} + +std::string ShellContentBrowserClient::GetCanonicalEncodingNameByAliasName( + const std::string& alias_name) { + return std::string(); +} + +void ShellContentBrowserClient::AppendExtraCommandLineSwitches( + CommandLine* command_line, int child_process_id) { +} + +std::string ShellContentBrowserClient::GetApplicationLocale() { + return std::string(); +} + +std::string ShellContentBrowserClient::GetAcceptLangs(const TabContents* tab) { + return std::string(); +} + +SkBitmap* ShellContentBrowserClient::GetDefaultFavicon() { + static SkBitmap empty; + return ∅ +} + +bool ShellContentBrowserClient::AllowAppCache( + const GURL& manifest_url, + const GURL& first_party, + const content::ResourceContext& context) { + return true; +} + +bool ShellContentBrowserClient::AllowGetCookie( + const GURL& url, + const GURL& first_party, + const net::CookieList& cookie_list, + const content::ResourceContext& context, + int render_process_id, + int render_view_id) { + return true; +} + +bool ShellContentBrowserClient::AllowSetCookie( + const GURL& url, + const GURL& first_party, + const std::string& cookie_line, + const content::ResourceContext& context, + int render_process_id, + int render_view_id, + net::CookieOptions* options) { + return true; +} + +bool ShellContentBrowserClient::AllowSaveLocalState( + const content::ResourceContext& context) { + return true; +} + +QuotaPermissionContext* + ShellContentBrowserClient::CreateQuotaPermissionContext() { + return NULL; +} + +net::URLRequestContext* ShellContentBrowserClient::OverrideRequestContextForURL( + const GURL& url, const content::ResourceContext& context) { + return NULL; +} + +void ShellContentBrowserClient::OpenItem(const FilePath& path) { +} + +void ShellContentBrowserClient::ShowItemInFolder(const FilePath& path) { +} + +void ShellContentBrowserClient::AllowCertificateError( + SSLCertErrorHandler* handler, + bool overridable, + Callback2<SSLCertErrorHandler*, bool>::Type* callback) { +} + +void ShellContentBrowserClient::SelectClientCertificate( + int render_process_id, + int render_view_id, + SSLClientAuthHandler* handler) { +} + +void ShellContentBrowserClient::AddNewCertificate( + net::URLRequest* request, + net::X509Certificate* cert, + int render_process_id, + int render_view_id) { +} + +void ShellContentBrowserClient::RequestDesktopNotificationPermission( + const GURL& source_origin, + int callback_context, + int render_process_id, + int render_view_id) { +} + +WebKit::WebNotificationPresenter::Permission + ShellContentBrowserClient::CheckDesktopNotificationPermission( + const GURL& source_url, + const content::ResourceContext& context) { + return WebKit::WebNotificationPresenter::PermissionAllowed; +} + +void ShellContentBrowserClient::ShowDesktopNotification( + const DesktopNotificationHostMsg_Show_Params& params, + int render_process_id, + int render_view_id, + bool worker) { +} + +void ShellContentBrowserClient::CancelDesktopNotification( + int render_process_id, + int render_view_id, + int notification_id) { +} + +bool ShellContentBrowserClient::CanCreateWindow( + const GURL& source_url, + WindowContainerType container_type, + const content::ResourceContext& context) { + return false; +} + +std::string ShellContentBrowserClient::GetWorkerProcessTitle( + const GURL& url, const content::ResourceContext& context) { + return std::string(); +} + +ResourceDispatcherHost* ShellContentBrowserClient::GetResourceDispatcherHost() { + return NULL; +} + +ui::Clipboard* ShellContentBrowserClient::GetClipboard() { + static ui::Clipboard clipboard; + return &clipboard; +} + +MHTMLGenerationManager* ShellContentBrowserClient::GetMHTMLGenerationManager() { + return NULL; +} + +DevToolsManager* ShellContentBrowserClient::GetDevToolsManager() { + return NULL; +} + +net::NetLog* ShellContentBrowserClient::GetNetLog() { + return NULL; +} + +speech_input::SpeechInputManager* + ShellContentBrowserClient::GetSpeechInputManager() { + return NULL; +} + +AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { + return NULL; +} + +bool ShellContentBrowserClient::IsFastShutdownPossible() { + return true; +} + +WebPreferences ShellContentBrowserClient::GetWebkitPrefs( + content::BrowserContext* browser_context, + bool is_web_ui) { + return WebPreferences(); +} + +void ShellContentBrowserClient::UpdateInspectorSetting( + RenderViewHost* rvh, const std::string& key, const std::string& value) { +} + +void ShellContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { +} + +void ShellContentBrowserClient::BrowserURLHandlerCreated( + BrowserURLHandler* handler) { +} + +void ShellContentBrowserClient::ClearCache(RenderViewHost* rvh) { +} + +void ShellContentBrowserClient::ClearCookies(RenderViewHost* rvh) { +} + +FilePath ShellContentBrowserClient::GetDefaultDownloadDirectory() { + return FilePath(); +} + +net::URLRequestContextGetter* +ShellContentBrowserClient::GetDefaultRequestContextDeprecatedCrBug64339() { + return NULL; +} + +net::URLRequestContextGetter* +ShellContentBrowserClient::GetSystemRequestContext() { + return NULL; +} + +#if defined(OS_POSIX) && !defined(OS_MACOSX) +int ShellContentBrowserClient::GetCrashSignalFD( + const std::string& process_type) { + return -1; +} +#endif + +#if defined(OS_WIN) +const wchar_t* ShellContentBrowserClient::GetResourceDllName() { + return NULL; +} +#endif + +#if defined(USE_NSS) +crypto::CryptoModuleBlockingPasswordDelegate* + ShellContentBrowserClient::GetCryptoPasswordDelegate(const GURL& url) { + return NULL; +} +#endif + +} // namespace content diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h new file mode 100644 index 0000000..a611197 --- /dev/null +++ b/content/shell/shell_content_browser_client.h @@ -0,0 +1,143 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_ +#define CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_ +#pragma once + +#include <string> + +#include "base/compiler_specific.h" +#include "content/browser/content_browser_client.h" + +namespace content { + +class ShellContentBrowserClient : public ContentBrowserClient { + public: + virtual ~ShellContentBrowserClient(); + + virtual BrowserMainParts* CreateBrowserMainParts( + const MainFunctionParams& parameters) OVERRIDE; + virtual TabContentsView* CreateTabContentsView( + TabContents* tab_contents) OVERRIDE; + virtual void RenderViewHostCreated( + RenderViewHost* render_view_host) OVERRIDE; + virtual void BrowserRenderProcessHostCreated( + BrowserRenderProcessHost* host) OVERRIDE; + virtual void PluginProcessHostCreated(PluginProcessHost* host) OVERRIDE; + virtual void WorkerProcessHostCreated(WorkerProcessHost* host) OVERRIDE; + virtual WebUIFactory* GetWebUIFactory() OVERRIDE; + virtual GURL GetEffectiveURL(content::BrowserContext* browser_context, + const GURL& url) OVERRIDE; + virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context, + const GURL& effective_url) OVERRIDE; + virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE; + virtual std::string GetCanonicalEncodingNameByAliasName( + const std::string& alias_name) OVERRIDE; + virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, + int child_process_id) OVERRIDE; + virtual std::string GetApplicationLocale() OVERRIDE; + virtual std::string GetAcceptLangs(const TabContents* tab) OVERRIDE; + virtual SkBitmap* GetDefaultFavicon() OVERRIDE; + virtual bool AllowAppCache(const GURL& manifest_url, + const GURL& first_party, + const content::ResourceContext& context) OVERRIDE; + virtual bool AllowGetCookie(const GURL& url, + const GURL& first_party, + const net::CookieList& cookie_list, + const content::ResourceContext& context, + int render_process_id, + int render_view_id) OVERRIDE; + virtual bool AllowSetCookie(const GURL& url, + const GURL& first_party, + const std::string& cookie_line, + const content::ResourceContext& context, + int render_process_id, + int render_view_id, + net::CookieOptions* options) OVERRIDE; + virtual bool AllowSaveLocalState( + const content::ResourceContext& context) OVERRIDE; + virtual net::URLRequestContext* OverrideRequestContextForURL( + const GURL& url, const content::ResourceContext& context) OVERRIDE; + virtual QuotaPermissionContext* CreateQuotaPermissionContext() OVERRIDE; + virtual void OpenItem(const FilePath& path) OVERRIDE; + virtual void ShowItemInFolder(const FilePath& path) OVERRIDE; + virtual void AllowCertificateError( + SSLCertErrorHandler* handler, + bool overridable, + Callback2<SSLCertErrorHandler*, bool>::Type* callback) OVERRIDE; + virtual void SelectClientCertificate( + int render_process_id, + int render_view_id, + SSLClientAuthHandler* handler) OVERRIDE; + virtual void AddNewCertificate( + net::URLRequest* request, + net::X509Certificate* cert, + int render_process_id, + int render_view_id) OVERRIDE; + virtual void RequestDesktopNotificationPermission( + const GURL& source_origin, + int callback_context, + int render_process_id, + int render_view_id) OVERRIDE; + virtual WebKit::WebNotificationPresenter::Permission + CheckDesktopNotificationPermission( + const GURL& source_url, + const content::ResourceContext& context) OVERRIDE; + virtual void ShowDesktopNotification( + const DesktopNotificationHostMsg_Show_Params& params, + int render_process_id, + int render_view_id, + bool worker) OVERRIDE; + virtual void CancelDesktopNotification( + int render_process_id, + int render_view_id, + int notification_id) OVERRIDE; + virtual bool CanCreateWindow( + const GURL& source_url, + WindowContainerType container_type, + const content::ResourceContext& context) OVERRIDE; + virtual std::string GetWorkerProcessTitle( + const GURL& url, const content::ResourceContext& context) OVERRIDE; + virtual ResourceDispatcherHost* GetResourceDispatcherHost() OVERRIDE; + virtual ui::Clipboard* GetClipboard() OVERRIDE; + virtual MHTMLGenerationManager* GetMHTMLGenerationManager() OVERRIDE; + virtual DevToolsManager* GetDevToolsManager() OVERRIDE; + virtual net::NetLog* GetNetLog() OVERRIDE; + virtual speech_input::SpeechInputManager* GetSpeechInputManager() OVERRIDE; + virtual AccessTokenStore* CreateAccessTokenStore() OVERRIDE; + virtual bool IsFastShutdownPossible() OVERRIDE; + virtual WebPreferences GetWebkitPrefs( + content::BrowserContext* browser_context, + bool is_web_ui) OVERRIDE; + virtual void UpdateInspectorSetting(RenderViewHost* rvh, + const std::string& key, + const std::string& value) OVERRIDE; + virtual void ClearInspectorSettings(RenderViewHost* rvh) OVERRIDE; + virtual void BrowserURLHandlerCreated(BrowserURLHandler* handler) OVERRIDE; + virtual void ClearCache(RenderViewHost* rvh) OVERRIDE; + virtual void ClearCookies(RenderViewHost* rvh) OVERRIDE; + virtual FilePath GetDefaultDownloadDirectory() OVERRIDE; + virtual net::URLRequestContextGetter* + GetDefaultRequestContextDeprecatedCrBug64339() OVERRIDE; + virtual net::URLRequestContextGetter* GetSystemRequestContext() OVERRIDE; + +#if defined(OS_POSIX) && !defined(OS_MACOSX) + virtual int GetCrashSignalFD(const std::string& process_type) OVERRIDE; +#endif + +#if defined(OS_WIN) + virtual const wchar_t* GetResourceDllName() OVERRIDE; +#endif + +#if defined(USE_NSS) + virtual + crypto::CryptoModuleBlockingPasswordDelegate* GetCryptoPasswordDelegate( + const GURL& url) OVERRIDE; +#endif +}; + +} // namespace content + +#endif // CONTENT_SHELL_SHELL_CONTENT_BROWSER_CLIENT_H_ diff --git a/content/shell/shell_content_client.cc b/content/shell/shell_content_client.cc new file mode 100644 index 0000000..12bb53d --- /dev/null +++ b/content/shell/shell_content_client.cc @@ -0,0 +1,51 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/shell_content_client.h" + +#include "base/string_piece.h" + +namespace content { + +ShellContentClient::~ShellContentClient() { +} + +void ShellContentClient::SetActiveURL(const GURL& url) { +} + +void ShellContentClient::SetGpuInfo(const GPUInfo& gpu_info) { +} + +void ShellContentClient::AddPepperPlugins( + std::vector<PepperPluginInfo>* plugins) { +} + +bool ShellContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) { + return false; +} + +bool ShellContentClient::CanHandleWhileSwappedOut(const IPC::Message& msg) { + return false; +} + +std::string ShellContentClient::GetUserAgent(bool mimic_windows) const { + return std::string(); +} + +string16 ShellContentClient::GetLocalizedString(int message_id) const { + return string16(); +} + +base::StringPiece ShellContentClient::GetDataResource(int resource_id) const { + return base::StringPiece(); +} + +#if defined(OS_WIN) +bool ShellContentClient::SandboxPlugin(CommandLine* command_line, + sandbox::TargetPolicy* policy) { + return false; +} +#endif + +} // namespace content diff --git a/content/shell/shell_content_client.h b/content/shell/shell_content_client.h new file mode 100644 index 0000000..35b2020 --- /dev/null +++ b/content/shell/shell_content_client.h @@ -0,0 +1,36 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_SHELL_CONTENT_CLIENT_H_ +#define CONTENT_SHELL_SHELL_CONTENT_CLIENT_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "content/common/content_client.h" + +namespace content { + +class ShellContentClient : public ContentClient { + public: + virtual ~ShellContentClient(); + + virtual void SetActiveURL(const GURL& url) OVERRIDE; + virtual void SetGpuInfo(const GPUInfo& gpu_info) OVERRIDE; + virtual void AddPepperPlugins( + std::vector<PepperPluginInfo>* plugins) OVERRIDE; + virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) OVERRIDE; + virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE; + virtual std::string GetUserAgent(bool mimic_windows) const OVERRIDE; + virtual string16 GetLocalizedString(int message_id) const OVERRIDE; + virtual base::StringPiece GetDataResource(int resource_id) const OVERRIDE; + +#if defined(OS_WIN) + virtual bool SandboxPlugin(CommandLine* command_line, + sandbox::TargetPolicy* policy) OVERRIDE; +#endif +}; + +} // namespace content + +#endif // CONTENT_SHELL_SHELL_CONTENT_CLIENT_H_ diff --git a/content/shell/shell_content_plugin_client.cc b/content/shell/shell_content_plugin_client.cc new file mode 100644 index 0000000..81a6bd9 --- /dev/null +++ b/content/shell/shell_content_plugin_client.cc @@ -0,0 +1,16 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/shell_content_plugin_client.h" + +namespace content { + +ShellContentPluginClient::~ShellContentPluginClient() { +} + +void ShellContentPluginClient::PluginProcessStarted( + const string16& plugin_name) { +} + +} // namespace content diff --git a/content/shell/shell_content_plugin_client.h b/content/shell/shell_content_plugin_client.h new file mode 100644 index 0000000..0fd0bdf --- /dev/null +++ b/content/shell/shell_content_plugin_client.h @@ -0,0 +1,22 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_SHELL_CONTENT_PLUGIN_CLIENT_H_ +#define CONTENT_SHELL_SHELL_CONTENT_PLUGIN_CLIENT_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "content/plugin/content_plugin_client.h" + +namespace content { + +class ShellContentPluginClient : public ContentPluginClient { + public: + virtual ~ShellContentPluginClient(); + virtual void PluginProcessStarted(const string16& plugin_name) OVERRIDE; +}; + +} // namespace content + +#endif // CONTENT_SHELL_SHELL_CONTENT_PLUGIN_CLIENT_H_ diff --git a/content/shell/shell_content_renderer_client.cc b/content/shell/shell_content_renderer_client.cc new file mode 100644 index 0000000..72b04b7 --- /dev/null +++ b/content/shell/shell_content_renderer_client.cc @@ -0,0 +1,122 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/shell_content_renderer_client.h" + +#include "v8/include/v8.h" + +namespace content { + +ShellContentRendererClient::~ShellContentRendererClient() { +} + +void ShellContentRendererClient::RenderThreadStarted() { +} + +void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { +} + +void ShellContentRendererClient::SetNumberOfViews(int number_of_views) { +} + +SkBitmap* ShellContentRendererClient::GetSadPluginBitmap() { + return NULL; +} + +std::string ShellContentRendererClient::GetDefaultEncoding() { + return std::string(); +} + +WebKit::WebPlugin* ShellContentRendererClient::CreatePlugin( + RenderView* render_view, + WebKit::WebFrame* frame, + const WebKit::WebPluginParams& params) { + return NULL; +} + +void ShellContentRendererClient::ShowErrorPage(RenderView* render_view, + WebKit::WebFrame* frame, + int http_status_code) { +} + +std::string ShellContentRendererClient::GetNavigationErrorHtml( + const WebKit::WebURLRequest& failed_request, + const WebKit::WebURLError& error) { + return std::string(); +} + +bool ShellContentRendererClient::RunIdleHandlerWhenWidgetsHidden() { + return true; +} + +bool ShellContentRendererClient::AllowPopup(const GURL& creator) { + return false; +} + +bool ShellContentRendererClient::ShouldFork(WebKit::WebFrame* frame, + const GURL& url, + bool is_content_initiated, + bool is_initial_navigation, + bool* send_referrer) { + return false; +} + +bool ShellContentRendererClient::WillSendRequest(WebKit::WebFrame* frame, + const GURL& url, + GURL* new_url) { + return false; +} + +bool ShellContentRendererClient::ShouldPumpEventsDuringCookieMessage() { + return false; +} + +void ShellContentRendererClient::DidCreateScriptContext( + WebKit::WebFrame* frame) { +} + +void ShellContentRendererClient::DidDestroyScriptContext( + WebKit::WebFrame* frame) { +} + +void ShellContentRendererClient::DidCreateIsolatedScriptContext( + WebKit::WebFrame* frame, int world_id, v8::Handle<v8::Context> context) { +} + +unsigned long long ShellContentRendererClient::VisitedLinkHash( + const char* canonical_url, size_t length) { + return 0LL; +} + +bool ShellContentRendererClient::IsLinkVisited(unsigned long long link_hash) { + return false; +} + +void ShellContentRendererClient::PrefetchHostName( + const char* hostname, size_t length) { +} + +bool ShellContentRendererClient::ShouldOverridePageVisibilityState( + const RenderView* render_view, + WebKit::WebPageVisibilityState* override_state) const { + return false; +} + +bool ShellContentRendererClient::HandleGetCookieRequest( + RenderView* sender, + const GURL& url, + const GURL& first_party_for_cookies, + std::string* cookies) { + return false; +} + +bool ShellContentRendererClient::HandleSetCookieRequest( + RenderView* sender, + const GURL& url, + const GURL& first_party_for_cookies, + const std::string& value) { + return false; +} + +} // namespace content diff --git a/content/shell/shell_content_renderer_client.h b/content/shell/shell_content_renderer_client.h new file mode 100644 index 0000000..a584521d --- /dev/null +++ b/content/shell/shell_content_renderer_client.h @@ -0,0 +1,67 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_SHELL_CONTENT_RENDERER_CLIENT_H_ +#define CONTENT_SHELL_SHELL_CONTENT_RENDERER_CLIENT_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "content/renderer/content_renderer_client.h" + +namespace content { + +class ShellContentRendererClient : public ContentRendererClient { + public: + virtual ~ShellContentRendererClient(); + virtual void RenderThreadStarted() OVERRIDE; + virtual void RenderViewCreated(RenderView* render_view) OVERRIDE; + virtual void SetNumberOfViews(int number_of_views) OVERRIDE; + virtual SkBitmap* GetSadPluginBitmap() OVERRIDE; + virtual std::string GetDefaultEncoding() OVERRIDE; + virtual WebKit::WebPlugin* CreatePlugin( + RenderView* render_view, + WebKit::WebFrame* frame, + const WebKit::WebPluginParams& params) OVERRIDE; + virtual void ShowErrorPage(RenderView* render_view, + WebKit::WebFrame* frame, + int http_status_code) OVERRIDE; + virtual std::string GetNavigationErrorHtml( + const WebKit::WebURLRequest& failed_request, + const WebKit::WebURLError& error) OVERRIDE; + virtual bool RunIdleHandlerWhenWidgetsHidden() OVERRIDE; + virtual bool AllowPopup(const GURL& creator) OVERRIDE; + virtual bool ShouldFork(WebKit::WebFrame* frame, + const GURL& url, + bool is_content_initiated, + bool is_initial_navigation, + bool* send_referrer) OVERRIDE; + virtual bool WillSendRequest(WebKit::WebFrame* frame, + const GURL& url, + GURL* new_url) OVERRIDE; + virtual bool ShouldPumpEventsDuringCookieMessage() OVERRIDE; + virtual void DidCreateScriptContext(WebKit::WebFrame* frame) OVERRIDE; + virtual void DidDestroyScriptContext(WebKit::WebFrame* frame) OVERRIDE; + virtual void DidCreateIsolatedScriptContext( + WebKit::WebFrame* frame, int world_id, + v8::Handle<v8::Context> context) OVERRIDE; + virtual unsigned long long VisitedLinkHash(const char* canonical_url, + size_t length) OVERRIDE; + virtual bool IsLinkVisited(unsigned long long link_hash) OVERRIDE; + virtual void PrefetchHostName(const char* hostname, size_t length) OVERRIDE; + virtual bool ShouldOverridePageVisibilityState( + const RenderView* render_view, + WebKit::WebPageVisibilityState* override_state) const OVERRIDE; + virtual bool HandleGetCookieRequest(RenderView* sender, + const GURL& url, + const GURL& first_party_for_cookies, + std::string* cookies) OVERRIDE; + virtual bool HandleSetCookieRequest(RenderView* sender, + const GURL& url, + const GURL& first_party_for_cookies, + const std::string& value) OVERRIDE; +}; + +} // namespace content + +#endif // CONTENT_SHELL_SHELL_CONTENT_RENDERER_CLIENT_H_ diff --git a/content/shell/shell_content_utility_client.cc b/content/shell/shell_content_utility_client.cc new file mode 100644 index 0000000..fb2a285 --- /dev/null +++ b/content/shell/shell_content_utility_client.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/shell_content_utility_client.h" + +namespace content { + +ShellContentUtilityClient::~ShellContentUtilityClient() { +} + +void ShellContentUtilityClient::UtilityThreadStarted() { +} + +bool ShellContentUtilityClient::OnMessageReceived(const IPC::Message& message) { + return false; +} + +} // namespace content diff --git a/content/shell/shell_content_utility_client.h b/content/shell/shell_content_utility_client.h new file mode 100644 index 0000000..287a79f --- /dev/null +++ b/content/shell/shell_content_utility_client.h @@ -0,0 +1,23 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_SHELL_CONTENT_UTILITY_CLIENT_H_ +#define CONTENT_SHELL_SHELL_CONTENT_UTILITY_CLIENT_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "content/utility/content_utility_client.h" + +namespace content { + + class ShellContentUtilityClient : public ContentUtilityClient { + public: + virtual ~ShellContentUtilityClient(); + virtual void UtilityThreadStarted() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; +}; + +} // namespace content + +#endif // CONTENT_SHELL_SHELL_CONTENT_UTILITY_CLIENT_H_ diff --git a/content/shell/shell_main.cc b/content/shell/shell_main.cc new file mode 100644 index 0000000..c5a9227 --- /dev/null +++ b/content/shell/shell_main.cc @@ -0,0 +1,93 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/app/content_main.h" + +#include "base/command_line.h" +#include "base/memory/scoped_ptr.h" +#include "content/app/content_main_delegate.h" +#include "content/common/content_switches.h" +#include "content/shell/shell_content_browser_client.h" +#include "content/shell/shell_content_client.h" +#include "content/shell/shell_content_plugin_client.h" +#include "content/shell/shell_content_renderer_client.h" +#include "content/shell/shell_content_utility_client.h" +#include "sandbox/src/sandbox_types.h" + +#if defined(OS_WIN) +#include "content/app/startup_helper_win.h" +#endif + +namespace { + +class ShellMainDelegate : public content::ContentMainDelegate { + public: + virtual void PreSandboxStartup() OVERRIDE { + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + std::string process_type = + command_line.GetSwitchValueASCII(switches::kProcessType); + + content::SetContentClient(&content_client_); + InitializeShellContentClient(process_type); + } + +#if defined(OS_POSIX) && !defined(OS_MACOSX) + virtual void ZygoteForked() OVERRIDE { + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + std::string process_type = + command_line.GetSwitchValueASCII(switches::kProcessType); + InitializeShellContentClient(process_type); + } +#endif + + private: + void InitializeShellContentClient(const std::string& process_type) { + if (process_type.empty()) { + browser_client_.reset(new content::ShellContentBrowserClient); + content::GetContentClient()->set_browser(browser_client_.get()); + } else if (process_type == switches::kRendererProcess) { + renderer_client_.reset(new content::ShellContentRendererClient); + content::GetContentClient()->set_renderer(renderer_client_.get()); + } else if (process_type == switches::kPluginProcess) { + plugin_client_.reset(new content::ShellContentPluginClient); + content::GetContentClient()->set_plugin(plugin_client_.get()); + } else if (process_type == switches::kUtilityProcess) { + utility_client_.reset(new content::ShellContentUtilityClient); + content::GetContentClient()->set_utility(utility_client_.get()); + } + } + + scoped_ptr<content::ShellContentBrowserClient> browser_client_; + scoped_ptr<content::ShellContentRendererClient> renderer_client_; + scoped_ptr<content::ShellContentPluginClient> plugin_client_; + scoped_ptr<content::ShellContentUtilityClient> utility_client_; + content::ShellContentClient content_client_; +}; + +} // namespace + +#if defined(OS_WIN) + +int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { + sandbox::SandboxInterfaceInfo sandbox_info = {0}; + content::InitializeSandboxInfo(&sandbox_info); + ShellMainDelegate delegate; + return content::ContentMain(instance, &sandbox_info, &delegate); +} +#endif + +#if defined(OS_POSIX) + +#if defined(OS_MACOSX) +__attribute__((visibility("default"))) +int main(int argc, const char* argv[]) { +#else +int main(int argc, const char** argv) { +#endif // OS_MACOSX + + ShellMainDelegate delegate; + return content::ContentMain(argc, argv, &delegate); +} + +#endif // OS_POSIX |