diff options
21 files changed, 24 insertions, 64 deletions
diff --git a/ash/wm/ash_native_cursor_manager.cc b/ash/wm/ash_native_cursor_manager.cc index a52858f..4f2f39e 100644 --- a/ash/wm/ash_native_cursor_manager.cc +++ b/ash/wm/ash_native_cursor_manager.cc @@ -119,10 +119,4 @@ void AshNativeCursorManager::SetMouseEventsEnabled( NotifyMouseEventsEnableStateChange(enabled); } -void AshNativeCursorManager::SetCursorResourceModule( - const base::string16& module_name) { - image_cursors_->SetCursorResourceModule(module_name); -} - - } // namespace ash diff --git a/ash/wm/ash_native_cursor_manager.h b/ash/wm/ash_native_cursor_manager.h index 60eec94..5ea9ec9 100644 --- a/ash/wm/ash_native_cursor_manager.h +++ b/ash/wm/ash_native_cursor_manager.h @@ -52,8 +52,6 @@ class ASH_EXPORT AshNativeCursorManager virtual void SetMouseEventsEnabled( bool enabled, views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; - virtual void SetCursorResourceModule( - const base::string16& module_name) OVERRIDE; // The cursor location where the cursor was disabled. gfx::Point disabled_cursor_location_; diff --git a/ash/wm/ash_native_cursor_manager_unittest.cc b/ash/wm/ash_native_cursor_manager_unittest.cc index f8160e4..bd748ed 100644 --- a/ash/wm/ash_native_cursor_manager_unittest.cc +++ b/ash/wm/ash_native_cursor_manager_unittest.cc @@ -16,6 +16,7 @@ #if defined(OS_WIN) #include "base/win/windows_version.h" +#include "ui/base/cursor/cursor_loader_win.h" #endif using views::corewm::CursorManager; @@ -57,7 +58,7 @@ TEST_F(AshNativeCursorManagerTest, LockCursor) { CursorManagerTestApi test_api(cursor_manager); gfx::Display display(0); #if defined(OS_WIN) - cursor_manager->SetCursorResourceModule(L"ash_unittests.exe"); + ui::CursorLoaderWin::SetCursorResourceModule(L"ash_unittests.exe"); #endif cursor_manager->SetCursor(ui::kCursorCopy); EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type()); @@ -105,7 +106,7 @@ TEST_F(AshNativeCursorManagerTest, SetCursor) { CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); #if defined(OS_WIN) - cursor_manager->SetCursorResourceModule(L"ash_unittests.exe"); + ui::CursorLoaderWin::SetCursorResourceModule(L"ash_unittests.exe"); #endif cursor_manager->SetCursor(ui::kCursorCopy); EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type()); diff --git a/ash/wm/image_cursors.cc b/ash/wm/image_cursors.cc index d89cfa7..33b3582 100644 --- a/ash/wm/image_cursors.cc +++ b/ash/wm/image_cursors.cc @@ -137,8 +137,4 @@ void ImageCursors::SetPlatformCursor(gfx::NativeCursor* cursor) { cursor_loader_->SetPlatformCursor(cursor); } -void ImageCursors::SetCursorResourceModule(const base::string16& module_name) { - cursor_loader_->SetCursorResourceModule(module_name); -} - } // namespace ash diff --git a/ash/wm/image_cursors.h b/ash/wm/image_cursors.h index 8f0ab2b..72c004f 100644 --- a/ash/wm/image_cursors.h +++ b/ash/wm/image_cursors.h @@ -43,9 +43,6 @@ class ASH_EXPORT ImageCursors { // Sets the platform cursor based on the native type of |cursor|. void SetPlatformCursor(gfx::NativeCursor* cursor); - // Sets the cursor resource module name for non system cursors. - void SetCursorResourceModule(const base::string16& module_name); - private: // Reloads the all loaded cursors in the cursor loader. void ReloadCursors(); diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index 9fdfc4b..6149cf9 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc @@ -45,6 +45,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "installer_util_strings/installer_util_strings.h" +#include "ui/base/cursor/cursor_loader_win.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_win.h" #include "ui/base/ui_base_switches.h" @@ -185,6 +186,9 @@ void ChromeBrowserMainPartsWin::ToolkitInitialized() { ChromeBrowserMainParts::ToolkitInitialized(); gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont; gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize; +#if defined(USE_AURA) + ui::CursorLoaderWin::SetCursorResourceModule(chrome::kBrowserResourcesDll); +#endif } void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index c40223e..b521087 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -2904,13 +2904,6 @@ void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { aura::client::CursorClient* cursor_client = aura::client::GetCursorClient(root_window); if (cursor_client) { -#if defined(OS_WIN) - if (GetContentClient() && GetContentClient()->browser() && - GetContentClient()->browser()->GetResourceDllName()) { - cursor_client->SetCursorResourceModule( - GetContentClient()->browser()->GetResourceDllName()); - } -#endif cursor_client->SetCursor(cursor); } } diff --git a/ui/aura/client/cursor_client.h b/ui/aura/client/cursor_client.h index 4769cea..acdf255 100644 --- a/ui/aura/client/cursor_client.h +++ b/ui/aura/client/cursor_client.h @@ -60,10 +60,6 @@ class AURA_EXPORT CursorClient { // EnableMouseEvents/DisableMouseEvents. virtual void UnlockCursor() = 0; - // Used to pass the cursor resource module name to the cursor loader. This is - // typically used to load non system cursors. - virtual void SetCursorResourceModule(const base::string16& module_name) = 0; - // Used to add or remove a CursorClientObserver. virtual void AddObserver(CursorClientObserver* observer) = 0; virtual void RemoveObserver(CursorClientObserver* observer) = 0; diff --git a/ui/aura/test/test_cursor_client.cc b/ui/aura/test/test_cursor_client.cc index 21e8e33..b82abbf 100644 --- a/ui/aura/test/test_cursor_client.cc +++ b/ui/aura/test/test_cursor_client.cc @@ -63,9 +63,6 @@ void TestCursorClient::LockCursor() { void TestCursorClient::UnlockCursor() { } -void TestCursorClient::SetCursorResourceModule(const string16& module_name) { -} - void TestCursorClient::AddObserver( aura::client::CursorClientObserver* observer) { observers_.AddObserver(observer); diff --git a/ui/aura/test/test_cursor_client.h b/ui/aura/test/test_cursor_client.h index e4b364b..62ccf7f 100644 --- a/ui/aura/test/test_cursor_client.h +++ b/ui/aura/test/test_cursor_client.h @@ -29,7 +29,6 @@ class TestCursorClient : public aura::client::CursorClient { virtual void SetDisplay(const gfx::Display& display) OVERRIDE; virtual void LockCursor() OVERRIDE; virtual void UnlockCursor() OVERRIDE; - virtual void SetCursorResourceModule(const string16& module_name) OVERRIDE; virtual void AddObserver( aura::client::CursorClientObserver* observer) OVERRIDE; virtual void RemoveObserver( diff --git a/ui/base/cursor/cursor_loader.h b/ui/base/cursor/cursor_loader.h index f8a8a53..d54d298 100644 --- a/ui/base/cursor/cursor_loader.h +++ b/ui/base/cursor/cursor_loader.h @@ -60,10 +60,6 @@ class UI_EXPORT CursorLoader { // Sets the platform cursor based on the native type of |cursor|. virtual void SetPlatformCursor(gfx::NativeCursor* cursor) = 0; - // Used to pass the cursor resource module name to the cursor loader. This is - // typically used to load non system cursors. - virtual void SetCursorResourceModule(const string16& module_name) = 0; - // Creates a CursorLoader. static CursorLoader* Create(); diff --git a/ui/base/cursor/cursor_loader_null.cc b/ui/base/cursor/cursor_loader_null.cc index ec1dde3..51ced4c 100644 --- a/ui/base/cursor/cursor_loader_null.cc +++ b/ui/base/cursor/cursor_loader_null.cc @@ -21,6 +21,5 @@ void CursorLoaderNull::LoadAnimatedCursor(int id, int frame_delay_ms) {} void CursorLoaderNull::UnloadAll() {} void CursorLoaderNull::SetPlatformCursor(gfx::NativeCursor* cursor) {} -void CursorLoaderNull::SetCursorResourceModule(const string16& module_name) {} } // namespace ui diff --git a/ui/base/cursor/cursor_loader_win.cc b/ui/base/cursor/cursor_loader_win.cc index 95738be..9d633f1 100644 --- a/ui/base/cursor/cursor_loader_win.cc +++ b/ui/base/cursor/cursor_loader_win.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/lazy_instance.h" +#include "base/strings/string16.h" #include "ui/base/cursor/cursor_loader_win.h" #include "grit/ui_unscaled_resources.h" @@ -11,6 +13,8 @@ namespace ui { namespace { +base::LazyInstance<string16> g_cursor_resource_module_name; + const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) { switch (native_cursor.native_type()) { case kCursorNull: @@ -148,9 +152,10 @@ void CursorLoaderWin::SetPlatformCursor(gfx::NativeCursor* cursor) { } else { const wchar_t* cursor_id = GetCursorId(*cursor); PlatformCursor platform_cursor = LoadCursor(NULL, cursor_id); - if (!platform_cursor && !cursor_resource_module_name_.empty()) { + if (!platform_cursor && !g_cursor_resource_module_name.Get().empty()) { platform_cursor = LoadCursor( - GetModuleHandle(cursor_resource_module_name_.c_str()), cursor_id); + GetModuleHandle(g_cursor_resource_module_name.Get().c_str()), + cursor_id); } cursor->SetPlatformCursor(platform_cursor); } @@ -158,8 +163,11 @@ void CursorLoaderWin::SetPlatformCursor(gfx::NativeCursor* cursor) { #endif } +#if defined(USE_AURA) +// static void CursorLoaderWin::SetCursorResourceModule(const string16& module_name) { - cursor_resource_module_name_ = module_name; + g_cursor_resource_module_name.Get() = module_name; } +#endif } // namespace ui diff --git a/ui/base/cursor/cursor_loader_win.h b/ui/base/cursor/cursor_loader_win.h index 7e1ff60..fcae566 100644 --- a/ui/base/cursor/cursor_loader_win.h +++ b/ui/base/cursor/cursor_loader_win.h @@ -6,7 +6,6 @@ #define UI_BASE_CURSOR_CURSOR_LOADER_WIN_H_ #include "base/compiler_specific.h" -#include "base/strings/string16.h" #include "ui/base/cursor/cursor_loader.h" namespace ui { @@ -26,11 +25,14 @@ class UI_EXPORT CursorLoaderWin : public CursorLoader { int frame_delay_ms) OVERRIDE; virtual void UnloadAll() OVERRIDE; virtual void SetPlatformCursor(gfx::NativeCursor* cursor) OVERRIDE; - virtual void SetCursorResourceModule(const string16& module_name) OVERRIDE; - private: - string16 cursor_resource_module_name_; +#if defined(USE_AURA) + // Used to pass the cursor resource module name to the cursor loader. This is + // typically used to load non system cursors. + static void SetCursorResourceModule(const string16& module_name); +#endif + private: DISALLOW_COPY_AND_ASSIGN(CursorLoaderWin); }; diff --git a/ui/base/cursor/cursor_loader_x11.h b/ui/base/cursor/cursor_loader_x11.h index 2b740f8..4947ca0 100644 --- a/ui/base/cursor/cursor_loader_x11.h +++ b/ui/base/cursor/cursor_loader_x11.h @@ -31,8 +31,6 @@ class UI_EXPORT CursorLoaderX11 : public CursorLoader { int frame_delay_ms) OVERRIDE; virtual void UnloadAll() OVERRIDE; virtual void SetPlatformCursor(gfx::NativeCursor* cursor) OVERRIDE; - virtual void SetCursorResourceModule(const string16& module_name) OVERRIDE { - } private: // Returns true if we have an image resource loaded for the |native_cursor|. diff --git a/ui/views/corewm/cursor_manager.cc b/ui/views/corewm/cursor_manager.cc index 57a7ee8..5c4dc81 100644 --- a/ui/views/corewm/cursor_manager.cc +++ b/ui/views/corewm/cursor_manager.cc @@ -172,10 +172,6 @@ void CursorManager::UnlockCursor() { } } -void CursorManager::SetCursorResourceModule(const string16& module_name) { - delegate_->SetCursorResourceModule(module_name); -} - void CursorManager::AddObserver( aura::client::CursorClientObserver* observer) { observers_.AddObserver(observer); diff --git a/ui/views/corewm/cursor_manager.h b/ui/views/corewm/cursor_manager.h index 0dc3688..9e31640 100644 --- a/ui/views/corewm/cursor_manager.h +++ b/ui/views/corewm/cursor_manager.h @@ -53,7 +53,6 @@ class VIEWS_EXPORT CursorManager : public aura::client::CursorClient, virtual void SetDisplay(const gfx::Display& display) OVERRIDE; virtual void LockCursor() OVERRIDE; virtual void UnlockCursor() OVERRIDE; - virtual void SetCursorResourceModule(const string16& module_name) OVERRIDE; virtual void AddObserver( aura::client::CursorClientObserver* observer) OVERRIDE; virtual void RemoveObserver( diff --git a/ui/views/corewm/cursor_manager_unittest.cc b/ui/views/corewm/cursor_manager_unittest.cc index 87ea475..650d5b8 100644 --- a/ui/views/corewm/cursor_manager_unittest.cc +++ b/ui/views/corewm/cursor_manager_unittest.cc @@ -44,9 +44,6 @@ class TestingCursorManager : public views::corewm::NativeCursorManager { delegate->CommitScale(scale); } - virtual void SetCursorResourceModule(const string16& module_name) OVERRIDE { - } - private: gfx::NativeCursor cursor_; }; diff --git a/ui/views/corewm/native_cursor_manager.h b/ui/views/corewm/native_cursor_manager.h index bd9d678..c38fb34 100644 --- a/ui/views/corewm/native_cursor_manager.h +++ b/ui/views/corewm/native_cursor_manager.h @@ -54,10 +54,6 @@ class VIEWS_EXPORT NativeCursorManager { virtual void SetMouseEventsEnabled( bool enabled, views::corewm::NativeCursorManagerDelegate* delegate) = 0; - - // Used to pass the cursor resource module name to the cursor loader. This is - // typically used to load non system cursors. - virtual void SetCursorResourceModule(const string16& module_name) = 0; }; } // namespace corewm diff --git a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc index e4d48b8..856738f 100644 --- a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc +++ b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc @@ -82,9 +82,4 @@ void DesktopNativeCursorManager::SetMouseEventsEnabled( root_window_->OnMouseEventsEnableStateChanged(enabled); } -void DesktopNativeCursorManager::SetCursorResourceModule( - const string16& module_name) { - cursor_loader_->SetCursorResourceModule(module_name); -} - } // namespace views diff --git a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h index 3058830..cbee0c4 100644 --- a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h +++ b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h @@ -52,7 +52,6 @@ class VIEWS_EXPORT DesktopNativeCursorManager virtual void SetMouseEventsEnabled( bool enabled, views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; - virtual void SetCursorResourceModule(const string16& module_name) OVERRIDE; aura::RootWindow* root_window_; scoped_ptr<DesktopCursorLoaderUpdater> cursor_loader_updater_; |