diff options
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/content_client.cc | 48 | ||||
-rw-r--r-- | content/common/content_client.h | 119 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel.cc | 2 | ||||
-rw-r--r-- | content/common/npobject_stub.cc | 2 | ||||
-rw-r--r-- | content/common/pepper_plugin_registry.cc | 2 | ||||
-rw-r--r-- | content/common/sandbox_policy.cc | 2 | ||||
-rw-r--r-- | content/common/swapped_out_messages.cc | 2 |
7 files changed, 5 insertions, 172 deletions
diff --git a/content/common/content_client.cc b/content/common/content_client.cc deleted file mode 100644 index ed46636..0000000 --- a/content/common/content_client.cc +++ /dev/null @@ -1,48 +0,0 @@ -// 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/common/content_client.h" - -#include "base/logging.h" -#include "base/string_piece.h" -#include "webkit/glue/webkit_glue.h" - -namespace content { - -static ContentClient* g_client; - -void SetContentClient(ContentClient* client) { - g_client = client; - - // TODO(dpranke): Doing real work (calling webkit_glue::SetUserAgent) - // inside what looks like a function that initializes a global is a - // bit odd, but we need to make sure this is done before - // webkit_glue::GetUserAgent() is called (so that the UA doesn't change). - // - // It would be cleaner if we could rename this to something like a - // content::Initialize(). Maybe we can merge this into ContentMain() somehow? - if (client) { - bool custom = false; - std::string ua = client->GetUserAgent(&custom); - webkit_glue::SetUserAgent(ua, custom); - } -} - -ContentClient* GetContentClient() { - return g_client; -} - -const std::string& GetUserAgent(const GURL& url) { - DCHECK(g_client); - return webkit_glue::GetUserAgent(url); -} - -ContentClient::ContentClient() - : browser_(NULL), plugin_(NULL), renderer_(NULL), utility_(NULL) { -} - -ContentClient::~ContentClient() { -} - -} // namespace content diff --git a/content/common/content_client.h b/content/common/content_client.h deleted file mode 100644 index 154646b..0000000 --- a/content/common/content_client.h +++ /dev/null @@ -1,119 +0,0 @@ -// 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_COMMON_CONTENT_CLIENT_H_ -#define CONTENT_COMMON_CONTENT_CLIENT_H_ -#pragma once - -#include <string> -#include <vector> - -#include "base/basictypes.h" -#include "base/string16.h" -#include "build/build_config.h" -#include "content/common/content_export.h" - -class CommandLine; -class GURL; -struct GPUInfo; -struct PepperPluginInfo; - -namespace IPC { -class Message; -} - -namespace base { -class StringPiece; -} - -namespace sandbox { -class TargetPolicy; -} - -namespace content { - -class ContentBrowserClient; -class ContentClient; -class ContentPluginClient; -class ContentRendererClient; -class ContentUtilityClient; - -// Setter and getter for the client. The client should be set early, before any -// content code is called. -CONTENT_EXPORT void SetContentClient(ContentClient* client); -CONTENT_EXPORT ContentClient* GetContentClient(); - -// Returns the user agent string being used by the browser. SetContentClient() -// must be called prior to calling this, and this routine must be used -// instead of webkit_glue::GetUserAgent() in order to ensure that we use -// the same user agent string everywhere. -// TODO(dpranke): This is caused by webkit_glue being a library that can -// get linked into multiple linkable objects, causing us to have multiple -// static values of the user agent. This will be fixed when we clean up -// webkit_glue. -CONTENT_EXPORT const std::string& GetUserAgent(const GURL& url); - -// Interface that the embedder implements. -class CONTENT_EXPORT ContentClient { - public: - ContentClient(); - virtual ~ContentClient(); - - ContentBrowserClient* browser() { return browser_; } - void set_browser(ContentBrowserClient* c) { browser_ = c; } - ContentPluginClient* plugin() { return plugin_; } - void set_plugin(ContentPluginClient* p) { plugin_ = p; } - ContentRendererClient* renderer() { return renderer_; } - void set_renderer(ContentRendererClient* r) { renderer_ = r; } - ContentUtilityClient* utility() { return utility_; } - void set_utility(ContentUtilityClient* u) { utility_ = u; } - - // Sets the currently active URL. Use GURL() to clear the URL. - virtual void SetActiveURL(const GURL& url) = 0; - - // Sets the data on the current gpu. - virtual void SetGpuInfo(const GPUInfo& gpu_info) = 0; - - // Gives the embedder a chance to register its own pepper plugins. - virtual void AddPepperPlugins(std::vector<PepperPluginInfo>* plugins) = 0; - - // Returns whether the given message should be allowed to be sent from a - // swapped out renderer. - virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) = 0; - - // Returns whether the given message should be processed in the browser on - // behalf of a swapped out renderer. - virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) = 0; - - // Returns the user agent and a flag indicating whether the returned - // string should always be used (if false, callers may override the - // value as needed to work around various user agent sniffing bugs). - virtual std::string GetUserAgent(bool *overriding) const = 0; - - // Returns a string resource given its id. - virtual string16 GetLocalizedString(int message_id) const = 0; - - // Return the contents of a resource in a StringPiece given the resource id. - virtual base::StringPiece GetDataResource(int resource_id) const = 0; - -#if defined(OS_WIN) - // Allows the embedder to sandbox a plugin, and apply a custom policy. - virtual bool SandboxPlugin(CommandLine* command_line, - sandbox::TargetPolicy* policy) = 0; -#endif - - private: - // The embedder API for participating in browser logic. - ContentBrowserClient* browser_; - // The embedder API for participating in plugin logic. - ContentPluginClient* plugin_; - // The embedder API for participating in renderer logic. - ContentRendererClient* renderer_; - // The embedder API for participating in utility logic. - ContentUtilityClient* utility_; -}; - -} // namespace content - -#endif // CONTENT_COMMON_CONTENT_CLIENT_H_ diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc index 518a267..4f4fba2 100644 --- a/content/common/gpu/gpu_channel.cc +++ b/content/common/gpu/gpu_channel.cc @@ -13,10 +13,10 @@ #include "base/process_util.h" #include "base/string_util.h" #include "content/common/child_process.h" -#include "content/common/content_client.h" #include "content/common/gpu/gpu_channel_manager.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/gpu/transport_texture.h" +#include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" #include "ui/gfx/gl/gl_context.h" #include "ui/gfx/gl/gl_surface.h" diff --git a/content/common/npobject_stub.cc b/content/common/npobject_stub.cc index 4db6a28..7e283ce9 100644 --- a/content/common/npobject_stub.cc +++ b/content/common/npobject_stub.cc @@ -5,10 +5,10 @@ #include "content/common/npobject_stub.h" #include "base/command_line.h" -#include "content/common/content_client.h" #include "content/common/np_channel_base.h" #include "content/common/npobject_util.h" #include "content/common/plugin_messages.h" +#include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/npruntime.h" diff --git a/content/common/pepper_plugin_registry.cc b/content/common/pepper_plugin_registry.cc index fd706ea..12bb416 100644 --- a/content/common/pepper_plugin_registry.cc +++ b/content/common/pepper_plugin_registry.cc @@ -10,7 +10,7 @@ #include "base/string_split.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "content/common/content_client.h" +#include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" #include "webkit/plugins/npapi/plugin_list.h" diff --git a/content/common/sandbox_policy.cc b/content/common/sandbox_policy.cc index c919002..2057bcb 100644 --- a/content/common/sandbox_policy.cc +++ b/content/common/sandbox_policy.cc @@ -16,9 +16,9 @@ #include "base/stringprintf.h" #include "base/string_util.h" #include "base/win/windows_version.h" -#include "content/common/content_client.h" #include "content/common/child_process_info.h" #include "content/common/debug_flags.h" +#include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" #include "sandbox/src/sandbox.h" #include "ui/gfx/gl/gl_switches.h" diff --git a/content/common/swapped_out_messages.cc b/content/common/swapped_out_messages.cc index 097ccce..3189d19 100644 --- a/content/common/swapped_out_messages.cc +++ b/content/common/swapped_out_messages.cc @@ -4,8 +4,8 @@ #include "content/common/swapped_out_messages.h" -#include "content/common/content_client.h" #include "content/common/view_messages.h" +#include "content/public/common/content_client.h" namespace content { |