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 WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ | 5 #ifndef WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ |
6 #define WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ | 6 #define WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_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 "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "ui/base/events/event_constants.h" | 15 #include "ui/base/events/event_constants.h" |
16 #include "win8/metro_driver/direct3d_helper.h" | 16 #include "win8/metro_driver/direct3d_helper.h" |
17 | 17 |
18 namespace IPC { | 18 namespace IPC { |
19 class Listener; | 19 class Listener; |
20 class ChannelProxy; | 20 class ChannelProxy; |
21 } | 21 } |
22 | 22 |
23 class OpenFilePickerSession; | 23 class OpenFilePickerSession; |
24 class SaveFilePickerSession; | 24 class SaveFilePickerSession; |
| 25 class FolderPickerSession; |
| 26 class FilePickerSessionBase; |
25 | 27 |
26 struct MetroViewerHostMsg_SaveAsDialogParams; | 28 struct MetroViewerHostMsg_SaveAsDialogParams; |
27 | 29 |
28 class ChromeAppViewAsh | 30 class ChromeAppViewAsh |
29 : public mswr::RuntimeClass<winapp::Core::IFrameworkView> { | 31 : public mswr::RuntimeClass<winapp::Core::IFrameworkView> { |
30 public: | 32 public: |
31 ChromeAppViewAsh(); | 33 ChromeAppViewAsh(); |
32 ~ChromeAppViewAsh(); | 34 ~ChromeAppViewAsh(); |
33 | 35 |
34 // IViewProvider overrides. | 36 // IViewProvider overrides. |
35 IFACEMETHOD(Initialize)(winapp::Core::ICoreApplicationView* view); | 37 IFACEMETHOD(Initialize)(winapp::Core::ICoreApplicationView* view); |
36 IFACEMETHOD(SetWindow)(winui::Core::ICoreWindow* window); | 38 IFACEMETHOD(SetWindow)(winui::Core::ICoreWindow* window); |
37 IFACEMETHOD(Load)(HSTRING entryPoint); | 39 IFACEMETHOD(Load)(HSTRING entryPoint); |
38 IFACEMETHOD(Run)(); | 40 IFACEMETHOD(Run)(); |
39 IFACEMETHOD(Uninitialize)(); | 41 IFACEMETHOD(Uninitialize)(); |
40 | 42 |
41 // Helper function to unsnap the chrome metro app if it is snapped. | 43 // Helper function to unsnap the chrome metro app if it is snapped. |
42 // Returns S_OK on success. | 44 // Returns S_OK on success. |
43 static HRESULT Unsnap(); | 45 static HRESULT Unsnap(); |
44 | 46 |
45 void OnSetCursor(HCURSOR cursor); | 47 void OnSetCursor(HCURSOR cursor); |
46 void OnDisplayFileOpenDialog(const string16& title, | 48 void OnDisplayFileOpenDialog(const string16& title, |
47 const string16& filter, | 49 const string16& filter, |
48 const string16& default_path, | 50 const string16& default_path, |
49 bool allow_multiple_files); | 51 bool allow_multiple_files); |
50 void OnDisplayFileSaveAsDialog( | 52 void OnDisplayFileSaveAsDialog( |
51 const MetroViewerHostMsg_SaveAsDialogParams& params); | 53 const MetroViewerHostMsg_SaveAsDialogParams& params); |
| 54 void OnDisplayFolderPicker(const string16& title); |
52 | 55 |
53 // This function is invoked when the open file operation completes. The | 56 // This function is invoked when the open file operation completes. The |
54 // result of the operation is passed in along with the OpenFilePickerSession | 57 // result of the operation is passed in along with the OpenFilePickerSession |
55 // instance which is deleted after we read the required information from | 58 // instance which is deleted after we read the required information from |
56 // the OpenFilePickerSession class. | 59 // the OpenFilePickerSession class. |
57 void OnOpenFileCompleted(OpenFilePickerSession* open_file_picker, | 60 void OnOpenFileCompleted(OpenFilePickerSession* open_file_picker, |
58 bool success); | 61 bool success); |
59 | 62 |
60 // This function is invoked when the save file operation completes. The | 63 // This function is invoked when the save file operation completes. The |
61 // result of the operation is passed in along with the SaveFilePickerSession | 64 // result of the operation is passed in along with the SaveFilePickerSession |
62 // instance which is deleted after we read the required information from | 65 // instance which is deleted after we read the required information from |
63 // the SaveFilePickerSession class. | 66 // the SaveFilePickerSession class. |
64 void OnSaveFileCompleted(SaveFilePickerSession* save_file_picker, | 67 void OnSaveFileCompleted(SaveFilePickerSession* save_file_picker, |
65 bool success); | 68 bool success); |
66 | 69 |
| 70 // This function is invoked when the folder picker operation completes. The |
| 71 // result of the operation is passed in along with the FolderPickerSession |
| 72 // instance which is deleted after we read the required information from |
| 73 // the FolderPickerSession class. |
| 74 void OnFolderPickerCompleted(FolderPickerSession* folder_picker, |
| 75 bool success); |
| 76 |
67 private: | 77 private: |
68 HRESULT OnActivate(winapp::Core::ICoreApplicationView* view, | 78 HRESULT OnActivate(winapp::Core::ICoreApplicationView* view, |
69 winapp::Activation::IActivatedEventArgs* args); | 79 winapp::Activation::IActivatedEventArgs* args); |
70 | 80 |
71 HRESULT OnPointerMoved(winui::Core::ICoreWindow* sender, | 81 HRESULT OnPointerMoved(winui::Core::ICoreWindow* sender, |
72 winui::Core::IPointerEventArgs* args); | 82 winui::Core::IPointerEventArgs* args); |
73 | 83 |
74 HRESULT OnPointerPressed(winui::Core::ICoreWindow* sender, | 84 HRESULT OnPointerPressed(winui::Core::ICoreWindow* sender, |
75 winui::Core::IPointerEventArgs* args); | 85 winui::Core::IPointerEventArgs* args); |
76 | 86 |
(...skipping 25 matching lines...) Expand all Loading... |
102 EventRegistrationToken pointermoved_token_; | 112 EventRegistrationToken pointermoved_token_; |
103 EventRegistrationToken pointerpressed_token_; | 113 EventRegistrationToken pointerpressed_token_; |
104 EventRegistrationToken pointerreleased_token_; | 114 EventRegistrationToken pointerreleased_token_; |
105 EventRegistrationToken wheel_token_; | 115 EventRegistrationToken wheel_token_; |
106 EventRegistrationToken keydown_token_; | 116 EventRegistrationToken keydown_token_; |
107 EventRegistrationToken keyup_token_; | 117 EventRegistrationToken keyup_token_; |
108 EventRegistrationToken character_received_token_; | 118 EventRegistrationToken character_received_token_; |
109 EventRegistrationToken visibility_changed_token_; | 119 EventRegistrationToken visibility_changed_token_; |
110 EventRegistrationToken accel_keydown_token_; | 120 EventRegistrationToken accel_keydown_token_; |
111 EventRegistrationToken accel_keyup_token_; | 121 EventRegistrationToken accel_keyup_token_; |
| 122 EventRegistrationToken window_activated_token_; |
112 | 123 |
113 // Keep state about which button is currently down, if any, as PointerMoved | 124 // Keep state about which button is currently down, if any, as PointerMoved |
114 // events do not contain that state, but Ash's MouseEvents need it. | 125 // events do not contain that state, but Ash's MouseEvents need it. |
115 ui::EventFlags mouse_down_flags_; | 126 ui::EventFlags mouse_down_flags_; |
116 | 127 |
117 // Set the D3D swap chain and nothing else. | 128 // Set the D3D swap chain and nothing else. |
118 metro_driver::Direct3DHelper direct3d_helper_; | 129 metro_driver::Direct3DHelper direct3d_helper_; |
119 | 130 |
120 // The channel to Chrome, in particular to the MetroViewerProcessHost. | 131 // The channel to Chrome, in particular to the MetroViewerProcessHost. |
121 IPC::ChannelProxy* ui_channel_; | 132 IPC::ChannelProxy* ui_channel_; |
122 | 133 |
123 // The actual window behind the view surface. | 134 // The actual window behind the view surface. |
124 HWND core_window_hwnd_; | 135 HWND core_window_hwnd_; |
125 }; | 136 }; |
126 | 137 |
127 #endif // WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ | 138 #endif // WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ |
OLD | NEW |