summaryrefslogtreecommitdiffstats
path: root/win8
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-15 23:33:44 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-15 23:33:44 +0000
commitcbafd1cf102678418fbe04bf170d3e05ffc92af0 (patch)
tree0a2827e07ccc7353546263c83e55fcb0539c8088 /win8
parent14eba181af0099a979068beb456570104e0739b8 (diff)
downloadchromium_src-cbafd1cf102678418fbe04bf170d3e05ffc92af0.zip
chromium_src-cbafd1cf102678418fbe04bf170d3e05ffc92af0.tar.gz
chromium_src-cbafd1cf102678418fbe04bf170d3e05ffc92af0.tar.bz2
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
Diffstat (limited to 'win8')
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc21
-rw-r--r--win8/metro_driver/chrome_app_view_ash.h4
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 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<VisibilityChangedHandler>(
+ 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<winui::Core::ICoreWindow> window_;
mswr::ComPtr<winapp::Core::ICoreApplicationView> 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_;