| 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" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 if (app_window) { | 119 if (app_window) { |
| 120 DCHECK(!app_window->window_type_is_panel()); | 120 DCHECK(!app_window->window_type_is_panel()); |
| 121 *base_window = app_window->GetBaseWindow(); | 121 *base_window = app_window->GetBaseWindow(); |
| 122 *web_contents = app_window->web_contents(); | 122 *web_contents = app_window->web_contents(); |
| 123 } else { | 123 } else { |
| 124 // If the owning window is still unknown, this could be a background page or | 124 // If the owning window is still unknown, this could be a background page or |
| 125 // and extension popup. Use the last active browser. | 125 // and extension popup. Use the last active browser. |
| 126 if (!owner_browser) { | 126 if (!owner_browser) |
| 127 owner_browser = | 127 owner_browser = chrome::FindLastActive(); |
| 128 chrome::FindLastActiveWithHostDesktopType(chrome::GetActiveDesktop()); | |
| 129 } | |
| 130 if (owner_browser) { | 128 if (owner_browser) { |
| 131 *base_window = owner_browser->window(); | 129 *base_window = owner_browser->window(); |
| 132 *web_contents = owner_browser->tab_strip_model()->GetActiveWebContents(); | 130 *web_contents = owner_browser->tab_strip_model()->GetActiveWebContents(); |
| 133 } | 131 } |
| 134 } | 132 } |
| 135 | 133 |
| 136 // In ChromeOS kiosk launch mode, we can still show file picker for | 134 // In ChromeOS kiosk launch mode, we can still show file picker for |
| 137 // certificate manager dialog. There are no browser or webapp window | 135 // certificate manager dialog. There are no browser or webapp window |
| 138 // instances present in this case. | 136 // instances present in this case. |
| 139 if (chrome::IsRunningInForcedAppMode() && !(*web_contents)) | 137 if (chrome::IsRunningInForcedAppMode() && !(*web_contents)) |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 } | 419 } |
| 422 | 420 |
| 423 // Connect our listener to FileDialogFunction's per-tab callbacks. | 421 // Connect our listener to FileDialogFunction's per-tab callbacks. |
| 424 AddPending(routing_id); | 422 AddPending(routing_id); |
| 425 | 423 |
| 426 extension_dialog_ = dialog; | 424 extension_dialog_ = dialog; |
| 427 params_ = params; | 425 params_ = params; |
| 428 routing_id_ = routing_id; | 426 routing_id_ = routing_id; |
| 429 owner_window_ = owner_window; | 427 owner_window_ = owner_window; |
| 430 } | 428 } |
| OLD | NEW |