From cbafd1cf102678418fbe04bf170d3e05ffc92af0 Mon Sep 17 00:00:00 2001 From: "grt@chromium.org" Date: Thu, 15 Nov 2012 23:33:44 +0000 Subject: Track the last active RootWindowHost to determine the most-recently active host desktop type. This is for use in those places where there's no context from which to figure out if something should be popped on the native or ash desktop. Original approach reviewed here: https://chromiumcodereview.appspot.com/11188064/ BUG=129187 TEST=none Review URL: https://chromiumcodereview.appspot.com/11358090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168074 0039d316-1c4b-4281-b951-d872f2087c98 --- win8/metro_driver/chrome_app_view_ash.cc | 21 +++++++++++++++++++++ win8/metro_driver/chrome_app_view_ash.h | 4 ++++ 2 files changed, 25 insertions(+) (limited to 'win8') diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index e9a9363..2214185 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -40,6 +40,10 @@ typedef winfoundtn::ITypedEventHandler< winui::Core::CoreWindow*, winui::Core::CharacterReceivedEventArgs*> CharEventHandler; +typedef winfoundtn::ITypedEventHandler< + winui::Core::CoreWindow*, + winui::Core::VisibilityChangedEventArgs*> VisibilityChangedHandler; + // This function is exported by chrome.exe. typedef int (__cdecl *BreakpadExceptionHandler)(EXCEPTION_POINTERS* info); @@ -283,6 +287,11 @@ ChromeAppViewAsh::SetWindow(winui::Core::ICoreWindow* window) { &character_received_token_); CheckHR(hr); + hr = window_->add_VisibilityChanged(mswr::Callback( + this, &ChromeAppViewAsh::OnVisibilityChanged).Get(), + &visibility_changed_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); @@ -488,6 +497,18 @@ HRESULT ChromeAppViewAsh::OnCharacterReceived( return S_OK; } +HRESULT ChromeAppViewAsh::OnVisibilityChanged( + winui::Core::ICoreWindow* sender, + winui::Core::IVisibilityChangedEventArgs* args) { + boolean visible = false; + HRESULT hr = args->get_Visible(&visible); + if (FAILED(hr)) + return hr; + + ui_channel_->Send(new MetroViewerHostMsg_VisibilityChanged(!!visible)); + return S_OK; +} + /////////////////////////////////////////////////////////////////////////////// diff --git a/win8/metro_driver/chrome_app_view_ash.h b/win8/metro_driver/chrome_app_view_ash.h index 886510c..1906297 100644 --- a/win8/metro_driver/chrome_app_view_ash.h +++ b/win8/metro_driver/chrome_app_view_ash.h @@ -56,6 +56,9 @@ class ChromeAppViewAsh HRESULT OnCharacterReceived(winui::Core::ICoreWindow* sender, winui::Core::ICharacterReceivedEventArgs* args); + HRESULT OnVisibilityChanged(winui::Core::ICoreWindow* sender, + winui::Core::IVisibilityChangedEventArgs* args); + mswr::ComPtr window_; mswr::ComPtr view_; EventRegistrationToken activated_token_; @@ -66,6 +69,7 @@ class ChromeAppViewAsh EventRegistrationToken keydown_token_; EventRegistrationToken keyup_token_; EventRegistrationToken character_received_token_; + EventRegistrationToken visibility_changed_token_; metro_driver::Direct3DHelper direct3d_helper_; -- cgit v1.1