| 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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "ui/aura/root_window_host.h" | 13 #include "ui/aura/root_window_host.h" |
| 14 #include "ui/base/events/event_constants.h" | 14 #include "ui/base/events/event_constants.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 16 | 16 |
| 17 namespace base { |
| 17 class FilePath; | 18 class FilePath; |
| 19 } |
| 18 | 20 |
| 19 namespace ui { | 21 namespace ui { |
| 20 class ViewProp; | 22 class ViewProp; |
| 21 } | 23 } |
| 22 | 24 |
| 23 namespace IPC { | 25 namespace IPC { |
| 24 class Message; | 26 class Message; |
| 25 class Sender; | 27 class Sender; |
| 26 } | 28 } |
| 27 | 29 |
| 28 namespace aura { | 30 namespace aura { |
| 29 | 31 |
| 30 typedef base::Callback<void(const FilePath&, int, void*)> | 32 typedef base::Callback<void(const base::FilePath&, int, void*)> |
| 31 OpenFileCompletion; | 33 OpenFileCompletion; |
| 32 | 34 |
| 33 typedef base::Callback<void(const std::vector<FilePath>&, void*)> | 35 typedef base::Callback<void(const std::vector<base::FilePath>&, void*)> |
| 34 OpenMultipleFilesCompletion; | 36 OpenMultipleFilesCompletion; |
| 35 | 37 |
| 36 typedef base::Callback<void(const FilePath&, int, void*)> | 38 typedef base::Callback<void(const base::FilePath&, int, void*)> |
| 37 SaveFileCompletion; | 39 SaveFileCompletion; |
| 38 | 40 |
| 39 // Handles the open file operation for Metro Chrome Ash. The callback passed in | 41 // Handles the open file operation for Metro Chrome Ash. The callback passed in |
| 40 // is invoked when we receive the opened file name from the metro viewer. | 42 // is invoked when we receive the opened file name from the metro viewer. |
| 41 AURA_EXPORT void HandleOpenFile( | 43 AURA_EXPORT void HandleOpenFile( |
| 42 const string16& title, | 44 const string16& title, |
| 43 const FilePath& default_path, | 45 const base::FilePath& default_path, |
| 44 const string16& filter, | 46 const string16& filter, |
| 45 const OpenFileCompletion& callback); | 47 const OpenFileCompletion& callback); |
| 46 | 48 |
| 47 // Handles the open multiple file operation for Metro Chrome Ash. The callback | 49 // Handles the open multiple file operation for Metro Chrome Ash. The callback |
| 48 // passed in is invoked when we receive the opened file names from the metro | 50 // passed in is invoked when we receive the opened file names from the metro |
| 49 // viewer. | 51 // viewer. |
| 50 AURA_EXPORT void HandleOpenMultipleFiles( | 52 AURA_EXPORT void HandleOpenMultipleFiles( |
| 51 const string16& title, | 53 const string16& title, |
| 52 const FilePath& default_path, | 54 const base::FilePath& default_path, |
| 53 const string16& filter, | 55 const string16& filter, |
| 54 const OpenMultipleFilesCompletion& callback); | 56 const OpenMultipleFilesCompletion& callback); |
| 55 | 57 |
| 56 // Handles the save file operation for Metro Chrome Ash. The callback passed in | 58 // Handles the save file operation for Metro Chrome Ash. The callback passed in |
| 57 // is invoked when we receive the saved file name from the metro viewer. | 59 // is invoked when we receive the saved file name from the metro viewer. |
| 58 AURA_EXPORT void HandleSaveFile( | 60 AURA_EXPORT void HandleSaveFile( |
| 59 const string16& title, | 61 const string16& title, |
| 60 const FilePath& default_path, | 62 const base::FilePath& default_path, |
| 61 const string16& filter, | 63 const string16& filter, |
| 62 int filter_index, | 64 int filter_index, |
| 63 const string16& default_extension, | 65 const string16& default_extension, |
| 64 const SaveFileCompletion& callback); | 66 const SaveFileCompletion& callback); |
| 65 | 67 |
| 66 | 68 |
| 67 // RootWindowHost implementaton that receives events from a different | 69 // RootWindowHost implementaton that receives events from a different |
| 68 // process. In the case of Windows this is the Windows 8 (aka Metro) | 70 // process. In the case of Windows this is the Windows 8 (aka Metro) |
| 69 // frontend process, which forwards input events to this class. | 71 // frontend process, which forwards input events to this class. |
| 70 class AURA_EXPORT RemoteRootWindowHostWin : public RootWindowHost { | 72 class AURA_EXPORT RemoteRootWindowHostWin : public RootWindowHost { |
| 71 public: | 73 public: |
| 72 static RemoteRootWindowHostWin* Instance(); | 74 static RemoteRootWindowHostWin* Instance(); |
| 73 static RemoteRootWindowHostWin* Create(const gfx::Rect& bounds); | 75 static RemoteRootWindowHostWin* Create(const gfx::Rect& bounds); |
| 74 | 76 |
| 75 // Called when the remote process has established its IPC connection. | 77 // Called when the remote process has established its IPC connection. |
| 76 // The |host| can be used when we need to send a message to it. | 78 // The |host| can be used when we need to send a message to it. |
| 77 void Connected(IPC::Sender* host); | 79 void Connected(IPC::Sender* host); |
| 78 // Called when the remote process has closed its IPC connection. | 80 // Called when the remote process has closed its IPC connection. |
| 79 void Disconnected(); | 81 void Disconnected(); |
| 80 | 82 |
| 81 // Called when we have a message from the remote process. | 83 // Called when we have a message from the remote process. |
| 82 bool OnMessageReceived(const IPC::Message& message); | 84 bool OnMessageReceived(const IPC::Message& message); |
| 83 | 85 |
| 84 void HandleOpenFile( | 86 void HandleOpenFile( |
| 85 const string16& title, | 87 const string16& title, |
| 86 const FilePath& default_path, | 88 const base::FilePath& default_path, |
| 87 const string16& filter, | 89 const string16& filter, |
| 88 const OpenFileCompletion& callback); | 90 const OpenFileCompletion& callback); |
| 89 | 91 |
| 90 void HandleOpenMultipleFiles( | 92 void HandleOpenMultipleFiles( |
| 91 const string16& title, | 93 const string16& title, |
| 92 const FilePath& default_path, | 94 const base::FilePath& default_path, |
| 93 const string16& filter, | 95 const string16& filter, |
| 94 const OpenMultipleFilesCompletion& callback); | 96 const OpenMultipleFilesCompletion& callback); |
| 95 | 97 |
| 96 void HandleSaveFile( | 98 void HandleSaveFile( |
| 97 const string16& title, | 99 const string16& title, |
| 98 const FilePath& default_path, | 100 const base::FilePath& default_path, |
| 99 const string16& filter, | 101 const string16& filter, |
| 100 int filter_index, | 102 int filter_index, |
| 101 const string16& default_extension, | 103 const string16& default_extension, |
| 102 const SaveFileCompletion& callback); | 104 const SaveFileCompletion& callback); |
| 103 | 105 |
| 104 private: | 106 private: |
| 105 explicit RemoteRootWindowHostWin(const gfx::Rect& bounds); | 107 explicit RemoteRootWindowHostWin(const gfx::Rect& bounds); |
| 106 virtual ~RemoteRootWindowHostWin(); | 108 virtual ~RemoteRootWindowHostWin(); |
| 107 | 109 |
| 108 // IPC message handing methods: | 110 // IPC message handing methods: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 126 uint32 flags); | 128 uint32 flags); |
| 127 void OnVisibilityChanged(bool visible); | 129 void OnVisibilityChanged(bool visible); |
| 128 void OnTouchDown(int32 x, int32 y, uint64 timestamp); | 130 void OnTouchDown(int32 x, int32 y, uint64 timestamp); |
| 129 void OnTouchUp(int32 x, int32 y, uint64 timestamp); | 131 void OnTouchUp(int32 x, int32 y, uint64 timestamp); |
| 130 void OnTouchMoved(int32 x, int32 y, uint64 timestamp); | 132 void OnTouchMoved(int32 x, int32 y, uint64 timestamp); |
| 131 void OnFileSaveAsDone(bool success, | 133 void OnFileSaveAsDone(bool success, |
| 132 string16 filename, | 134 string16 filename, |
| 133 int filter_index); | 135 int filter_index); |
| 134 void OnFileOpenDone(bool success, string16 filename); | 136 void OnFileOpenDone(bool success, string16 filename); |
| 135 void OnMultiFileOpenDone(bool success, | 137 void OnMultiFileOpenDone(bool success, |
| 136 const std::vector<FilePath>& files); | 138 const std::vector<base::FilePath>& files); |
| 137 | 139 |
| 138 // RootWindowHost overrides: | 140 // RootWindowHost overrides: |
| 139 virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE; | 141 virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE; |
| 140 virtual RootWindow* GetRootWindow() OVERRIDE; | 142 virtual RootWindow* GetRootWindow() OVERRIDE; |
| 141 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 143 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
| 142 virtual void Show() OVERRIDE; | 144 virtual void Show() OVERRIDE; |
| 143 virtual void Hide() OVERRIDE; | 145 virtual void Hide() OVERRIDE; |
| 144 virtual void ToggleFullScreen() OVERRIDE; | 146 virtual void ToggleFullScreen() OVERRIDE; |
| 145 virtual gfx::Rect GetBounds() const OVERRIDE; | 147 virtual gfx::Rect GetBounds() const OVERRIDE; |
| 146 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 148 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 173 OpenFileCompletion file_open_completion_callback_; | 175 OpenFileCompletion file_open_completion_callback_; |
| 174 OpenMultipleFilesCompletion multi_file_open_completion_callback_; | 176 OpenMultipleFilesCompletion multi_file_open_completion_callback_; |
| 175 SaveFileCompletion file_saveas_completion_callback_; | 177 SaveFileCompletion file_saveas_completion_callback_; |
| 176 | 178 |
| 177 DISALLOW_COPY_AND_ASSIGN(RemoteRootWindowHostWin); | 179 DISALLOW_COPY_AND_ASSIGN(RemoteRootWindowHostWin); |
| 178 }; | 180 }; |
| 179 | 181 |
| 180 } // namespace aura | 182 } // namespace aura |
| 181 | 183 |
| 182 #endif // UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ | 184 #endif // UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_ |
| OLD | NEW |