Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: win8/metro_driver/chrome_app_view_ash.cc

Issue 15599002: Fix Ash on Windows multi-monitor support and snap-view sizing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « win8/metro_driver/chrome_app_view_ash.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win8/metro_driver/chrome_app_view_ash.cc
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index d007a86d5e0384934bfbb9c42be7d4f2b38056ec..46aea7a3c081ec9b7e0b435b39acf00f2fce302b 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -54,6 +54,10 @@ typedef winfoundtn::ITypedEventHandler<
winui::Core::CoreWindow*,
winui::Core::WindowActivatedEventArgs*> WindowActivatedHandler;
+typedef winfoundtn::ITypedEventHandler<
+ winui::Core::CoreWindow*,
+ winui::Core::WindowSizeChangedEventArgs*> SizeChangedHandler;
+
// This function is exported by chrome.exe.
typedef int (__cdecl *BreakpadExceptionHandler)(EXCEPTION_POINTERS* info);
@@ -317,6 +321,11 @@ ChromeAppViewAsh::SetWindow(winui::Core::ICoreWindow* window) {
hr = interop->get_WindowHandle(&core_window_hwnd_);
CheckHR(hr);
+ hr = window_->add_SizeChanged(mswr::Callback<SizeChangedHandler>(
+ this, &ChromeAppViewAsh::OnSizeChanged).Get(),
+ &sizechange_token_);
+ CheckHR(hr);
+
// Register for pointer and keyboard notifications. We forward
// them to the browser process via IPC.
hr = window_->add_PointerMoved(mswr::Callback<PointerEventHandler>(
@@ -439,6 +448,14 @@ ChromeAppViewAsh::Run() {
gfx::NativeViewId(core_window_hwnd_)));
DVLOG(1) << "ICoreWindow sent " << core_window_hwnd_;
+ // Send an initial size message so that the Ash root window host gets sized
+ // correctly.
+ RECT rect = {0};
+ ::GetWindowRect(core_window_hwnd_, &rect);
+ ui_channel_->Send(
+ new MetroViewerHostMsg_WindowSizeChanged(rect.right - rect.left,
+ rect.bottom - rect.top));
+
// And post the task that'll do the inner Metro message pumping to it.
msg_loop.PostTask(FROM_HERE, base::Bind(&RunMessageLoop, dispatcher.Get()));
msg_loop.Run();
@@ -808,6 +825,23 @@ HRESULT ChromeAppViewAsh::OnWindowActivated(
return S_OK;
}
+HRESULT ChromeAppViewAsh::OnSizeChanged(winui::Core::ICoreWindow* sender,
+ winui::Core::IWindowSizeChangedEventArgs* args) {
+ if (!window_) {
+ return S_OK;
+ }
+
+ winfoundtn::Size size;
+ args->get_Size(&size);
cpu_(ooo_6.6-7.5) 2013/05/21 20:36:12 check the error code of get_Size. I guess don't se
robertshield 2013/05/22 17:31:20 Done.
+
+ int32 cx = static_cast<int32>(size.Width);
+ int32 cy = static_cast<int32>(size.Height);
+
+ DVLOG(1) << "Window size changed: width=" << cx << ", height=" << cy;
+ ui_channel_->Send(new MetroViewerHostMsg_WindowSizeChanged(cx, cy));
+ return S_OK;
+}
+
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « win8/metro_driver/chrome_app_view_ash.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698