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 e39118b8501f7b6aa6c7ba22c24dea92e1a8bfa2..3c00d9ece9eae740269286ca9a8cdbf59a6bd0c8 100644 |
--- a/win8/metro_driver/chrome_app_view_ash.cc |
+++ b/win8/metro_driver/chrome_app_view_ash.cc |
@@ -884,8 +884,13 @@ HRESULT ChromeAppViewAsh::OnVisibilityChanged( |
HRESULT hr = args->get_Visible(&visible); |
if (FAILED(hr)) |
return hr; |
- |
- ui_channel_->Send(new MetroViewerHostMsg_VisibilityChanged(!!visible)); |
+ // We used to send MetroViewerHostMsg_VisibilityChanged to the browser process |
+ // upon receiving this message to catch when Ash gets activated, but it turned |
+ // out that this wasn't sufficient as Ash can be visible yet a Chrome |
+ // desktop window can be active in a multiple monitor scenario, resulting in |
+ // Ash not being considered as reactivated when refocused (since this message |
+ // was never received as the visibility didn't change). We switched to using |
+ // OnWindowActivated() below to solve this problem. |
return S_OK; |
} |
@@ -896,6 +901,14 @@ HRESULT ChromeAppViewAsh::OnWindowActivated( |
HRESULT hr = args->get_WindowActivationState(&state); |
if (FAILED(hr)) |
return hr; |
+ |
+ // Treat both full activation (Ash was reopened from the Start Screen or from |
+ // any other Metro entry point in Windows) and pointer activation (user |
+ // clicked back in Ash after using another app on another monitor) the same. |
+ if (state == winui::Core::CoreWindowActivationState_CodeActivated || |
+ state == winui::Core::CoreWindowActivationState_PointerActivated) { |
+ ui_channel_->Send(new MetroViewerHostMsg_WindowActivated()); |
+ } |
return S_OK; |
} |