OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ | 5 #ifndef WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ |
6 #define WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ | 6 #define WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 // Handles the select folder for Metro Chrome Ash. The on_success | 113 // Handles the select folder for Metro Chrome Ash. The on_success |
114 // callback passed in is invoked when we receive the folder name from the | 114 // callback passed in is invoked when we receive the folder name from the |
115 // metro viewer. The on failure callback is invoked on failure. | 115 // metro viewer. The on failure callback is invoked on failure. |
116 static void HandleSelectFolder(const base::string16& title, | 116 static void HandleSelectFolder(const base::string16& title, |
117 const SelectFolderCompletion& on_success, | 117 const SelectFolderCompletion& on_success, |
118 const FileSelectionCanceled& on_failure); | 118 const FileSelectionCanceled& on_failure); |
119 | 119 |
120 protected: | 120 protected: |
121 // IPC::Sender implementation: | 121 // IPC::Sender implementation: |
122 virtual bool Send(IPC::Message* msg) OVERRIDE; | 122 virtual bool Send(IPC::Message* msg) override; |
123 | 123 |
124 // IPC::Listener implementation: | 124 // IPC::Listener implementation: |
125 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 125 virtual bool OnMessageReceived(const IPC::Message& message) override; |
126 virtual void OnChannelError() OVERRIDE = 0; | 126 virtual void OnChannelError() override = 0; |
127 | 127 |
128 private: | 128 private: |
129 // The following are the implementation for the corresponding static methods | 129 // The following are the implementation for the corresponding static methods |
130 // above, see them for descriptions. | 130 // above, see them for descriptions. |
131 void HandleOpenFileImpl(const base::string16& title, | 131 void HandleOpenFileImpl(const base::string16& title, |
132 const base::FilePath& default_path, | 132 const base::FilePath& default_path, |
133 const base::string16& filter, | 133 const base::string16& filter, |
134 const OpenFileCompletion& on_success, | 134 const OpenFileCompletion& on_success, |
135 const FileSelectionCanceled& on_failure); | 135 const FileSelectionCanceled& on_failure); |
136 void HandleOpenMultipleFilesImpl( | 136 void HandleOpenMultipleFilesImpl( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 // Inner message filter used to handle connection event on the IPC channel | 181 // Inner message filter used to handle connection event on the IPC channel |
182 // proxy's background thread. This prevents consumers of | 182 // proxy's background thread. This prevents consumers of |
183 // MetroViewerProcessHost from having to pump messages on their own message | 183 // MetroViewerProcessHost from having to pump messages on their own message |
184 // loop. | 184 // loop. |
185 class InternalMessageFilter : public IPC::MessageFilter { | 185 class InternalMessageFilter : public IPC::MessageFilter { |
186 public: | 186 public: |
187 InternalMessageFilter(MetroViewerProcessHost* owner); | 187 InternalMessageFilter(MetroViewerProcessHost* owner); |
188 | 188 |
189 // IPC::MessageFilter implementation. | 189 // IPC::MessageFilter implementation. |
190 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 190 virtual void OnChannelConnected(int32 peer_pid) override; |
191 | 191 |
192 private: | 192 private: |
193 MetroViewerProcessHost* owner_; | 193 MetroViewerProcessHost* owner_; |
194 DISALLOW_COPY_AND_ASSIGN(InternalMessageFilter); | 194 DISALLOW_COPY_AND_ASSIGN(InternalMessageFilter); |
195 }; | 195 }; |
196 | 196 |
197 scoped_ptr<IPC::ChannelProxy> channel_; | 197 scoped_ptr<IPC::ChannelProxy> channel_; |
198 scoped_ptr<base::WaitableEvent> channel_connected_event_; | 198 scoped_ptr<base::WaitableEvent> channel_connected_event_; |
199 scoped_refptr<InternalMessageFilter> message_filter_; | 199 scoped_refptr<InternalMessageFilter> message_filter_; |
200 | 200 |
201 static MetroViewerProcessHost* instance_; | 201 static MetroViewerProcessHost* instance_; |
202 | 202 |
203 // Saved callbacks which inform the caller about the result of the open file/ | 203 // Saved callbacks which inform the caller about the result of the open file/ |
204 // save file/select operations. | 204 // save file/select operations. |
205 OpenFileCompletion file_open_completion_callback_; | 205 OpenFileCompletion file_open_completion_callback_; |
206 OpenMultipleFilesCompletion multi_file_open_completion_callback_; | 206 OpenMultipleFilesCompletion multi_file_open_completion_callback_; |
207 SaveFileCompletion file_saveas_completion_callback_; | 207 SaveFileCompletion file_saveas_completion_callback_; |
208 SelectFolderCompletion select_folder_completion_callback_; | 208 SelectFolderCompletion select_folder_completion_callback_; |
209 FileSelectionCanceled failure_callback_; | 209 FileSelectionCanceled failure_callback_; |
210 | 210 |
211 DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); | 211 DISALLOW_COPY_AND_ASSIGN(MetroViewerProcessHost); |
212 }; | 212 }; |
213 | 213 |
214 } // namespace win8 | 214 } // namespace win8 |
215 | 215 |
216 #endif // WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ | 216 #endif // WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_ |
OLD | NEW |