| 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/session_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_tabstrip.h" | 25 #include "chrome/browser/ui/browser_tabstrip.h" |
| 26 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
| 27 #include "chrome/browser/ui/chrome_select_file_policy.h" | 27 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 28 #include "chrome/browser/ui/extensions/shell_window.h" | 28 #include "chrome/browser/ui/extensions/shell_window.h" |
| 29 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 29 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 30 #include "chrome/browser/ui/views/extensions/extension_dialog.h" | 30 #include "chrome/browser/ui/views/extensions/extension_dialog.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 if (!base_window) { | 294 if (!base_window) { |
| 295 NOTREACHED() << "Can't find owning window."; | 295 NOTREACHED() << "Can't find owning window."; |
| 296 return; | 296 return; |
| 297 } | 297 } |
| 298 DCHECK(profile_); | 298 DCHECK(profile_); |
| 299 | 299 |
| 300 // Check if we have another dialog opened in the tab. It's unlikely, but | 300 // Check if we have another dialog opened in the tab. It's unlikely, but |
| 301 // possible. If there is no tab contents use a tab_id of 0. A dialog without | 301 // possible. If there is no tab contents use a tab_id of 0. A dialog without |
| 302 // an associated tab contents will be shown fully screen; only one at a time | 302 // an associated tab contents will be shown fully screen; only one at a time |
| 303 // is allowed in this state. | 303 // is allowed in this state. |
| 304 int32 tab_id = tab ? tab->restore_tab_helper()->session_id().id() : 0; | 304 int32 tab_id = tab ? tab->session_tab_helper()->session_id().id() : 0; |
| 305 if (PendingExists(tab_id)) { | 305 if (PendingExists(tab_id)) { |
| 306 DLOG(WARNING) << "Pending dialog exists with id " << tab_id; | 306 DLOG(WARNING) << "Pending dialog exists with id " << tab_id; |
| 307 return; | 307 return; |
| 308 } | 308 } |
| 309 | 309 |
| 310 FilePath virtual_path; | 310 FilePath virtual_path; |
| 311 if (file_manager_util::ConvertFileToRelativeFileSystemPath( | 311 if (file_manager_util::ConvertFileToRelativeFileSystemPath( |
| 312 profile_, default_path, &virtual_path)) { | 312 profile_, default_path, &virtual_path)) { |
| 313 virtual_path = FilePath("/").Append(virtual_path); | 313 virtual_path = FilePath("/").Append(virtual_path); |
| 314 } else { | 314 } else { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 341 kFileManagerMinimumHeight); | 341 kFileManagerMinimumHeight); |
| 342 | 342 |
| 343 // Connect our listener to FileDialogFunction's per-tab callbacks. | 343 // Connect our listener to FileDialogFunction's per-tab callbacks. |
| 344 AddPending(tab_id); | 344 AddPending(tab_id); |
| 345 | 345 |
| 346 extension_dialog_ = dialog; | 346 extension_dialog_ = dialog; |
| 347 params_ = params; | 347 params_ = params; |
| 348 tab_id_ = tab_id; | 348 tab_id_ = tab_id; |
| 349 owner_window_ = owner_window; | 349 owner_window_ = owner_window; |
| 350 } | 350 } |
| OLD | NEW |