summaryrefslogtreecommitdiffstats
path: root/win8/metro_driver
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 21:18:12 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 21:18:12 +0000
commitedf0f2dd52a6d7aaf182f8e4b3e604b35836c30e (patch)
tree868bda09051f9a1fc9abb99124f7c2a5b4026b17 /win8/metro_driver
parent0ad9657ad8667c6ac5891980611724d44faa0112 (diff)
downloadchromium_src-edf0f2dd52a6d7aaf182f8e4b3e604b35836c30e.zip
chromium_src-edf0f2dd52a6d7aaf182f8e4b3e604b35836c30e.tar.gz
chromium_src-edf0f2dd52a6d7aaf182f8e4b3e604b35836c30e.tar.bz2
Ensure that we set focus to the focused text input client in Windows desktop Chrome AURA when a DesktopRootWindowHostWin/
ASH root window is activated. To achieve this we register a handler for the Activate event on the ASH core Window in Windows 8 and send an IPC MetroViewerHostMsg_WindowActivated from the metro viewer process along with a bool which indcates whether we gained or lost activation. In the RemoteRootWindowHostWin class we inform the RootWindow whether it gained or lost focus based on the active flag passed in the IPC. BUG=235128 R=cpu,sky TBR=palmer Review URL: https://codereview.chromium.org/14070017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196835 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8/metro_driver')
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc22
-rw-r--r--win8/metro_driver/chrome_app_view_ash.h3
2 files changed, 25 insertions, 0 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index b21a572..d007a86 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -50,6 +50,10 @@ typedef winfoundtn::ITypedEventHandler<
winui::Core::CoreWindow*,
winui::Core::VisibilityChangedEventArgs*> VisibilityChangedHandler;
+typedef winfoundtn::ITypedEventHandler<
+ winui::Core::CoreWindow*,
+ winui::Core::WindowActivatedEventArgs*> WindowActivatedHandler;
+
// This function is exported by chrome.exe.
typedef int (__cdecl *BreakpadExceptionHandler)(EXCEPTION_POINTERS* info);
@@ -370,6 +374,11 @@ ChromeAppViewAsh::SetWindow(winui::Core::ICoreWindow* window) {
&visibility_changed_token_);
CheckHR(hr);
+ hr = window_->add_Activated(mswr::Callback<WindowActivatedHandler>(
+ this, &ChromeAppViewAsh::OnWindowActivated).Get(),
+ &window_activated_token_);
+ CheckHR(hr);
+
// By initializing the direct 3D swap chain with the corewindow
// we can now directly blit to it from the browser process.
direct3d_helper_.Initialize(window);
@@ -786,6 +795,19 @@ HRESULT ChromeAppViewAsh::OnVisibilityChanged(
return S_OK;
}
+HRESULT ChromeAppViewAsh::OnWindowActivated(
+ winui::Core::ICoreWindow* sender,
+ winui::Core::IWindowActivatedEventArgs* args) {
+ winui::Core::CoreWindowActivationState state;
+ HRESULT hr = args->get_WindowActivationState(&state);
+ if (FAILED(hr))
+ return hr;
+ DVLOG(1) << "Window activation state: " << state;
+ ui_channel_->Send(new MetroViewerHostMsg_WindowActivated(
+ state != winui::Core::CoreWindowActivationState_Deactivated));
+ return S_OK;
+}
+
///////////////////////////////////////////////////////////////////////////////
diff --git a/win8/metro_driver/chrome_app_view_ash.h b/win8/metro_driver/chrome_app_view_ash.h
index e649f8d..1e9e601 100644
--- a/win8/metro_driver/chrome_app_view_ash.h
+++ b/win8/metro_driver/chrome_app_view_ash.h
@@ -107,6 +107,9 @@ class ChromeAppViewAsh
HRESULT OnVisibilityChanged(winui::Core::ICoreWindow* sender,
winui::Core::IVisibilityChangedEventArgs* args);
+ HRESULT OnWindowActivated(winui::Core::ICoreWindow* sender,
+ winui::Core::IWindowActivatedEventArgs* args);
+
mswr::ComPtr<winui::Core::ICoreWindow> window_;
mswr::ComPtr<winapp::Core::ICoreApplicationView> view_;
EventRegistrationToken activated_token_;