diff options
Diffstat (limited to 'chrome')
18 files changed, 21 insertions, 69 deletions
diff --git a/chrome/browser/bookmarks/bookmark_node_data.cc b/chrome/browser/bookmarks/bookmark_node_data.cc index c6a2615..bcd45d6 100644 --- a/chrome/browser/bookmarks/bookmark_node_data.cc +++ b/chrome/browser/bookmarks/bookmark_node_data.cc @@ -19,8 +19,6 @@ #if defined(OS_MACOSX) #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h" -#else -#include "chrome/browser/browser_process.h" #endif const char* BookmarkNodeData::kClipboardFormatString = @@ -141,7 +139,7 @@ bool BookmarkNodeData::ReadFromTuple(const GURL& url, const string16& title) { #if !defined(OS_MACOSX) void BookmarkNodeData::WriteToClipboard(Profile* profile) const { - ui::ScopedClipboardWriter scw(g_browser_process->clipboard(), + ui::ScopedClipboardWriter scw(ui::Clipboard::GetForCurrentThread(), ui::Clipboard::BUFFER_STANDARD); // If there is only one element and it is a URL, write the URL to the @@ -169,7 +167,7 @@ void BookmarkNodeData::WriteToClipboard(Profile* profile) const { bool BookmarkNodeData::ReadFromClipboard() { std::string data; - ui::Clipboard* clipboard = g_browser_process->clipboard(); + ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); clipboard->ReadData(ui::Clipboard::GetFormatType(kClipboardFormatString), &data); @@ -197,7 +195,7 @@ bool BookmarkNodeData::ReadFromClipboard() { } bool BookmarkNodeData::ClipboardContainsBookmarks() { - return g_browser_process->clipboard()->IsFormatAvailable( + return ui::Clipboard::GetForCurrentThread()->IsFormatAvailable( ui::Clipboard::GetFormatType(kClipboardFormatString), ui::Clipboard::BUFFER_STANDARD); } diff --git a/chrome/browser/bookmarks/bookmark_utils_unittest.cc b/chrome/browser/bookmarks/bookmark_utils_unittest.cc index 565f60f..9b4100b 100644 --- a/chrome/browser/bookmarks/bookmark_utils_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_utils_unittest.cc @@ -10,10 +10,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" -#if !defined(OS_MACOSX) -#include "chrome/browser/browser_process.h" -#endif - using std::string; namespace bookmark_utils { @@ -142,8 +138,9 @@ TEST(BookmarkUtilsTest, CopyPaste) { // Write some text to the clipboard. { - ui::ScopedClipboardWriter clipboard_writer(g_browser_process->clipboard(), - ui::Clipboard::BUFFER_STANDARD); + ui::ScopedClipboardWriter clipboard_writer( + ui::Clipboard::GetForCurrentThread(), + ui::Clipboard::BUFFER_STANDARD); clipboard_writer.WriteText(ASCIIToUTF16("foo")); } diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h index b31ae0a..bc5a56b 100644 --- a/chrome/browser/browser_process.h +++ b/chrome/browser/browser_process.h @@ -71,10 +71,6 @@ namespace safe_browsing { class ClientSideDetectionService; } -namespace ui { -class Clipboard; -} - // NOT THREAD SAFE, call only from the main thread. // These functions shouldn't return NULL unless otherwise noted. class BrowserProcess { @@ -95,7 +91,6 @@ class BrowserProcess { virtual MetricsService* metrics_service() = 0; virtual ProfileManager* profile_manager() = 0; virtual PrefService* local_state() = 0; - virtual ui::Clipboard* clipboard() = 0; virtual net::URLRequestContextGetter* system_request_context() = 0; virtual chrome_variations::VariationsService* variations_service() = 0; diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 798c400..0b0524e 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -78,7 +78,6 @@ #include "content/public/common/pepper_plugin_info.h" #include "net/socket/client_socket_pool_manager.h" #include "net/url_request/url_request_context_getter.h" -#include "ui/base/clipboard/clipboard.h" #include "ui/base/l10n/l10n_util.h" #if !defined(ENABLE_CONFIGURATION_POLICY) @@ -142,7 +141,6 @@ BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) thumbnail_generator_(new ThumbnailGenerator), download_status_updater_(new DownloadStatusUpdater) { g_browser_process = this; - clipboard_.reset(new ui::Clipboard); #if defined(ENABLE_PRINTING) // Must be created after the NotificationService. @@ -388,11 +386,6 @@ PrefService* BrowserProcessImpl::local_state() { return local_state_.get(); } -ui::Clipboard* BrowserProcessImpl::clipboard() { - DCHECK(CalledOnValidThread()); - return clipboard_.get(); -} - net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { DCHECK(CalledOnValidThread()); return io_thread()->system_url_request_context_getter(); diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index 607cc4f..404db25 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -64,7 +64,6 @@ class BrowserProcessImpl : public BrowserProcess, virtual WatchDogThread* watchdog_thread() OVERRIDE; virtual ProfileManager* profile_manager() OVERRIDE; virtual PrefService* local_state() OVERRIDE; - virtual ui::Clipboard* clipboard() OVERRIDE; virtual net::URLRequestContextGetter* system_request_context() OVERRIDE; virtual chrome_variations::VariationsService* variations_service() OVERRIDE; #if defined(OS_CHROMEOS) @@ -178,8 +177,6 @@ class BrowserProcessImpl : public BrowserProcess, scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_; - scoped_ptr<ui::Clipboard> clipboard_; - scoped_ptr<chrome_variations::VariationsService> variations_service_; // Manager for desktop notification UI. diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index daa5fb4..fc46a87 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -81,6 +81,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" +#include "ui/base/clipboard/clipboard.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/text/text_elider.h" #include "ui/gfx/favicon_size.h" @@ -2014,7 +2015,7 @@ void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { chrome_common_net::WriteURLToClipboard( url, profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), - g_browser_process->clipboard()); + ui::Clipboard::GetForCurrentThread()); } void RenderViewContextMenu::MediaPlayerActionAt( diff --git a/chrome/browser/ui/omnibox/omnibox_view.cc b/chrome/browser/ui/omnibox/omnibox_view.cc index d87fc18..e8bd344 100644 --- a/chrome/browser/ui/omnibox/omnibox_view.cc +++ b/chrome/browser/ui/omnibox/omnibox_view.cc @@ -11,7 +11,6 @@ #include "base/string16.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/browser_process.h" #include "ui/base/clipboard/clipboard.h" // static @@ -27,7 +26,7 @@ string16 OmniboxView::StripJavascriptSchemas(const string16& text) { // static string16 OmniboxView::GetClipboardText() { // Try text format. - ui::Clipboard* clipboard = g_browser_process->clipboard(); + ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); if (clipboard->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(), ui::Clipboard::BUFFER_STANDARD)) { string16 text; diff --git a/chrome/browser/ui/omnibox/omnibox_view_unittest.cc b/chrome/browser/ui/omnibox/omnibox_view_unittest.cc index 4346fca..ae932b5 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_unittest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_unittest.cc @@ -40,14 +40,14 @@ TEST_F(OmniboxViewTest, TestStripSchemasUnsafeForPaste) { } TEST_F(OmniboxViewTest, GetClipboardText) { - ui::Clipboard clipboard; + ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); const string16 kPlainText(ASCIIToUTF16("test text")); const std::string kURL("http://www.example.com/"); // Can we pull straight text off the clipboard? { - ui::ScopedClipboardWriter clipboard_writer(&clipboard, + ui::ScopedClipboardWriter clipboard_writer(clipboard, ui::Clipboard::BUFFER_STANDARD); clipboard_writer.WriteText(kPlainText); } @@ -57,8 +57,8 @@ TEST_F(OmniboxViewTest, GetClipboardText) { // ObjectMap is empty. http://crbug.com/133848 #if !defined(USE_AURA) // Does an empty clipboard get empty text? - clipboard.WriteObjects(ui::Clipboard::BUFFER_STANDARD, - ui::Clipboard::ObjectMap()); + clipboard->WriteObjects(ui::Clipboard::BUFFER_STANDARD, + ui::Clipboard::ObjectMap()); EXPECT_EQ(string16(), OmniboxView::GetClipboardText()); #endif @@ -68,7 +68,7 @@ TEST_F(OmniboxViewTest, GetClipboardText) { const string16 kTitle(ASCIIToUTF16("The Example Company")); // Can we pull a bookmark off the clipboard? { - ui::ScopedClipboardWriter clipboard_writer(&clipboard, + ui::ScopedClipboardWriter clipboard_writer(clipboard, ui::Clipboard::BUFFER_STANDARD); clipboard_writer.WriteBookmark(kTitle, kURL); } @@ -76,7 +76,7 @@ TEST_F(OmniboxViewTest, GetClipboardText) { // Do we pull text in preference to a bookmark? { - ui::ScopedClipboardWriter clipboard_writer(&clipboard, + ui::ScopedClipboardWriter clipboard_writer(clipboard, ui::Clipboard::BUFFER_STANDARD); clipboard_writer.WriteText(kPlainText); clipboard_writer.WriteBookmark(kTitle, kURL); @@ -87,7 +87,7 @@ TEST_F(OmniboxViewTest, GetClipboardText) { // Do we get nothing if there is neither text nor a bookmark? { const string16 kMarkup(ASCIIToUTF16("<strong>Hi!</string>")); - ui::ScopedClipboardWriter clipboard_writer(&clipboard, + ui::ScopedClipboardWriter clipboard_writer(clipboard, ui::Clipboard::BUFFER_STANDARD); clipboard_writer.WriteHTML(kMarkup, kURL); } @@ -98,7 +98,7 @@ TEST_F(OmniboxViewTest, GetClipboardText) { const string16 kWrappedURL(ASCIIToUTF16( "http://www.chromium.org/developers/testing/chromium-\n" "build-infrastructure/tour-of-the-chromium-buildbot")); - ui::ScopedClipboardWriter clipboard_writer(&clipboard, + ui::ScopedClipboardWriter clipboard_writer(clipboard, ui::Clipboard::BUFFER_STANDARD); clipboard_writer.WriteText(kWrappedURL); } @@ -112,7 +112,7 @@ TEST_F(OmniboxViewTest, GetClipboardText) { { const string16 kWrappedAddress(ASCIIToUTF16( "1600 Amphitheatre Parkway\nMountain View, CA")); - ui::ScopedClipboardWriter clipboard_writer(&clipboard, + ui::ScopedClipboardWriter clipboard_writer(clipboard, ui::Clipboard::BUFFER_STANDARD); clipboard_writer.WriteText(kWrappedAddress); } diff --git a/chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc b/chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc index b15609a..b093b95 100644 --- a/chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc +++ b/chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc @@ -36,7 +36,6 @@ class AccessibilityViewsDelegate : public views::ViewsDelegate { virtual ~AccessibilityViewsDelegate() {} // Overridden from views::ViewsDelegate: - virtual ui::Clipboard* GetClipboard() const OVERRIDE { return NULL; } virtual void SaveWindowPlacement(const views::Widget* window, const std::string& window_name, const gfx::Rect& bounds, diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc index 981cf92..5e6967c 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc @@ -58,7 +58,6 @@ void MoveMouseAndPress(const gfx::Point& screen_pos, class ViewsDelegateImpl : public views::ViewsDelegate { public: ViewsDelegateImpl() {} - virtual ui::Clipboard* GetClipboard() const OVERRIDE { return NULL; } virtual void SaveWindowPlacement(const views::Widget* window, const std::string& window_name, const gfx::Rect& bounds, diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc index 73b734b..e4cadc3 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.cc +++ b/chrome/browser/ui/views/chrome_views_delegate.cc @@ -14,7 +14,6 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/views/accessibility/accessibility_event_router_views.h" #include "chrome/common/pref_names.h" -#include "ui/base/clipboard/clipboard.h" #include "ui/gfx/rect.h" #include "ui/gfx/screen.h" #include "ui/views/widget/native_widget.h" @@ -56,10 +55,6 @@ PrefService* GetPrefsForWindow(const views::Widget* window) { /////////////////////////////////////////////////////////////////////////////// // ChromeViewsDelegate, views::ViewsDelegate implementation: -ui::Clipboard* ChromeViewsDelegate::GetClipboard() const { - return g_browser_process->clipboard(); -} - void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window, const std::string& window_name, const gfx::Rect& bounds, diff --git a/chrome/browser/ui/views/chrome_views_delegate.h b/chrome/browser/ui/views/chrome_views_delegate.h index c568d2e..d1da9a8 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.h +++ b/chrome/browser/ui/views/chrome_views_delegate.h @@ -17,7 +17,6 @@ class ChromeViewsDelegate : public views::ViewsDelegate { virtual ~ChromeViewsDelegate() {} // Overridden from views::ViewsDelegate: - virtual ui::Clipboard* GetClipboard() const OVERRIDE; virtual void SaveWindowPlacement(const views::Widget* window, const std::string& window_name, const gfx::Rect& bounds, diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc index ded923b..a5a4eaa 100644 --- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc @@ -352,7 +352,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_PasteWithoutTextChange) { browser(), ui::VKEY_C, true, false, false, false)); string16 str; - views::ViewsDelegate::views_delegate->GetClipboard()-> + ui::Clipboard::GetForCurrentThread()-> ReadText(ui::Clipboard::BUFFER_STANDARD, &str); // Make sure the text is copied successfully. diff --git a/chrome/browser/ui/views/menu_model_adapter_test.cc b/chrome/browser/ui/views/menu_model_adapter_test.cc index 94c00be..c1ff355 100644 --- a/chrome/browser/ui/views/menu_model_adapter_test.cc +++ b/chrome/browser/ui/views/menu_model_adapter_test.cc @@ -35,10 +35,6 @@ class TestViewsDelegate : public views::ViewsDelegate { } // views::ViewsDelegate implementation - virtual ui::Clipboard* GetClipboard() const OVERRIDE { - return NULL; - } - virtual void SaveWindowPlacement(const views::Widget* widget, const std::string& window_name, const gfx::Rect& bounds, diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index de46181..ff24a09 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc @@ -760,7 +760,7 @@ void OmniboxViewViews::OnAfterUserAction(views::Textfield* sender) { void OmniboxViewViews::OnAfterCutOrCopy() { ui::Range selection_range; textfield_->GetSelectedRange(&selection_range); - ui::Clipboard* cb = views::ViewsDelegate::views_delegate->GetClipboard(); + ui::Clipboard* cb = ui::Clipboard::GetForCurrentThread(); string16 selected_text; cb->ReadText(ui::Clipboard::BUFFER_STANDARD, &selected_text); const string16 text = textfield_->text(); diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc index d620d9e..68ed871 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc @@ -27,7 +27,6 @@ #include "chrome/browser/autocomplete/autocomplete_input.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/autocomplete/keyword_provider.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/command_updater.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/profiles/profile.h" @@ -1333,7 +1332,7 @@ void OmniboxViewWin::OnCopy() { // GetSel() doesn't preserve selection direction, so sel.cpMin will always be // the smaller value. model()->AdjustTextForCopy(sel.cpMin, IsSelectAll(), &text, &url, &write_url); - ui::ScopedClipboardWriter scw(g_browser_process->clipboard(), + ui::ScopedClipboardWriter scw(ui::Clipboard::GetForCurrentThread(), ui::Clipboard::BUFFER_STANDARD); scw.WriteText(text); if (write_url) diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc index d8d7a80..e1fc242 100644 --- a/chrome/test/base/testing_browser_process.cc +++ b/chrome/test/base/testing_browser_process.cc @@ -17,7 +17,6 @@ #include "content/public/browser/notification_service.h" #include "net/url_request/url_request_context_getter.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/clipboard/clipboard.h" #if !defined(ENABLE_CONFIGURATION_POLICY) #include "chrome/browser/policy/policy_service_stub.h" @@ -125,14 +124,6 @@ chromeos::OomPriorityManager* TestingBrowserProcess::oom_priority_manager() { } #endif // defined(OS_CHROMEOS) -ui::Clipboard* TestingBrowserProcess::clipboard() { - if (!clipboard_.get()) { - // Note that we need a MessageLoop for the next call to work. - clipboard_.reset(new ui::Clipboard); - } - return clipboard_.get(); -} - extensions::EventRouterForwarder* TestingBrowserProcess::extension_event_router_forwarder() { return NULL; diff --git a/chrome/test/base/testing_browser_process.h b/chrome/test/base/testing_browser_process.h index e5c573b..8fc1990 100644 --- a/chrome/test/base/testing_browser_process.h +++ b/chrome/test/base/testing_browser_process.h @@ -38,10 +38,6 @@ namespace prerender { class PrerenderTracker; } -namespace ui { -class Clipboard; -} - class TestingBrowserProcess : public BrowserProcess { public: TestingBrowserProcess(); @@ -70,7 +66,6 @@ class TestingBrowserProcess : public BrowserProcess { virtual chromeos::OomPriorityManager* oom_priority_manager() OVERRIDE; #endif // defined(OS_CHROMEOS) - virtual ui::Clipboard* clipboard() OVERRIDE; virtual extensions::EventRouterForwarder* extension_event_router_forwarder() OVERRIDE; virtual NotificationUIManager* notification_ui_manager() OVERRIDE; @@ -115,7 +110,6 @@ class TestingBrowserProcess : public BrowserProcess { private: scoped_ptr<content::NotificationService> notification_service_; unsigned int module_ref_count_; - scoped_ptr<ui::Clipboard> clipboard_; std::string app_locale_; // Weak pointer. |