| 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" |
| 11 #include "chrome/browser/platform_util.h" | |
| 12 #include "chrome/browser/ui/chrome_select_file_policy.h" | 11 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 13 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "ui/gfx/view_util.h" |
| 14 #include "ui/shell_dialogs/select_file_dialog.h" | 14 #include "ui/shell_dialogs/select_file_dialog.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 bool g_skip_picker_for_test = false; | 18 bool g_skip_picker_for_test = false; |
| 19 base::FilePath* g_path_to_be_picked_for_test = NULL; | 19 base::FilePath* g_path_to_be_picked_for_test = NULL; |
| 20 | 20 |
| 21 } // namespace | 21 } // namespace |
| 22 | 22 |
| 23 namespace extensions { | 23 namespace extensions { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 base::Bind( | 44 base::Bind( |
| 45 &EntryPicker::FileSelectionCanceled, | 45 &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 = |
| 55 platform_util::GetTopLevel(web_contents->GetNativeView()) : | 55 web_contents ? gfx::GetTopLevel(web_contents->GetNativeView()) : nullptr; |
| 56 nullptr; | |
| 57 | 56 |
| 58 select_file_dialog_->SelectFile(picker_type, | 57 select_file_dialog_->SelectFile(picker_type, |
| 59 select_title, | 58 select_title, |
| 60 last_directory, | 59 last_directory, |
| 61 &info, | 60 &info, |
| 62 file_type_index, | 61 file_type_index, |
| 63 base::FilePath::StringType(), | 62 base::FilePath::StringType(), |
| 64 owning_window, | 63 owning_window, |
| 65 nullptr); | 64 nullptr); |
| 66 } | 65 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 99 } |
| 101 | 100 |
| 102 // static | 101 // static |
| 103 void EntryPicker::StopSkippingPickerForTest() { | 102 void EntryPicker::StopSkippingPickerForTest() { |
| 104 g_skip_picker_for_test = false; | 103 g_skip_picker_for_test = false; |
| 105 } | 104 } |
| 106 | 105 |
| 107 } // namespace api | 106 } // namespace api |
| 108 | 107 |
| 109 } // namespace extensions | 108 } // namespace extensions |
| OLD | NEW |