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