| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_METRO_DRIVER_CHROME_APP_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_METRO_DRIVER_CHROME_APP_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_METRO_DRIVER_CHROME_APP_VIEW_H_ | 6 #define CHROME_BROWSER_UI_METRO_DRIVER_CHROME_APP_VIEW_H_ |
| 7 | 7 |
| 8 #include <windows.applicationmodel.core.h> | 8 #include <windows.applicationmodel.core.h> |
| 9 #include <windows.ui.core.h> | 9 #include <windows.ui.core.h> |
| 10 #include <windows.ui.input.h> | 10 #include <windows.ui.input.h> |
| 11 #include <windows.ui.viewmanagement.h> | 11 #include <windows.ui.viewmanagement.h> |
| 12 | 12 |
| 13 #include <list> | 13 #include <list> |
| 14 #include <map> | 14 #include <map> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <utility> | 16 #include <utility> |
| 17 | 17 |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
| 20 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
| 21 #include "win8/metro_driver/chrome_url_launch_handler.h" | 21 #include "win8/metro_driver/chrome_url_launch_handler.h" |
| 22 #include "win8/metro_driver/devices_handler.h" | 22 #include "win8/metro_driver/devices_handler.h" |
| 23 #include "win8/metro_driver/direct3d_helper.h" | 23 #include "win8/metro_driver/direct3d_helper.h" |
| 24 #include "win8/metro_driver/metro_dialog_box.h" | 24 #include "win8/metro_driver/metro_dialog_box.h" |
| 25 #include "win8/metro_driver/settings_handler.h" | 25 #include "win8/metro_driver/settings_handler.h" |
| 26 #include "win8/metro_driver/toast_notification_handler.h" | 26 #include "win8/metro_driver/toast_notification_handler.h" |
| 27 | 27 |
| 28 namespace IPC { |
| 29 class Listener; |
| 30 class ChannelProxy; |
| 31 } |
| 32 |
| 28 class ChromeAppView | 33 class ChromeAppView |
| 29 : public mswr::RuntimeClass<winapp::Core::IFrameworkView> { | 34 : public mswr::RuntimeClass<winapp::Core::IFrameworkView> { |
| 30 public: | 35 public: |
| 31 ChromeAppView(); | 36 ChromeAppView(); |
| 32 ~ChromeAppView(); | 37 ~ChromeAppView(); |
| 33 | 38 |
| 34 // IViewProvider overrides. | 39 // IViewProvider overrides. |
| 35 IFACEMETHOD(Initialize)(winapp::Core::ICoreApplicationView* view); | 40 IFACEMETHOD(Initialize)(winapp::Core::ICoreApplicationView* view); |
| 36 IFACEMETHOD(SetWindow)(winui::Core::ICoreWindow* window); | 41 IFACEMETHOD(SetWindow)(winui::Core::ICoreWindow* window); |
| 37 IFACEMETHOD(Load)(HSTRING entryPoint); | 42 IFACEMETHOD(Load)(HSTRING entryPoint); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // Notification from chrome that a full screen operation is being performed. | 75 // Notification from chrome that a full screen operation is being performed. |
| 71 void SetFullscreen(bool fullscreen); | 76 void SetFullscreen(bool fullscreen); |
| 72 | 77 |
| 73 private: | 78 private: |
| 74 HRESULT OnActivate(winapp::Core::ICoreApplicationView* view, | 79 HRESULT OnActivate(winapp::Core::ICoreApplicationView* view, |
| 75 winapp::Activation::IActivatedEventArgs* args); | 80 winapp::Activation::IActivatedEventArgs* args); |
| 76 | 81 |
| 77 HRESULT OnSizeChanged(winui::Core::ICoreWindow* sender, | 82 HRESULT OnSizeChanged(winui::Core::ICoreWindow* sender, |
| 78 winui::Core::IWindowSizeChangedEventArgs* args); | 83 winui::Core::IWindowSizeChangedEventArgs* args); |
| 79 | 84 |
| 85 HRESULT OnPointerMoved(winui::Core::ICoreWindow* sender, |
| 86 winui::Core::IPointerEventArgs* args); |
| 87 |
| 88 HRESULT OnPointerPressed(winui::Core::ICoreWindow* sender, |
| 89 winui::Core::IPointerEventArgs* args); |
| 90 |
| 91 HRESULT OnPointerReleased(winui::Core::ICoreWindow* sender, |
| 92 winui::Core::IPointerEventArgs* args); |
| 93 |
| 80 HRESULT OnEdgeGestureCompleted(winui::Input::IEdgeGesture* gesture, | 94 HRESULT OnEdgeGestureCompleted(winui::Input::IEdgeGesture* gesture, |
| 81 winui::Input::IEdgeGestureEventArgs* args); | 95 winui::Input::IEdgeGestureEventArgs* args); |
| 82 | 96 |
| 83 HRESULT OnShareDataRequested( | 97 HRESULT OnShareDataRequested( |
| 84 winapp::DataTransfer::IDataTransferManager* data_transfer_mgr, | 98 winapp::DataTransfer::IDataTransferManager* data_transfer_mgr, |
| 85 winapp::DataTransfer::IDataRequestedEventArgs* event_args); | 99 winapp::DataTransfer::IDataRequestedEventArgs* event_args); |
| 86 | 100 |
| 87 HRESULT OnInputPaneVisible( | 101 HRESULT OnInputPaneVisible( |
| 88 winui::ViewManagement::IInputPane* input_pane, | 102 winui::ViewManagement::IInputPane* input_pane, |
| 89 winui::ViewManagement::IInputPaneVisibilityEventArgs* event_args); | 103 winui::ViewManagement::IInputPaneVisibilityEventArgs* event_args); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 103 | 117 |
| 104 mswr::ComPtr<winui::Core::ICoreWindow> window_; | 118 mswr::ComPtr<winui::Core::ICoreWindow> window_; |
| 105 mswr::ComPtr<winapp::Core::ICoreApplicationView> view_; | 119 mswr::ComPtr<winapp::Core::ICoreApplicationView> view_; |
| 106 EventRegistrationToken activated_token_; | 120 EventRegistrationToken activated_token_; |
| 107 EventRegistrationToken edgeevent_token_; | 121 EventRegistrationToken edgeevent_token_; |
| 108 EventRegistrationToken sizechange_token_; | 122 EventRegistrationToken sizechange_token_; |
| 109 EventRegistrationToken share_data_requested_token_; | 123 EventRegistrationToken share_data_requested_token_; |
| 110 EventRegistrationToken input_pane_visible_token_; | 124 EventRegistrationToken input_pane_visible_token_; |
| 111 EventRegistrationToken input_pane_hiding_token_; | 125 EventRegistrationToken input_pane_hiding_token_; |
| 112 EventRegistrationToken app_exit_token_; | 126 EventRegistrationToken app_exit_token_; |
| 127 EventRegistrationToken pointermoved_token_; |
| 128 EventRegistrationToken pointerpressed_token_; |
| 129 EventRegistrationToken pointerreleased_token_; |
| 113 | 130 |
| 114 ChromeUrlLaunchHandler url_launch_handler_; | 131 ChromeUrlLaunchHandler url_launch_handler_; |
| 115 metro_driver::DevicesHandler devices_handler_; | 132 metro_driver::DevicesHandler devices_handler_; |
| 116 SettingsHandler settings_handler_; | 133 SettingsHandler settings_handler_; |
| 117 mswr::ComPtr<winui::ViewManagement::IInputPane> input_pane_; | 134 mswr::ComPtr<winui::ViewManagement::IInputPane> input_pane_; |
| 118 mswr::ComPtr<winui::ViewManagement::IApplicationViewStatics> app_view_; | 135 mswr::ComPtr<winui::ViewManagement::IApplicationViewStatics> app_view_; |
| 119 | 136 |
| 120 bool osk_visible_notification_received_; | 137 bool osk_visible_notification_received_; |
| 121 | 138 |
| 122 // map of notification id to the ToastNotificationHandler instance. | 139 // map of notification id to the ToastNotificationHandler instance. |
| 123 typedef std::map<std::string, scoped_ptr<ToastNotificationHandler> > | 140 typedef std::map<std::string, scoped_ptr<ToastNotificationHandler> > |
| 124 NotificationMap; | 141 NotificationMap; |
| 125 NotificationMap notification_map_; | 142 NotificationMap notification_map_; |
| 126 | 143 |
| 127 // Synchronizes access to the notification_map_ member. | 144 // Synchronizes access to the notification_map_ member. |
| 128 base::Lock notification_lock_; | 145 base::Lock notification_lock_; |
| 129 | 146 |
| 130 // If the OSK covers the input area we scroll the window by the height of the | 147 // If the OSK covers the input area we scroll the window by the height of the |
| 131 // OSK + an additional offset. This member holds this offset. Set to 0 if the | 148 // OSK + an additional offset. This member holds this offset. Set to 0 if the |
| 132 // window was not scrolled. | 149 // window was not scrolled. |
| 133 int osk_offset_adjustment_; | 150 int osk_offset_adjustment_; |
| 134 | 151 |
| 135 MetroDialogBox dialog_box_; | 152 MetroDialogBox dialog_box_; |
| 136 | 153 |
| 137 metro_driver::Direct3DHelper direct3d_helper_; | 154 metro_driver::Direct3DHelper direct3d_helper_; |
| 155 |
| 156 IPC::Listener* ui_channel_listener_; |
| 157 IPC::ChannelProxy* ui_channel_; |
| 138 }; | 158 }; |
| 139 | 159 |
| 140 class ChromeAppViewFactory | 160 class ChromeAppViewFactory |
| 141 : public mswr::RuntimeClass<winapp::Core::IFrameworkViewSource> { | 161 : public mswr::RuntimeClass<winapp::Core::IFrameworkViewSource> { |
| 142 public: | 162 public: |
| 143 ChromeAppViewFactory(winapp::Core::ICoreApplication* icore_app, | 163 ChromeAppViewFactory(winapp::Core::ICoreApplication* icore_app, |
| 144 LPTHREAD_START_ROUTINE host_main, | 164 LPTHREAD_START_ROUTINE host_main, |
| 145 void* host_context); | 165 void* host_context); |
| 146 IFACEMETHOD(CreateView)(winapp::Core::IFrameworkView** view); | 166 IFACEMETHOD(CreateView)(winapp::Core::IFrameworkView** view); |
| 147 }; | 167 }; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 171 // to be initiated from that thread, notably spawning file pickers. | 191 // to be initiated from that thread, notably spawning file pickers. |
| 172 base::MessageLoopProxy* appview_msg_loop; | 192 base::MessageLoopProxy* appview_msg_loop; |
| 173 winapp::Core::ICoreApplicationExit* app_exit; | 193 winapp::Core::ICoreApplicationExit* app_exit; |
| 174 BreakpadExceptionHandler breakpad_exception_handler; | 194 BreakpadExceptionHandler breakpad_exception_handler; |
| 175 string16 metro_command_line_switches; | 195 string16 metro_command_line_switches; |
| 176 }; | 196 }; |
| 177 | 197 |
| 178 extern Globals globals; | 198 extern Globals globals; |
| 179 | 199 |
| 180 #endif // CHROME_BROWSER_UI_METRO_DRIVER_CHROME_APP_VIEW_H_ | 200 #endif // CHROME_BROWSER_UI_METRO_DRIVER_CHROME_APP_VIEW_H_ |
| OLD | NEW |