Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: win8/metro_driver/chrome_app_view_ash.cc

Issue 73063002: Adds swipe edge gesture to metro Ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « win8/metro_driver/chrome_app_view_ash.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "win8/metro_driver/stdafx.h" 5 #include "win8/metro_driver/stdafx.h"
6 #include "win8/metro_driver/chrome_app_view_ash.h" 6 #include "win8/metro_driver/chrome_app_view_ash.h"
7 7
8 #include <corewindow.h> 8 #include <corewindow.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <windows.foundation.h> 10 #include <windows.foundation.h>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 winui::Core::CharacterReceivedEventArgs*> CharEventHandler; 49 winui::Core::CharacterReceivedEventArgs*> CharEventHandler;
50 50
51 typedef winfoundtn::ITypedEventHandler< 51 typedef winfoundtn::ITypedEventHandler<
52 winui::Core::CoreWindow*, 52 winui::Core::CoreWindow*,
53 winui::Core::WindowActivatedEventArgs*> WindowActivatedHandler; 53 winui::Core::WindowActivatedEventArgs*> WindowActivatedHandler;
54 54
55 typedef winfoundtn::ITypedEventHandler< 55 typedef winfoundtn::ITypedEventHandler<
56 winui::Core::CoreWindow*, 56 winui::Core::CoreWindow*,
57 winui::Core::WindowSizeChangedEventArgs*> SizeChangedHandler; 57 winui::Core::WindowSizeChangedEventArgs*> SizeChangedHandler;
58 58
59 typedef winfoundtn::ITypedEventHandler<
60 winui::Input::EdgeGesture*,
61 winui::Input::EdgeGestureEventArgs*> EdgeEventHandler;
62
59 // This function is exported by chrome.exe. 63 // This function is exported by chrome.exe.
60 typedef int (__cdecl *BreakpadExceptionHandler)(EXCEPTION_POINTERS* info); 64 typedef int (__cdecl *BreakpadExceptionHandler)(EXCEPTION_POINTERS* info);
61 65
62 // Global information used across the metro driver. 66 // Global information used across the metro driver.
63 struct Globals { 67 struct Globals {
64 winapp::Activation::ApplicationExecutionState previous_state; 68 winapp::Activation::ApplicationExecutionState previous_state;
65 winapp::Core::ICoreApplicationExit* app_exit; 69 winapp::Core::ICoreApplicationExit* app_exit;
66 BreakpadExceptionHandler breakpad_exception_handler; 70 BreakpadExceptionHandler breakpad_exception_handler;
67 } globals; 71 } globals;
68 72
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 hr = window_->add_CharacterReceived(mswr::Callback<CharEventHandler>( 527 hr = window_->add_CharacterReceived(mswr::Callback<CharEventHandler>(
524 this, &ChromeAppViewAsh::OnCharacterReceived).Get(), 528 this, &ChromeAppViewAsh::OnCharacterReceived).Get(),
525 &character_received_token_); 529 &character_received_token_);
526 CheckHR(hr); 530 CheckHR(hr);
527 531
528 hr = window_->add_Activated(mswr::Callback<WindowActivatedHandler>( 532 hr = window_->add_Activated(mswr::Callback<WindowActivatedHandler>(
529 this, &ChromeAppViewAsh::OnWindowActivated).Get(), 533 this, &ChromeAppViewAsh::OnWindowActivated).Get(),
530 &window_activated_token_); 534 &window_activated_token_);
531 CheckHR(hr); 535 CheckHR(hr);
532 536
537 // Register for edge gesture notifications.
538 mswr::ComPtr<winui::Input::IEdgeGestureStatics> edge_gesture_statics;
539 hr = winrt_utils::CreateActivationFactory(
540 RuntimeClass_Windows_UI_Input_EdgeGesture,
541 edge_gesture_statics.GetAddressOf());
542 CheckHR(hr);
543
544 mswr::ComPtr<winui::Input::IEdgeGesture> edge_gesture;
545 hr = edge_gesture_statics->GetForCurrentView(&edge_gesture);
546 CheckHR(hr);
547
548 hr = edge_gesture->add_Completed(mswr::Callback<EdgeEventHandler>(
549 this, &ChromeAppViewAsh::OnEdgeGestureCompleted).Get(),
550 &edgeevent_token_);
551 CheckHR(hr);
552
533 // By initializing the direct 3D swap chain with the corewindow 553 // By initializing the direct 3D swap chain with the corewindow
534 // we can now directly blit to it from the browser process. 554 // we can now directly blit to it from the browser process.
535 direct3d_helper_.Initialize(window); 555 direct3d_helper_.Initialize(window);
536 DVLOG(1) << "Initialized Direct3D."; 556 DVLOG(1) << "Initialized Direct3D.";
537 return S_OK; 557 return S_OK;
538 } 558 }
539 559
540 IFACEMETHODIMP 560 IFACEMETHODIMP
541 ChromeAppViewAsh::Load(HSTRING entryPoint) { 561 ChromeAppViewAsh::Load(HSTRING entryPoint) {
542 DVLOG(1) << __FUNCTION__; 562 DVLOG(1) << __FUNCTION__;
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 string16 actual_url(MakeStdWString(url.Get())); 1079 string16 actual_url(MakeStdWString(url.Get()));
1060 DVLOG(1) << "Received url request: " << actual_url; 1080 DVLOG(1) << "Received url request: " << actual_url;
1061 1081
1062 ui_loop_.PostTask(FROM_HERE, 1082 ui_loop_.PostTask(FROM_HERE,
1063 base::Bind(&ChromeAppViewAsh::OnNavigateToUrl, 1083 base::Bind(&ChromeAppViewAsh::OnNavigateToUrl,
1064 base::Unretained(this), 1084 base::Unretained(this),
1065 actual_url)); 1085 actual_url));
1066 return S_OK; 1086 return S_OK;
1067 } 1087 }
1068 1088
1089 HRESULT ChromeAppViewAsh::OnEdgeGestureCompleted(
1090 winui::Input::IEdgeGesture* gesture,
1091 winui::Input::IEdgeGestureEventArgs* args) {
1092 // Swipe from edge gesture (and win+z) is equivalent to pressing F11.
1093 // TODO(cpu): Make this cleaner for m33.
1094 ui_channel_->Send(new MetroViewerHostMsg_KeyDown(VK_F11, 1, 0, 0));
1095 ::Sleep(15);
1096 ui_channel_->Send(new MetroViewerHostMsg_KeyUp(VK_F11, 1, 0, 0));
1097 return S_OK;
1098 }
1099
1069 void ChromeAppViewAsh::OnSearchRequest(const string16& search_string) { 1100 void ChromeAppViewAsh::OnSearchRequest(const string16& search_string) {
1070 DCHECK(ui_channel_); 1101 DCHECK(ui_channel_);
1071 ui_channel_->Send(new MetroViewerHostMsg_SearchRequest(search_string)); 1102 ui_channel_->Send(new MetroViewerHostMsg_SearchRequest(search_string));
1072 } 1103 }
1073 1104
1074 void ChromeAppViewAsh::OnNavigateToUrl(const string16& url) { 1105 void ChromeAppViewAsh::OnNavigateToUrl(const string16& url) {
1075 DCHECK(ui_channel_); 1106 DCHECK(ui_channel_);
1076 ui_channel_->Send(new MetroViewerHostMsg_OpenURL(url)); 1107 ui_channel_->Send(new MetroViewerHostMsg_OpenURL(url));
1077 } 1108 }
1078 1109
(...skipping 26 matching lines...) Expand all
1105 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; 1136 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit;
1106 CheckHR(core_app.As(&app_exit)); 1137 CheckHR(core_app.As(&app_exit));
1107 globals.app_exit = app_exit.Detach(); 1138 globals.app_exit = app_exit.Detach();
1108 } 1139 }
1109 1140
1110 IFACEMETHODIMP 1141 IFACEMETHODIMP
1111 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { 1142 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) {
1112 *view = mswr::Make<ChromeAppViewAsh>().Detach(); 1143 *view = mswr::Make<ChromeAppViewAsh>().Detach();
1113 return (*view) ? S_OK : E_OUTOFMEMORY; 1144 return (*view) ? S_OK : E_OUTOFMEMORY;
1114 } 1145 }
OLDNEW
« no previous file with comments | « win8/metro_driver/chrome_app_view_ash.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698