| 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 <stddef.h> |
| 9 #include <stdint.h> |
| 8 #include <windows.storage.pickers.h> | 10 #include <windows.storage.pickers.h> |
| 9 | 11 |
| 10 #include "base/bind.h" | 12 #include "base/bind.h" |
| 11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" |
| 13 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 14 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 15 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 16 #include "base/win/metro.h" | 19 #include "base/win/metro.h" |
| 17 #include "base/win/scoped_comptr.h" | 20 #include "base/win/scoped_comptr.h" |
| 18 #include "win8/metro_driver/chrome_app_view.h" | 21 #include "win8/metro_driver/chrome_app_view.h" |
| 19 #include "win8/metro_driver/winrt_utils.h" | 22 #include "win8/metro_driver/winrt_utils.h" |
| 20 | 23 |
| 21 namespace { | 24 namespace { |
| 22 | 25 |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 DCHECK_EQ(FALSE, replaced); | 509 DCHECK_EQ(FALSE, replaced); |
| 507 } | 510 } |
| 508 | 511 |
| 509 // Walk past the extension(s). | 512 // Walk past the extension(s). |
| 510 walk += wcslen(walk) + 1; | 513 walk += wcslen(walk) + 1; |
| 511 } | 514 } |
| 512 } | 515 } |
| 513 | 516 |
| 514 // The save picker requires at least one choice. Callers are strongly advised | 517 // The save picker requires at least one choice. Callers are strongly advised |
| 515 // to provide sensible choices. If none were given, fallback to .dat. | 518 // to provide sensible choices. If none were given, fallback to .dat. |
| 516 uint32 num_choices = 0; | 519 uint32_t num_choices = 0; |
| 517 hr = choices->get_Size(&num_choices); | 520 hr = choices->get_Size(&num_choices); |
| 518 if (FAILED(hr)) | 521 if (FAILED(hr)) |
| 519 return hr; | 522 return hr; |
| 520 | 523 |
| 521 if (num_choices == 0) { | 524 if (num_choices == 0) { |
| 522 mswrw::HString description; | 525 mswrw::HString description; |
| 523 // TODO(grt): Get a properly translated string. This can't be done from | 526 // TODO(grt): Get a properly translated string. This can't be done from |
| 524 // within metro_driver. Consider preprocessing the filter list in Chrome | 527 // within metro_driver. Consider preprocessing the filter list in Chrome |
| 525 // land to ensure it has this entry if all others are patterns. In that | 528 // land to ensure it has this entry if all others are patterns. In that |
| 526 // case, this whole block of code can be removed. | 529 // case, this whole block of code can be removed. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 OpenFilePickerSession session(open_file_name); | 613 OpenFilePickerSession session(open_file_name); |
| 611 | 614 |
| 612 return session.Run(); | 615 return session.Run(); |
| 613 } | 616 } |
| 614 | 617 |
| 615 BOOL MetroGetSaveFileName(OPENFILENAME* open_file_name) { | 618 BOOL MetroGetSaveFileName(OPENFILENAME* open_file_name) { |
| 616 SaveFilePickerSession session(open_file_name); | 619 SaveFilePickerSession session(open_file_name); |
| 617 | 620 |
| 618 return session.Run(); | 621 return session.Run(); |
| 619 } | 622 } |
| OLD | NEW |