| 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 "apps/shell_window.h" | 7 #include "apps/shell_window.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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" | 26 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 27 #include "chrome/browser/ui/extensions/native_app_window.h" | 27 #include "chrome/browser/ui/extensions/native_app_window.h" |
| 28 #include "chrome/browser/ui/host_desktop.h" | 28 #include "chrome/browser/ui/host_desktop.h" |
| 29 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 29 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 30 #include "chrome/browser/ui/views/extensions/extension_dialog.h" | 30 #include "chrome/browser/ui/views/extensions/extension_dialog.h" |
| 31 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 33 #include "ui/base/base_window.h" | 33 #include "ui/base/base_window.h" |
| 34 #include "ui/shell_dialogs/selected_file_info.h" | 34 #include "ui/shell_dialogs/selected_file_info.h" |
| 35 #include "ui/views/widget/widget.h" |
| 35 | 36 |
| 36 using apps::ShellWindow; | 37 using apps::ShellWindow; |
| 37 using content::BrowserThread; | 38 using content::BrowserThread; |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 const int kFileManagerWidth = 972; // pixels | 42 const int kFileManagerWidth = 972; // pixels |
| 42 const int kFileManagerHeight = 640; // pixels | 43 const int kFileManagerHeight = 640; // pixels |
| 43 | 44 |
| 44 // Holds references to file manager dialogs that have callbacks pending | 45 // Holds references to file manager dialogs that have callbacks pending |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // ExtensionProcessManager::CreateViewHost. Once that is fixed, remove this. | 150 // ExtensionProcessManager::CreateViewHost. Once that is fixed, remove this. |
| 150 if (profile_) { | 151 if (profile_) { |
| 151 base::MessageLoop::current()->PostTask( | 152 base::MessageLoop::current()->PostTask( |
| 152 FROM_HERE, | 153 FROM_HERE, |
| 153 base::Bind(&ExtensionService::ReloadExtension, | 154 base::Bind(&ExtensionService::ReloadExtension, |
| 154 base::Unretained(extensions::ExtensionSystem::Get(profile_) | 155 base::Unretained(extensions::ExtensionSystem::Get(profile_) |
| 155 ->extension_service()), | 156 ->extension_service()), |
| 156 extension_id)); | 157 extension_id)); |
| 157 } | 158 } |
| 158 | 159 |
| 159 dialog->Close(); | 160 dialog->GetWidget()->Close(); |
| 160 } | 161 } |
| 161 | 162 |
| 162 // static | 163 // static |
| 163 void SelectFileDialogExtension::OnFileSelected( | 164 void SelectFileDialogExtension::OnFileSelected( |
| 164 int32 tab_id, | 165 int32 tab_id, |
| 165 const ui::SelectedFileInfo& file, | 166 const ui::SelectedFileInfo& file, |
| 166 int index) { | 167 int index) { |
| 167 scoped_refptr<SelectFileDialogExtension> dialog = | 168 scoped_refptr<SelectFileDialogExtension> dialog = |
| 168 PendingDialog::GetInstance()->Find(tab_id); | 169 PendingDialog::GetInstance()->Find(tab_id); |
| 169 if (!dialog.get()) | 170 if (!dialog.get()) |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 } | 368 } |
| 368 | 369 |
| 369 // Connect our listener to FileDialogFunction's per-tab callbacks. | 370 // Connect our listener to FileDialogFunction's per-tab callbacks. |
| 370 AddPending(tab_id); | 371 AddPending(tab_id); |
| 371 | 372 |
| 372 extension_dialog_ = dialog; | 373 extension_dialog_ = dialog; |
| 373 params_ = params; | 374 params_ = params; |
| 374 tab_id_ = tab_id; | 375 tab_id_ = tab_id; |
| 375 owner_window_ = owner_window; | 376 owner_window_ = owner_window; |
| 376 } | 377 } |
| OLD | NEW |