| 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 #include "stdafx.h" | 5 #include "stdafx.h" |
| 6 #include "win8/metro_driver/file_picker_ash.h" | 6 #include "win8/metro_driver/file_picker_ash.h" |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 bool FilePickerSessionBase::Run() { | 77 bool FilePickerSessionBase::Run() { |
| 78 if (!DoFilePicker()) | 78 if (!DoFilePicker()) |
| 79 return false; | 79 return false; |
| 80 return success_; | 80 return success_; |
| 81 } | 81 } |
| 82 | 82 |
| 83 FilePickerSessionBase::FilePickerSessionBase(ChromeAppViewAsh* app_view, | 83 FilePickerSessionBase::FilePickerSessionBase(ChromeAppViewAsh* app_view, |
| 84 const base::string16& title, | 84 const base::string16& title, |
| 85 const base::string16& filter, | 85 const base::string16& filter, |
| 86 const base::FilePath& default_path) | 86 const base::FilePath& default_path) |
| 87 : app_view_(app_view), | 87 : success_(false), |
| 88 title_(title), | 88 title_(title), |
| 89 filter_(filter), | 89 filter_(filter), |
| 90 default_path_(default_path), | 90 default_path_(default_path), |
| 91 success_(false) { | 91 app_view_(app_view) { |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool FilePickerSessionBase::DoFilePicker() { | 94 bool FilePickerSessionBase::DoFilePicker() { |
| 95 // The file picker will fail if spawned from a snapped application, | 95 // The file picker will fail if spawned from a snapped application, |
| 96 // so let's attempt to unsnap first if we're in that state. | 96 // so let's attempt to unsnap first if we're in that state. |
| 97 HRESULT hr = ChromeAppViewAsh::Unsnap(); | 97 HRESULT hr = ChromeAppViewAsh::Unsnap(); |
| 98 if (FAILED(hr)) { | 98 if (FAILED(hr)) { |
| 99 LOG(ERROR) << "Failed to unsnap for file picker, error 0x" << hr; | 99 LOG(ERROR) << "Failed to unsnap for file picker, error 0x" << hr; |
| 100 return false; | 100 return false; |
| 101 } | 101 } |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } else { | 609 } else { |
| 610 LOG(ERROR) << "NULL IStorageItem"; | 610 LOG(ERROR) << "NULL IStorageItem"; |
| 611 } | 611 } |
| 612 } else { | 612 } else { |
| 613 LOG(ERROR) << "Unexpected async status " << static_cast<int>(status); | 613 LOG(ERROR) << "Unexpected async status " << static_cast<int>(status); |
| 614 } | 614 } |
| 615 app_view_->OnFolderPickerCompleted(this, success_); | 615 app_view_->OnFolderPickerCompleted(this, success_); |
| 616 return S_OK; | 616 return S_OK; |
| 617 } | 617 } |
| 618 | 618 |
| OLD | NEW |