| 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 #include "stdafx.h" | 5 #include "stdafx.h" |
| 6 #include "win8/metro_driver/file_picker.h" | 6 #include "win8/metro_driver/file_picker.h" |
| 7 | 7 |
| 8 #include <windows.storage.pickers.h> | 8 #include <windows.storage.pickers.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void DoFilePicker(); | 107 void DoFilePicker(); |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(FilePickerSessionBase); | 109 DISALLOW_COPY_AND_ASSIGN(FilePickerSessionBase); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 class OpenFilePickerSession : public FilePickerSessionBase { | 112 class OpenFilePickerSession : public FilePickerSessionBase { |
| 113 public: | 113 public: |
| 114 explicit OpenFilePickerSession(OPENFILENAME* open_file_name); | 114 explicit OpenFilePickerSession(OPENFILENAME* open_file_name); |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 virtual HRESULT StartFilePicker() OVERRIDE; | 117 virtual HRESULT StartFilePicker() override; |
| 118 | 118 |
| 119 typedef winfoundtn::IAsyncOperation<winstorage::StorageFile*> | 119 typedef winfoundtn::IAsyncOperation<winstorage::StorageFile*> |
| 120 SingleFileAsyncOp; | 120 SingleFileAsyncOp; |
| 121 typedef winfoundtn::Collections::IVectorView< | 121 typedef winfoundtn::Collections::IVectorView< |
| 122 winstorage::StorageFile*> StorageFileVectorCollection; | 122 winstorage::StorageFile*> StorageFileVectorCollection; |
| 123 typedef winfoundtn::IAsyncOperation<StorageFileVectorCollection*> | 123 typedef winfoundtn::IAsyncOperation<StorageFileVectorCollection*> |
| 124 MultiFileAsyncOp; | 124 MultiFileAsyncOp; |
| 125 | 125 |
| 126 // Called asynchronously when a single file picker is done. | 126 // Called asynchronously when a single file picker is done. |
| 127 HRESULT SinglePickerDone(SingleFileAsyncOp* async, AsyncStatus status); | 127 HRESULT SinglePickerDone(SingleFileAsyncOp* async, AsyncStatus status); |
| 128 | 128 |
| 129 // Called asynchronously when a multi file picker is done. | 129 // Called asynchronously when a multi file picker is done. |
| 130 HRESULT MultiPickerDone(MultiFileAsyncOp* async, AsyncStatus status); | 130 HRESULT MultiPickerDone(MultiFileAsyncOp* async, AsyncStatus status); |
| 131 | 131 |
| 132 // Composes a multi-file result string suitable for returning to a | 132 // Composes a multi-file result string suitable for returning to a |
| 133 // from a storage file collection. | 133 // from a storage file collection. |
| 134 static HRESULT ComposeMultiFileResult(StorageFileVectorCollection* files, | 134 static HRESULT ComposeMultiFileResult(StorageFileVectorCollection* files, |
| 135 base::string16* result); | 135 base::string16* result); |
| 136 private: | 136 private: |
| 137 DISALLOW_COPY_AND_ASSIGN(OpenFilePickerSession); | 137 DISALLOW_COPY_AND_ASSIGN(OpenFilePickerSession); |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 class SaveFilePickerSession : public FilePickerSessionBase { | 140 class SaveFilePickerSession : public FilePickerSessionBase { |
| 141 public: | 141 public: |
| 142 explicit SaveFilePickerSession(OPENFILENAME* open_file_name); | 142 explicit SaveFilePickerSession(OPENFILENAME* open_file_name); |
| 143 | 143 |
| 144 private: | 144 private: |
| 145 virtual HRESULT StartFilePicker() OVERRIDE; | 145 virtual HRESULT StartFilePicker() override; |
| 146 | 146 |
| 147 typedef winfoundtn::IAsyncOperation<winstorage::StorageFile*> | 147 typedef winfoundtn::IAsyncOperation<winstorage::StorageFile*> |
| 148 SaveFileAsyncOp; | 148 SaveFileAsyncOp; |
| 149 | 149 |
| 150 // Called asynchronously when the save file picker is done. | 150 // Called asynchronously when the save file picker is done. |
| 151 HRESULT FilePickerDone(SaveFileAsyncOp* async, AsyncStatus status); | 151 HRESULT FilePickerDone(SaveFileAsyncOp* async, AsyncStatus status); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 FilePickerSessionBase::FilePickerSessionBase(OPENFILENAME* open_file_name) | 154 FilePickerSessionBase::FilePickerSessionBase(OPENFILENAME* open_file_name) |
| 155 : open_file_name_(open_file_name), | 155 : open_file_name_(open_file_name), |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 OpenFilePickerSession session(open_file_name); | 612 OpenFilePickerSession session(open_file_name); |
| 613 | 613 |
| 614 return session.Run(); | 614 return session.Run(); |
| 615 } | 615 } |
| 616 | 616 |
| 617 BOOL MetroGetSaveFileName(OPENFILENAME* open_file_name) { | 617 BOOL MetroGetSaveFileName(OPENFILENAME* open_file_name) { |
| 618 SaveFilePickerSession session(open_file_name); | 618 SaveFilePickerSession session(open_file_name); |
| 619 | 619 |
| 620 return session.Run(); | 620 return session.Run(); |
| 621 } | 621 } |
| OLD | NEW |