| 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 "chrome/browser/extensions/api/developer_private/entry_picker.h" | 5 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" | 10 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 EntryPicker::EntryPicker(EntryPickerClient* client, | 27 EntryPicker::EntryPicker(EntryPickerClient* client, |
| 28 content::WebContents* web_contents, | 28 content::WebContents* web_contents, |
| 29 ui::SelectFileDialog::Type picker_type, | 29 ui::SelectFileDialog::Type picker_type, |
| 30 const base::FilePath& last_directory, | 30 const base::FilePath& last_directory, |
| 31 const base::string16& select_title, | 31 const base::string16& select_title, |
| 32 const ui::SelectFileDialog::FileTypeInfo& info, | 32 const ui::SelectFileDialog::FileTypeInfo& info, |
| 33 int file_type_index) | 33 int file_type_index) |
| 34 : client_(client) { | 34 : client_(client) { |
| 35 if (g_skip_picker_for_test) { | 35 if (g_skip_picker_for_test) { |
| 36 if (g_path_to_be_picked_for_test) { | 36 if (g_path_to_be_picked_for_test) { |
| 37 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 37 content::BrowserThread::PostTask( |
| 38 base::Bind( | 38 content::BrowserThread::UI, FROM_HERE, |
| 39 &EntryPicker::FileSelected, | 39 base::BindOnce(&EntryPicker::FileSelected, base::Unretained(this), |
| 40 base::Unretained(this), *g_path_to_be_picked_for_test, 1, | 40 *g_path_to_be_picked_for_test, 1, |
| 41 static_cast<void*>(nullptr))); | 41 static_cast<void*>(nullptr))); |
| 42 } else { | 42 } else { |
| 43 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 43 content::BrowserThread::PostTask( |
| 44 base::Bind( | 44 content::BrowserThread::UI, FROM_HERE, |
| 45 &EntryPicker::FileSelectionCanceled, | 45 base::BindOnce(&EntryPicker::FileSelectionCanceled, |
| 46 base::Unretained(this), static_cast<void*>(nullptr))); | 46 base::Unretained(this), static_cast<void*>(nullptr))); |
| 47 } | 47 } |
| 48 return; | 48 return; |
| 49 } | 49 } |
| 50 | 50 |
| 51 select_file_dialog_ = ui::SelectFileDialog::Create( | 51 select_file_dialog_ = ui::SelectFileDialog::Create( |
| 52 this, new ChromeSelectFilePolicy(web_contents)); | 52 this, new ChromeSelectFilePolicy(web_contents)); |
| 53 | 53 |
| 54 gfx::NativeWindow owning_window = web_contents ? | 54 gfx::NativeWindow owning_window = web_contents ? |
| 55 platform_util::GetTopLevel(web_contents->GetNativeView()) : | 55 platform_util::GetTopLevel(web_contents->GetNativeView()) : |
| 56 nullptr; | 56 nullptr; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 // static | 102 // static |
| 103 void EntryPicker::StopSkippingPickerForTest() { | 103 void EntryPicker::StopSkippingPickerForTest() { |
| 104 g_skip_picker_for_test = false; | 104 g_skip_picker_for_test = false; |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace api | 107 } // namespace api |
| 108 | 108 |
| 109 } // namespace extensions | 109 } // namespace extensions |
| OLD | NEW |