| 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/ui/views/select_file_dialog_extension.h" | 5 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" | 14 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
| 15 #include "chrome/browser/chromeos/extensions/file_manager_util.h" | 15 #include "chrome/browser/chromeos/extensions/file_manager_util.h" |
| 16 #include "chrome/browser/extensions/extension_host.h" | 16 #include "chrome/browser/extensions/extension_host.h" |
| 17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 18 #include "chrome/browser/extensions/shell_window_registry.h" | 18 #include "chrome/browser/extensions/shell_window_registry.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/sessions/restore_tab_helper.h" | 20 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 21 #include "chrome/browser/ui/base_window.h" | 21 #include "chrome/browser/ui/base_window.h" |
| 22 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_finder.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
| 24 #include "chrome/browser/ui/browser_list.h" | 24 #include "chrome/browser/ui/browser_list.h" |
| 25 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
| 26 #include "chrome/browser/ui/chrome_select_file_policy.h" | |
| 27 #include "chrome/browser/ui/extensions/shell_window.h" | 26 #include "chrome/browser/ui/extensions/shell_window.h" |
| 28 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 27 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 29 #include "chrome/browser/ui/views/extensions/extension_dialog.h" | 28 #include "chrome/browser/ui/views/extensions/extension_dialog.h" |
| 30 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 31 #include "ui/base/dialogs/selected_file_info.h" | 30 #include "ui/base/dialogs/selected_file_info.h" |
| 32 | 31 |
| 33 using content::BrowserThread; | 32 using content::BrowserThread; |
| 34 | 33 |
| 35 namespace { | 34 namespace { |
| 36 | 35 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 77 } |
| 79 | 78 |
| 80 } // namespace | 79 } // namespace |
| 81 | 80 |
| 82 // Linking this implementation of SelectFileDialog::Create into the target | 81 // Linking this implementation of SelectFileDialog::Create into the target |
| 83 // selects FileManagerDialog as the dialog of choice. | 82 // selects FileManagerDialog as the dialog of choice. |
| 84 // TODO(jamescook): Move this into a new file shell_dialogs_chromeos.cc | 83 // TODO(jamescook): Move this into a new file shell_dialogs_chromeos.cc |
| 85 // TODO(jamescook): Change all instances of SelectFileDialog::Create to return | 84 // TODO(jamescook): Change all instances of SelectFileDialog::Create to return |
| 86 // scoped_refptr<SelectFileDialog> as object is ref-counted. | 85 // scoped_refptr<SelectFileDialog> as object is ref-counted. |
| 87 // static | 86 // static |
| 88 SelectFileDialog* SelectFileDialog::Create(Listener* listener, | 87 SelectFileDialog* SelectFileDialog::Create(Listener* listener) { |
| 89 ui::SelectFilePolicy* policy) { | |
| 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 91 return SelectFileDialogExtension::Create(listener, policy); | 89 return SelectFileDialogExtension::Create(listener); |
| 92 } | 90 } |
| 93 | 91 |
| 94 ///////////////////////////////////////////////////////////////////////////// | 92 ///////////////////////////////////////////////////////////////////////////// |
| 95 | 93 |
| 96 // static | 94 // static |
| 97 SelectFileDialogExtension* SelectFileDialogExtension::Create( | 95 SelectFileDialogExtension* SelectFileDialogExtension::Create( |
| 98 Listener* listener, | 96 Listener* listener) { |
| 99 ui::SelectFilePolicy* policy) { | 97 return new SelectFileDialogExtension(listener); |
| 100 return new SelectFileDialogExtension(listener, policy); | |
| 101 } | 98 } |
| 102 | 99 |
| 103 SelectFileDialogExtension::SelectFileDialogExtension( | 100 SelectFileDialogExtension::SelectFileDialogExtension(Listener* listener) |
| 104 Listener* listener, | 101 : SelectFileDialog(listener), |
| 105 ui::SelectFilePolicy* policy) | |
| 106 : SelectFileDialog(listener, policy), | |
| 107 has_multiple_file_type_choices_(false), | 102 has_multiple_file_type_choices_(false), |
| 108 tab_id_(0), | 103 tab_id_(0), |
| 109 profile_(NULL), | 104 profile_(NULL), |
| 110 owner_window_(NULL), | 105 owner_window_(NULL), |
| 111 selection_type_(CANCEL), | 106 selection_type_(CANCEL), |
| 112 selection_index_(0), | 107 selection_index_(0), |
| 113 params_(NULL) { | 108 params_(NULL) { |
| 114 } | 109 } |
| 115 | 110 |
| 116 SelectFileDialogExtension::~SelectFileDialogExtension() { | 111 SelectFileDialogExtension::~SelectFileDialogExtension() { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 335 } |
| 341 | 336 |
| 342 // Connect our listener to FileDialogFunction's per-tab callbacks. | 337 // Connect our listener to FileDialogFunction's per-tab callbacks. |
| 343 AddPending(tab_id); | 338 AddPending(tab_id); |
| 344 | 339 |
| 345 extension_dialog_ = dialog; | 340 extension_dialog_ = dialog; |
| 346 params_ = params; | 341 params_ = params; |
| 347 tab_id_ = tab_id; | 342 tab_id_ = tab_id; |
| 348 owner_window_ = owner_window; | 343 owner_window_ = owner_window; |
| 349 } | 344 } |
| OLD | NEW |