summaryrefslogtreecommitdiffstats
path: root/win8/metro_driver
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-18 23:30:59 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-18 23:30:59 +0000
commit9036babe3679effab6558c5e258a3fc4bbc185d1 (patch)
treea916619a0c1a8887c929de4d0065fc996a95ccc7 /win8/metro_driver
parente47b0a0a7a9d3bbc440df8a1c554fec81ea9f6a1 (diff)
downloadchromium_src-9036babe3679effab6558c5e258a3fc4bbc185d1.zip
chromium_src-9036babe3679effab6558c5e258a3fc4bbc185d1.tar.gz
chromium_src-9036babe3679effab6558c5e258a3fc4bbc185d1.tar.bz2
Add edge gesture so you can easily go from fullscreen and back. Currently you can go into fullscreen via he wrench menu but cannot go out of fullscreen because the edge allowance is not enough.
This btw the same behavior we have since m26 for metro. BUG=174738 Review URL: https://codereview.chromium.org/73063002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235844 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8/metro_driver')
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc31
-rw-r--r--win8/metro_driver/chrome_app_view_ash.h4
2 files changed, 35 insertions, 0 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index 654e82d..3eae110 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -56,6 +56,10 @@ typedef winfoundtn::ITypedEventHandler<
winui::Core::CoreWindow*,
winui::Core::WindowSizeChangedEventArgs*> SizeChangedHandler;
+typedef winfoundtn::ITypedEventHandler<
+ winui::Input::EdgeGesture*,
+ winui::Input::EdgeGestureEventArgs*> EdgeEventHandler;
+
// This function is exported by chrome.exe.
typedef int (__cdecl *BreakpadExceptionHandler)(EXCEPTION_POINTERS* info);
@@ -530,6 +534,22 @@ ChromeAppViewAsh::SetWindow(winui::Core::ICoreWindow* window) {
&window_activated_token_);
CheckHR(hr);
+ // Register for edge gesture notifications.
+ mswr::ComPtr<winui::Input::IEdgeGestureStatics> edge_gesture_statics;
+ hr = winrt_utils::CreateActivationFactory(
+ RuntimeClass_Windows_UI_Input_EdgeGesture,
+ edge_gesture_statics.GetAddressOf());
+ CheckHR(hr);
+
+ mswr::ComPtr<winui::Input::IEdgeGesture> edge_gesture;
+ hr = edge_gesture_statics->GetForCurrentView(&edge_gesture);
+ CheckHR(hr);
+
+ hr = edge_gesture->add_Completed(mswr::Callback<EdgeEventHandler>(
+ this, &ChromeAppViewAsh::OnEdgeGestureCompleted).Get(),
+ &edgeevent_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);
@@ -1066,6 +1086,17 @@ HRESULT ChromeAppViewAsh::HandleProtocolRequest(
return S_OK;
}
+HRESULT ChromeAppViewAsh::OnEdgeGestureCompleted(
+ winui::Input::IEdgeGesture* gesture,
+ winui::Input::IEdgeGestureEventArgs* args) {
+ // Swipe from edge gesture (and win+z) is equivalent to pressing F11.
+ // TODO(cpu): Make this cleaner for m33.
+ ui_channel_->Send(new MetroViewerHostMsg_KeyDown(VK_F11, 1, 0, 0));
+ ::Sleep(15);
+ ui_channel_->Send(new MetroViewerHostMsg_KeyUp(VK_F11, 1, 0, 0));
+ return S_OK;
+}
+
void ChromeAppViewAsh::OnSearchRequest(const string16& search_string) {
DCHECK(ui_channel_);
ui_channel_->Send(new MetroViewerHostMsg_SearchRequest(search_string));
diff --git a/win8/metro_driver/chrome_app_view_ash.h b/win8/metro_driver/chrome_app_view_ash.h
index a393365..9efd3f7 100644
--- a/win8/metro_driver/chrome_app_view_ash.h
+++ b/win8/metro_driver/chrome_app_view_ash.h
@@ -121,6 +121,9 @@ class ChromeAppViewAsh
// Helper to handle http/https url requests in ASH.
HRESULT HandleProtocolRequest(winapp::Activation::IActivatedEventArgs* args);
+ HRESULT OnEdgeGestureCompleted(winui::Input::IEdgeGesture* gesture,
+ winui::Input::IEdgeGestureEventArgs* args);
+
// Tasks posted to the UI thread to initiate the search/url navigation
// requests.
void OnSearchRequest(const string16& search_string);
@@ -143,6 +146,7 @@ class ChromeAppViewAsh
EventRegistrationToken accel_keyup_token_;
EventRegistrationToken window_activated_token_;
EventRegistrationToken sizechange_token_;
+ EventRegistrationToken edgeevent_token_;
// Keep state about which button is currently down, if any, as PointerMoved
// events do not contain that state, but Ash's MouseEvents need it.