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 UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ | 5 #ifndef UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ |
6 #define UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ | 6 #define UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 typedef base::Callback<void(const base::FilePath&, int, void*)> | 32 typedef base::Callback<void(const base::FilePath&, int, void*)> |
33 OpenFileCompletion; | 33 OpenFileCompletion; |
34 | 34 |
35 typedef base::Callback<void(const std::vector<base::FilePath>&, void*)> | 35 typedef base::Callback<void(const std::vector<base::FilePath>&, void*)> |
36 OpenMultipleFilesCompletion; | 36 OpenMultipleFilesCompletion; |
37 | 37 |
38 typedef base::Callback<void(const base::FilePath&, int, void*)> | 38 typedef base::Callback<void(const base::FilePath&, int, void*)> |
39 SaveFileCompletion; | 39 SaveFileCompletion; |
40 | 40 |
| 41 typedef base::Callback<void(const base::FilePath&, int, void*)> |
| 42 SelectFolderCompletion; |
| 43 |
41 // Handles the open file operation for Metro Chrome Ash. The callback passed in | 44 // Handles the open file operation for Metro Chrome Ash. The callback passed in |
42 // is invoked when we receive the opened file name from the metro viewer. | 45 // is invoked when we receive the opened file name from the metro viewer. |
43 AURA_EXPORT void HandleOpenFile( | 46 AURA_EXPORT void HandleOpenFile( |
44 const string16& title, | 47 const string16& title, |
45 const base::FilePath& default_path, | 48 const base::FilePath& default_path, |
46 const string16& filter, | 49 const string16& filter, |
47 const OpenFileCompletion& callback); | 50 const OpenFileCompletion& callback); |
48 | 51 |
49 // Handles the open multiple file operation for Metro Chrome Ash. The callback | 52 // Handles the open multiple file operation for Metro Chrome Ash. The callback |
50 // passed in is invoked when we receive the opened file names from the metro | 53 // passed in is invoked when we receive the opened file names from the metro |
51 // viewer. | 54 // viewer. |
52 AURA_EXPORT void HandleOpenMultipleFiles( | 55 AURA_EXPORT void HandleOpenMultipleFiles( |
53 const string16& title, | 56 const string16& title, |
54 const base::FilePath& default_path, | 57 const base::FilePath& default_path, |
55 const string16& filter, | 58 const string16& filter, |
56 const OpenMultipleFilesCompletion& callback); | 59 const OpenMultipleFilesCompletion& callback); |
57 | 60 |
58 // Handles the save file operation for Metro Chrome Ash. The callback passed in | 61 // Handles the save file operation for Metro Chrome Ash. The callback passed in |
59 // is invoked when we receive the saved file name from the metro viewer. | 62 // is invoked when we receive the saved file name from the metro viewer. |
60 AURA_EXPORT void HandleSaveFile( | 63 AURA_EXPORT void HandleSaveFile( |
61 const string16& title, | 64 const string16& title, |
62 const base::FilePath& default_path, | 65 const base::FilePath& default_path, |
63 const string16& filter, | 66 const string16& filter, |
64 int filter_index, | 67 int filter_index, |
65 const string16& default_extension, | 68 const string16& default_extension, |
66 const SaveFileCompletion& callback); | 69 const SaveFileCompletion& callback); |
67 | 70 |
| 71 // Handles the select folder for Metro Chrome Ash. The callback passed in |
| 72 // is invoked when we receive the folder name from the metro viewer. |
| 73 AURA_EXPORT void HandleSelectFolder(const string16& title, |
| 74 const SelectFolderCompletion& callback); |
68 | 75 |
69 // RootWindowHost implementaton that receives events from a different | 76 // RootWindowHost implementaton that receives events from a different |
70 // process. In the case of Windows this is the Windows 8 (aka Metro) | 77 // process. In the case of Windows this is the Windows 8 (aka Metro) |
71 // frontend process, which forwards input events to this class. | 78 // frontend process, which forwards input events to this class. |
72 class AURA_EXPORT RemoteRootWindowHostWin : public RootWindowHost { | 79 class AURA_EXPORT RemoteRootWindowHostWin : public RootWindowHost { |
73 public: | 80 public: |
74 static RemoteRootWindowHostWin* Instance(); | 81 static RemoteRootWindowHostWin* Instance(); |
75 static RemoteRootWindowHostWin* Create(const gfx::Rect& bounds); | 82 static RemoteRootWindowHostWin* Create(const gfx::Rect& bounds); |
76 | 83 |
77 // Called when the remote process has established its IPC connection. | 84 // Called when the remote process has established its IPC connection. |
(...skipping 18 matching lines...) Expand all Loading... |
96 const OpenMultipleFilesCompletion& callback); | 103 const OpenMultipleFilesCompletion& callback); |
97 | 104 |
98 void HandleSaveFile( | 105 void HandleSaveFile( |
99 const string16& title, | 106 const string16& title, |
100 const base::FilePath& default_path, | 107 const base::FilePath& default_path, |
101 const string16& filter, | 108 const string16& filter, |
102 int filter_index, | 109 int filter_index, |
103 const string16& default_extension, | 110 const string16& default_extension, |
104 const SaveFileCompletion& callback); | 111 const SaveFileCompletion& callback); |
105 | 112 |
| 113 void HandleSelectFolder(const string16& title, |
| 114 const SelectFolderCompletion& callback); |
| 115 |
106 private: | 116 private: |
107 explicit RemoteRootWindowHostWin(const gfx::Rect& bounds); | 117 explicit RemoteRootWindowHostWin(const gfx::Rect& bounds); |
108 virtual ~RemoteRootWindowHostWin(); | 118 virtual ~RemoteRootWindowHostWin(); |
109 | 119 |
110 // IPC message handing methods: | 120 // IPC message handing methods: |
111 void OnMouseMoved(int32 x, int32 y, int32 flags); | 121 void OnMouseMoved(int32 x, int32 y, int32 flags); |
112 void OnMouseButton(int32 x, | 122 void OnMouseButton(int32 x, |
113 int32 y, | 123 int32 y, |
114 int32 extra, | 124 int32 extra, |
115 ui::EventType type, | 125 ui::EventType type, |
116 ui::EventFlags flags); | 126 ui::EventFlags flags); |
117 void OnKeyDown(uint32 vkey, | 127 void OnKeyDown(uint32 vkey, |
118 uint32 repeat_count, | 128 uint32 repeat_count, |
119 uint32 scan_code, | 129 uint32 scan_code, |
120 uint32 flags); | 130 uint32 flags); |
121 void OnKeyUp(uint32 vkey, | 131 void OnKeyUp(uint32 vkey, |
122 uint32 repeat_count, | 132 uint32 repeat_count, |
123 uint32 scan_code, | 133 uint32 scan_code, |
124 uint32 flags); | 134 uint32 flags); |
125 void OnChar(uint32 key_code, | 135 void OnChar(uint32 key_code, |
126 uint32 repeat_count, | 136 uint32 repeat_count, |
127 uint32 scan_code, | 137 uint32 scan_code, |
128 uint32 flags); | 138 uint32 flags); |
129 void OnVisibilityChanged(bool visible); | 139 void OnVisibilityChanged(bool visible); |
130 void OnTouchDown(int32 x, int32 y, uint64 timestamp, uint32 pointer_id); | 140 void OnTouchDown(int32 x, int32 y, uint64 timestamp, uint32 pointer_id); |
131 void OnTouchUp(int32 x, int32 y, uint64 timestamp, uint32 pointer_id); | 141 void OnTouchUp(int32 x, int32 y, uint64 timestamp, uint32 pointer_id); |
132 void OnTouchMoved(int32 x, int32 y, uint64 timestamp, uint32 pointer_id); | 142 void OnTouchMoved(int32 x, int32 y, uint64 timestamp, uint32 pointer_id); |
133 void OnFileSaveAsDone(bool success, | 143 void OnFileSaveAsDone(bool success, |
134 string16 filename, | 144 const base::FilePath& filename, |
135 int filter_index); | 145 int filter_index); |
136 void OnFileOpenDone(bool success, string16 filename); | 146 void OnFileOpenDone(bool success, const base::FilePath& filename); |
137 void OnMultiFileOpenDone(bool success, | 147 void OnMultiFileOpenDone(bool success, |
138 const std::vector<base::FilePath>& files); | 148 const std::vector<base::FilePath>& files); |
139 | 149 void OnSelectFolderDone(bool success, const base::FilePath& folder); |
140 // RootWindowHost overrides: | 150 // RootWindowHost overrides: |
141 virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE; | 151 virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE; |
142 virtual RootWindow* GetRootWindow() OVERRIDE; | 152 virtual RootWindow* GetRootWindow() OVERRIDE; |
143 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 153 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
144 virtual void Show() OVERRIDE; | 154 virtual void Show() OVERRIDE; |
145 virtual void Hide() OVERRIDE; | 155 virtual void Hide() OVERRIDE; |
146 virtual void ToggleFullScreen() OVERRIDE; | 156 virtual void ToggleFullScreen() OVERRIDE; |
147 virtual gfx::Rect GetBounds() const OVERRIDE; | 157 virtual gfx::Rect GetBounds() const OVERRIDE; |
148 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 158 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
149 virtual gfx::Insets GetInsets() const OVERRIDE; | 159 virtual gfx::Insets GetInsets() const OVERRIDE; |
(...skipping 28 matching lines...) Expand all Loading... |
178 uint32 repeat_count, | 188 uint32 repeat_count, |
179 uint32 scan_code, | 189 uint32 scan_code, |
180 uint32 flags, | 190 uint32 flags, |
181 bool is_character); | 191 bool is_character); |
182 | 192 |
183 RootWindowHostDelegate* delegate_; | 193 RootWindowHostDelegate* delegate_; |
184 IPC::Sender* host_; | 194 IPC::Sender* host_; |
185 scoped_ptr<ui::ViewProp> prop_; | 195 scoped_ptr<ui::ViewProp> prop_; |
186 | 196 |
187 // Saved callbacks which inform the caller about the result of the open file/ | 197 // Saved callbacks which inform the caller about the result of the open file/ |
188 // save file operations. | 198 // save file/select operations. |
189 OpenFileCompletion file_open_completion_callback_; | 199 OpenFileCompletion file_open_completion_callback_; |
190 OpenMultipleFilesCompletion multi_file_open_completion_callback_; | 200 OpenMultipleFilesCompletion multi_file_open_completion_callback_; |
191 SaveFileCompletion file_saveas_completion_callback_; | 201 SaveFileCompletion file_saveas_completion_callback_; |
| 202 SelectFolderCompletion select_folder_completion_callback_; |
192 | 203 |
193 DISALLOW_COPY_AND_ASSIGN(RemoteRootWindowHostWin); | 204 DISALLOW_COPY_AND_ASSIGN(RemoteRootWindowHostWin); |
194 }; | 205 }; |
195 | 206 |
196 } // namespace aura | 207 } // namespace aura |
197 | 208 |
198 #endif // UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ | 209 #endif // UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ |
OLD | NEW |