diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-30 17:17:13 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-30 17:17:13 +0000 |
commit | ad61963c488d2ac267ba1a98f75a2c8781bc5a13 (patch) | |
tree | 3f461af72e7633e14c2d96136341d1a47ba8dd1f | |
parent | a0011476ee7c46bfbab491386f4d987e9ecb05be (diff) | |
download | chromium_src-ad61963c488d2ac267ba1a98f75a2c8781bc5a13.zip chromium_src-ad61963c488d2ac267ba1a98f75a2c8781bc5a13.tar.gz chromium_src-ad61963c488d2ac267ba1a98f75a2c8781bc5a13.tar.bz2 |
Get rid of ContentBrowserClient::GetClipboard as part of simplifying the work that each embedder has to do.
Also remove some code in the views WebView example that isn't needed.
BUG=98716
Review URL: https://chromiumcodereview.appspot.com/10442078
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139558 0039d316-1c4b-4281-b951-d872f2087c98
17 files changed, 11 insertions, 97 deletions
diff --git a/ash/shell/content_client/shell_content_browser_client.cc b/ash/shell/content_client/shell_content_browser_client.cc index 8d0be40..914e272 100644 --- a/ash/shell/content_client/shell_content_browser_client.cc +++ b/ash/shell/content_client/shell_content_browser_client.cc @@ -44,10 +44,6 @@ void ShellContentBrowserClient::ResourceDispatcherHostCreated() { resource_dispatcher_host_delegate_.get()); } -ui::Clipboard* ShellContentBrowserClient::GetClipboard() { - return shell_browser_main_parts_->GetClipboard(); -} - content::ShellBrowserContext* ShellContentBrowserClient::browser_context() { return shell_browser_main_parts_->browser_context(); } diff --git a/ash/shell/content_client/shell_content_browser_client.h b/ash/shell/content_client/shell_content_browser_client.h index bc4c85a..7f7967c 100644 --- a/ash/shell/content_client/shell_content_browser_client.h +++ b/ash/shell/content_client/shell_content_browser_client.h @@ -34,7 +34,6 @@ class ShellContentBrowserClient : public content::ContentBrowserClient { virtual void RenderViewHostCreated( content::RenderViewHost* render_view_host) OVERRIDE; virtual void ResourceDispatcherHostCreated() OVERRIDE; - virtual ui::Clipboard* GetClipboard() OVERRIDE; content::ShellBrowserContext* browser_context(); diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index bf19ef4..3552195 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -1308,10 +1308,6 @@ content::SpeechRecognitionManagerDelegate* #endif } -ui::Clipboard* ChromeContentBrowserClient::GetClipboard() { - return g_browser_process->clipboard(); -} - net::NetLog* ChromeContentBrowserClient::GetNetLog() { return g_browser_process->net_log(); } diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 247a7c2..ab87162 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -162,7 +162,6 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { virtual void ResourceDispatcherHostCreated() OVERRIDE; virtual content::SpeechRecognitionManagerDelegate* GetSpeechRecognitionManagerDelegate() OVERRIDE; - virtual ui::Clipboard* GetClipboard() OVERRIDE; virtual net::NetLog* GetNetLog() OVERRIDE; virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE; virtual bool IsFastShutdownPossible() OVERRIDE; diff --git a/content/browser/mock_content_browser_client.cc b/content/browser/mock_content_browser_client.cc index 4c48a6a..e0230ba 100644 --- a/content/browser/mock_content_browser_client.cc +++ b/content/browser/mock_content_browser_client.cc @@ -29,11 +29,6 @@ WebContentsView* MockContentBrowserClient::OverrideCreateWebContentsView( return rv; } -ui::Clipboard* MockContentBrowserClient::GetClipboard() { - static ui::Clipboard clipboard; - return &clipboard; -} - FilePath MockContentBrowserClient::GetDefaultDownloadDirectory() { if (!download_dir_.IsValid()) { bool result = download_dir_.CreateUniqueTempDir(); diff --git a/content/browser/mock_content_browser_client.h b/content/browser/mock_content_browser_client.h index 4a7157b..b497a87 100644 --- a/content/browser/mock_content_browser_client.h +++ b/content/browser/mock_content_browser_client.h @@ -24,7 +24,6 @@ class MockContentBrowserClient : public ContentBrowserClient { virtual WebContentsView* OverrideCreateWebContentsView( WebContents* web_contents, RenderViewHostDelegateView** render_view_host_delegate_view) OVERRIDE; - virtual ui::Clipboard* GetClipboard() OVERRIDE; virtual FilePath GetDefaultDownloadDirectory() OVERRIDE; private: diff --git a/content/browser/renderer_host/clipboard_message_filter.cc b/content/browser/renderer_host/clipboard_message_filter.cc index 25b2fd7..1de011e 100644 --- a/content/browser/renderer_host/clipboard_message_filter.cc +++ b/content/browser/renderer_host/clipboard_message_filter.cc @@ -14,7 +14,6 @@ #include "base/bind_helpers.h" #include "base/stl_util.h" #include "content/common/clipboard_messages.h" -#include "content/public/browser/content_browser_client.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_macros.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -23,17 +22,23 @@ using content::BrowserThread; +#if defined(OS_WIN) + namespace { -// This helper is needed because content::ContentBrowserClient::GetClipboard() -// must be called on the UI thread. +// The write must be performed on the UI thread because the clipboard object +// from the IO thread cannot create windows so it cannot be the "owner" of the +// clipboard's contents. // See http://crbug.com/5823. void WriteObjectsHelper(const ui::Clipboard::ObjectMap* objects) { - content::GetContentClient()->browser()->GetClipboard()->WriteObjects( - ui::Clipboard::BUFFER_STANDARD, *objects); + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + static ui::Clipboard* clipboard = new ui::Clipboard; + clipboard->WriteObjects(ui::Clipboard::BUFFER_STANDARD, *objects); } } // namespace +#endif + ClipboardMessageFilter::ClipboardMessageFilter() { } diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index a70e618..b5abf12c 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -178,10 +178,6 @@ SpeechRecognitionManagerDelegate* return NULL; } -ui::Clipboard* ContentBrowserClient::GetClipboard() { - return NULL; -} - net::NetLog* ContentBrowserClient::GetNetLog() { return NULL; } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 0d62260..fcf53c7 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -43,10 +43,6 @@ class URLRequestContext; class X509Certificate; } -namespace ui { -class Clipboard; -} - namespace content { class AccessTokenStore; @@ -358,7 +354,6 @@ class CONTENT_EXPORT ContentBrowserClient { GetSpeechRecognitionManagerDelegate(); // Getters for common objects. - virtual ui::Clipboard* GetClipboard(); virtual net::NetLog* GetNetLog(); // Creates a new AccessTokenStore for gelocation. diff --git a/content/shell/shell_browser_main_parts.cc b/content/shell/shell_browser_main_parts.cc index c7d0b4b..d2b020b 100644 --- a/content/shell/shell_browser_main_parts.cc +++ b/content/shell/shell_browser_main_parts.cc @@ -17,7 +17,6 @@ #include "content/shell/shell_switches.h" #include "googleurl/src/gurl.h" #include "net/base/net_module.h" -#include "ui/base/clipboard/clipboard.h" #if defined(OS_ANDROID) #include "base/message_pump_android.h" @@ -107,10 +106,4 @@ bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { return false; } -ui::Clipboard* ShellBrowserMainParts::GetClipboard() { - if (!clipboard_.get()) - clipboard_.reset(new ui::Clipboard()); - return clipboard_.get(); -} - } // namespace diff --git a/content/shell/shell_browser_main_parts.h b/content/shell/shell_browser_main_parts.h index 4bf9e97..24cae7c 100644 --- a/content/shell/shell_browser_main_parts.h +++ b/content/shell/shell_browser_main_parts.h @@ -14,10 +14,6 @@ namespace base { class Thread; } -namespace ui { -class Clipboard; -} - namespace content { class ShellBrowserContext; @@ -41,7 +37,6 @@ class ShellBrowserMainParts : public BrowserMainParts { virtual void PostMainMessageLoopRun() OVERRIDE; virtual void PostDestroyThreads() OVERRIDE {} - ui::Clipboard* GetClipboard(); ShellDevToolsDelegate* devtools_delegate() { return devtools_delegate_; } ShellBrowserContext* browser_context() { return browser_context_.get(); } @@ -49,7 +44,6 @@ class ShellBrowserMainParts : public BrowserMainParts { private: scoped_ptr<ShellBrowserContext> browser_context_; - scoped_ptr<ui::Clipboard> clipboard_; ShellDevToolsDelegate* devtools_delegate_; DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc index ae2e3ea..530fa4a 100644 --- a/content/shell/shell_content_browser_client.cc +++ b/content/shell/shell_content_browser_client.cc @@ -49,11 +49,6 @@ void ShellContentBrowserClient::ResourceDispatcherHostCreated() { resource_dispatcher_host_delegate_.get()); } -ui::Clipboard* ShellContentBrowserClient::GetClipboard() { - return shell_browser_main_parts_->GetClipboard(); -} - - std::string ShellContentBrowserClient::GetDefaultDownloadName() { return "download"; } diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h index 0025f0d..01ef569 100644 --- a/content/shell/shell_content_browser_client.h +++ b/content/shell/shell_content_browser_client.h @@ -31,7 +31,6 @@ class ShellContentBrowserClient : public ContentBrowserClient { virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, int child_process_id) OVERRIDE; virtual void ResourceDispatcherHostCreated() OVERRIDE; - virtual ui::Clipboard* GetClipboard() OVERRIDE; virtual std::string GetDefaultDownloadName() OVERRIDE; ShellBrowserContext* browser_context(); diff --git a/ui/views/examples/content_client/examples_browser_main_parts.cc b/ui/views/examples/content_client/examples_browser_main_parts.cc index f350868..b328557 100644 --- a/ui/views/examples/content_client/examples_browser_main_parts.cc +++ b/ui/views/examples/content_client/examples_browser_main_parts.cc @@ -13,11 +13,9 @@ #include "content/public/common/content_switches.h" #include "content/shell/shell.h" #include "content/shell/shell_browser_context.h" -#include "content/shell/shell_devtools_delegate.h" #include "content/shell/shell_switches.h" #include "googleurl/src/gurl.h" #include "net/base/net_module.h" -#include "ui/base/clipboard/clipboard.h" #include "ui/views/examples/examples_window.h" #include "ui/views/focus/accelerator_handler.h" #include "ui/views/test/test_views_delegate.h" @@ -49,8 +47,7 @@ class ExamplesViewsDelegate : public views::TestViewsDelegate { ExamplesBrowserMainParts::ExamplesBrowserMainParts( const content::MainFunctionParams& parameters) - : BrowserMainParts(), - devtools_delegate_(NULL) { + : BrowserMainParts() { } ExamplesBrowserMainParts::~ExamplesBrowserMainParts() { @@ -80,8 +77,6 @@ void ExamplesBrowserMainParts::PreMainMessageLoopRun() { } void ExamplesBrowserMainParts::PostMainMessageLoopRun() { - if (devtools_delegate_) - devtools_delegate_->Stop(); browser_context_.reset(); views_delegate_.reset(); #if defined(USE_AURA) @@ -101,11 +96,5 @@ bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) { return true; } -ui::Clipboard* ExamplesBrowserMainParts::GetClipboard() { - if (!clipboard_.get()) - clipboard_.reset(new ui::Clipboard()); - return clipboard_.get(); -} - } // namespace examples } // namespace views diff --git a/ui/views/examples/content_client/examples_browser_main_parts.h b/ui/views/examples/content_client/examples_browser_main_parts.h index ea4e959..e1cab6e 100644 --- a/ui/views/examples/content_client/examples_browser_main_parts.h +++ b/ui/views/examples/content_client/examples_browser_main_parts.h @@ -16,18 +16,9 @@ class StackingClient; } } -namespace base { -class Thread; -} - -namespace ui { -class Clipboard; -} - namespace content { class ShellBrowserContext; -class ShellDevToolsDelegate; struct MainFunctionParams; } @@ -53,11 +44,6 @@ class ExamplesBrowserMainParts : public content::BrowserMainParts { virtual void PostMainMessageLoopRun() OVERRIDE; virtual void PostDestroyThreads() OVERRIDE {} - ui::Clipboard* GetClipboard(); - content::ShellDevToolsDelegate* devtools_delegate() { - return devtools_delegate_; - } - content::ShellBrowserContext* browser_context() { return browser_context_.get(); } @@ -65,8 +51,6 @@ class ExamplesBrowserMainParts : public content::BrowserMainParts { private: scoped_ptr<content::ShellBrowserContext> browser_context_; - scoped_ptr<ui::Clipboard> clipboard_; - content::ShellDevToolsDelegate* devtools_delegate_; scoped_ptr<views::ViewsDelegate> views_delegate_; #if defined(USE_AURA) scoped_ptr<aura::client::StackingClient> stacking_client_; diff --git a/ui/views/examples/content_client/examples_content_browser_client.cc b/ui/views/examples/content_client/examples_content_browser_client.cc index 48640d6..fac0d07 100644 --- a/ui/views/examples/content_client/examples_content_browser_client.cc +++ b/ui/views/examples/content_client/examples_content_browser_client.cc @@ -32,22 +32,6 @@ content::BrowserMainParts* ExamplesContentBrowserClient::CreateBrowserMainParts( return examples_browser_main_parts_; } -void ExamplesContentBrowserClient::RenderViewHostCreated( - content::RenderViewHost* render_view_host) { - new content::ShellRenderViewHostObserver(render_view_host); -} - -void ExamplesContentBrowserClient::ResourceDispatcherHostCreated() { - resource_dispatcher_host_delegate_.reset( - new content::ShellResourceDispatcherHostDelegate); - content::ResourceDispatcherHost::Get()->SetDelegate( - resource_dispatcher_host_delegate_.get()); -} - -ui::Clipboard* ExamplesContentBrowserClient::GetClipboard() { - return examples_browser_main_parts_->GetClipboard(); -} - content::ShellBrowserContext* ExamplesContentBrowserClient::browser_context() { return examples_browser_main_parts_->browser_context(); } diff --git a/ui/views/examples/content_client/examples_content_browser_client.h b/ui/views/examples/content_client/examples_content_browser_client.h index 9a12856..c0a771e 100644 --- a/ui/views/examples/content_client/examples_content_browser_client.h +++ b/ui/views/examples/content_client/examples_content_browser_client.h @@ -31,10 +31,6 @@ class ExamplesContentBrowserClient : public content::ContentBrowserClient { // Overridden from content::ContentBrowserClient: virtual content::BrowserMainParts* CreateBrowserMainParts( const content::MainFunctionParams& parameters) OVERRIDE; - virtual void RenderViewHostCreated( - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void ResourceDispatcherHostCreated() OVERRIDE; - virtual ui::Clipboard* GetClipboard() OVERRIDE; content::ShellBrowserContext* browser_context(); |