diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-04 04:16:39 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-04 04:16:39 +0000 |
commit | eb422129453c349708cf9086a96034f0cc024be7 (patch) | |
tree | 01398a86f0ec05b616e7f57dbee1d16a25f2e633 | |
parent | cdf1f28c8ebec974caec3858b46d9f806040c48b (diff) | |
download | chromium_src-eb422129453c349708cf9086a96034f0cc024be7.zip chromium_src-eb422129453c349708cf9086a96034f0cc024be7.tar.gz chromium_src-eb422129453c349708cf9086a96034f0cc024be7.tar.bz2 |
Update Ash Display when resizing Metro window
On a window sizing event from the metro viewer, we were previously
only updating the aura root window. We also need to update the
ash DisplayManager data so that the wallpaper and docking behaviour
work correctly when going e.g. from a portrait display to a
landscape display.
R=ananta@chromium.org, sky@chromium.org
BUG=306629, 319051
Review URL: https://codereview.chromium.org/102783002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238560 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/test/test_metro_viewer_process_host.cc | 4 | ||||
-rw-r--r-- | ash/test/test_metro_viewer_process_host.h | 1 | ||||
-rw-r--r-- | chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc | 14 | ||||
-rw-r--r-- | chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h | 1 | ||||
-rw-r--r-- | chrome/browser/ui/ash/user_wallpaper_delegate_win.cc | 10 | ||||
-rw-r--r-- | ui/aura/remote_root_window_host_win.cc | 11 | ||||
-rw-r--r-- | ui/aura/remote_root_window_host_win.h | 3 | ||||
-rw-r--r-- | win8/viewer/metro_viewer_process_host.cc | 2 | ||||
-rw-r--r-- | win8/viewer/metro_viewer_process_host.h | 3 |
9 files changed, 37 insertions, 12 deletions
diff --git a/ash/test/test_metro_viewer_process_host.cc b/ash/test/test_metro_viewer_process_host.cc index 3a58433..a5e3fbf 100644 --- a/ash/test/test_metro_viewer_process_host.cc +++ b/ash/test/test_metro_viewer_process_host.cc @@ -42,5 +42,9 @@ void TestMetroViewerProcessHost::OnHandleSearchRequest( const string16& search_string) { } +void TestMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, + uint32 height) { +} + } // namespace test } // namespace ash diff --git a/ash/test/test_metro_viewer_process_host.h b/ash/test/test_metro_viewer_process_host.h index e6d0a64..7c3770e 100644 --- a/ash/test/test_metro_viewer_process_host.h +++ b/ash/test/test_metro_viewer_process_host.h @@ -26,6 +26,7 @@ class TestMetroViewerProcessHost : public win8::MetroViewerProcessHost { virtual void OnSetTargetSurface(gfx::NativeViewId target_surface) OVERRIDE; virtual void OnOpenURL(const string16& url) OVERRIDE; virtual void OnHandleSearchRequest(const string16& search_string) OVERRIDE; + virtual void OnWindowSizeChanged(uint32 width, uint32 height) OVERRIDE; scoped_ptr<AcceleratedSurface> backing_surface_; diff --git a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc index 4a37312..d5fc136 100644 --- a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc +++ b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc @@ -4,10 +4,13 @@ #include "chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h" +#include "ash/display/display_info.h" +#include "ash/display/display_manager.h" #include "ash/shell.h" #include "ash/wm/window_positioner.h" #include "base/logging.h" #include "base/memory/ref_counted.h" +#include "base/strings/stringprintf.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part_aurawin.h" #include "chrome/browser/browser_shutdown.h" @@ -141,3 +144,14 @@ void ChromeMetroViewerProcessHost::OnHandleSearchRequest( if (url.is_valid()) OpenURL(url); } + +void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, + uint32 height) { + std::vector<ash::internal::DisplayInfo> info_list; + info_list.push_back(ash::internal::DisplayInfo::CreateFromSpec( + base::StringPrintf("%dx%d", width, height))); + ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( + info_list); + aura::RemoteRootWindowHostWin::Instance()->HandleWindowSizeChanged(width, + height); +} diff --git a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h index e108e8a..c32e597 100644 --- a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h +++ b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h @@ -19,6 +19,7 @@ class ChromeMetroViewerProcessHost : public win8::MetroViewerProcessHost { virtual void OnSetTargetSurface(gfx::NativeViewId target_surface) OVERRIDE; virtual void OnOpenURL(const string16& url) OVERRIDE; virtual void OnHandleSearchRequest(const string16& search_string) OVERRIDE; + virtual void OnWindowSizeChanged(uint32 width, uint32 height) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(ChromeMetroViewerProcessHost); }; diff --git a/chrome/browser/ui/ash/user_wallpaper_delegate_win.cc b/chrome/browser/ui/ash/user_wallpaper_delegate_win.cc index 2f51334..42ea723 100644 --- a/chrome/browser/ui/ash/user_wallpaper_delegate_win.cc +++ b/chrome/browser/ui/ash/user_wallpaper_delegate_win.cc @@ -35,19 +35,19 @@ class UserWallpaperDelegate : public ash::UserWallpaperDelegate { } virtual void UpdateWallpaper() OVERRIDE { - } - - virtual void InitializeWallpaper() OVERRIDE { SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); bitmap.allocPixels(); bitmap.eraseARGB(255, kBackgroundRed, kBackgroundGreen, kBackgroundBlue); - gfx::ImageSkia wallpaper = - gfx::ImageSkia::CreateFrom1xBitmap(bitmap); + gfx::ImageSkia wallpaper = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); ash::Shell::GetInstance()->desktop_background_controller()-> SetCustomWallpaper(wallpaper, ash::WALLPAPER_LAYOUT_TILE); } + virtual void InitializeWallpaper() OVERRIDE { + UpdateWallpaper(); + } + virtual void OpenSetWallpaperPage() OVERRIDE { } diff --git a/ui/aura/remote_root_window_host_win.cc b/ui/aura/remote_root_window_host_win.cc index 7097e3d2..ff52d07 100644 --- a/ui/aura/remote_root_window_host_win.cc +++ b/ui/aura/remote_root_window_host_win.cc @@ -182,8 +182,6 @@ bool RemoteRootWindowHostWin::OnMessageReceived(const IPC::Message& message) { OnSelectFolderDone) IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursorPosAck, OnSetCursorPosAck) - IPC_MESSAGE_HANDLER(MetroViewerHostMsg_WindowSizeChanged, - OnWindowSizeChanged) IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ActivateDesktopDone, OnDesktopActivated) IPC_MESSAGE_UNHANDLED(handled = false) @@ -295,6 +293,11 @@ void RemoteRootWindowHostWin::HandleSelectFolder( host_->Send(new MetroViewerHostMsg_DisplaySelectFolder(title)); } +void RemoteRootWindowHostWin::HandleWindowSizeChanged(uint32 width, + uint32 height) { + SetBounds(gfx::Rect(0, 0, width, height)); +} + bool RemoteRootWindowHostWin::IsForegroundWindow() { return ::GetForegroundWindow() == remote_window_; } @@ -572,10 +575,6 @@ void RemoteRootWindowHostWin::OnSetCursorPosAck() { ignore_mouse_moves_until_set_cursor_ack_ = false; } -void RemoteRootWindowHostWin::OnWindowSizeChanged(uint32 width, uint32 height) { - SetBounds(gfx::Rect(0, 0, width, height)); -} - void RemoteRootWindowHostWin::OnDesktopActivated() { ActivateDesktopCompleted temp = activate_completed_callback_; activate_completed_callback_.Reset(); diff --git a/ui/aura/remote_root_window_host_win.h b/ui/aura/remote_root_window_host_win.h index 437d409..b7d9148 100644 --- a/ui/aura/remote_root_window_host_win.h +++ b/ui/aura/remote_root_window_host_win.h @@ -139,6 +139,8 @@ class AURA_EXPORT RemoteRootWindowHostWin : public RootWindowHost { const SelectFolderCompletion& on_success, const FileSelectionCanceled& on_failure); + void HandleWindowSizeChanged(uint32 width, uint32 height); + // Returns the active ASH root window. Window* GetAshWindow(); @@ -181,7 +183,6 @@ class AURA_EXPORT RemoteRootWindowHostWin : public RootWindowHost { const std::vector<base::FilePath>& files); void OnSelectFolderDone(bool success, const base::FilePath& folder); void OnSetCursorPosAck(); - void OnWindowSizeChanged(uint32 width, uint32 height); void OnDesktopActivated(); // RootWindowHost overrides: diff --git a/win8/viewer/metro_viewer_process_host.cc b/win8/viewer/metro_viewer_process_host.cc index 46968b9..6a86ec9 100644 --- a/win8/viewer/metro_viewer_process_host.cc +++ b/win8/viewer/metro_viewer_process_host.cc @@ -98,6 +98,8 @@ bool MetroViewerProcessHost::OnMessageReceived( IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetTargetSurface, OnSetTargetSurface) IPC_MESSAGE_HANDLER(MetroViewerHostMsg_OpenURL, OnOpenURL) IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SearchRequest, OnHandleSearchRequest) + IPC_MESSAGE_HANDLER(MetroViewerHostMsg_WindowSizeChanged, + OnWindowSizeChanged) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled ? true : diff --git a/win8/viewer/metro_viewer_process_host.h b/win8/viewer/metro_viewer_process_host.h index ba5b4f3..635caae 100644 --- a/win8/viewer/metro_viewer_process_host.h +++ b/win8/viewer/metro_viewer_process_host.h @@ -76,6 +76,9 @@ class MetroViewerProcessHost : public IPC::Listener, // performed. virtual void OnHandleSearchRequest(const string16& search_string) = 0; + // Called over IPC by the viewer process when the window size has changed. + virtual void OnWindowSizeChanged(uint32 width, uint32 height) = 0; + void NotifyChannelConnected(); // Inner message filter used to handle connection event on the IPC channel |