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/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
14 #include "chrome/browser/app_mode/app_mode_utils.h" | 14 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 15 #include "chrome/browser/apps/app_window_registry_util.h" |
15 #include "chrome/browser/chromeos/file_manager/app_id.h" | 16 #include "chrome/browser/chromeos/file_manager/app_id.h" |
16 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 17 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
17 #include "chrome/browser/chromeos/file_manager/select_file_dialog_util.h" | 18 #include "chrome/browser/chromeos/file_manager/select_file_dialog_util.h" |
18 #include "chrome/browser/chromeos/file_manager/url_util.h" | 19 #include "chrome/browser/chromeos/file_manager/url_util.h" |
19 #include "chrome/browser/chromeos/login/ui/login_web_dialog.h" | 20 #include "chrome/browser/chromeos/login/ui/login_web_dialog.h" |
20 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
21 #include "chrome/browser/extensions/extension_view_host.h" | 22 #include "chrome/browser/extensions/extension_view_host.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/sessions/session_tab_helper.h" | 24 #include "chrome/browser/sessions/session_tab_helper.h" |
24 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/browser_finder.h" | 26 #include "chrome/browser/ui/browser_finder.h" |
26 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
27 #include "chrome/browser/ui/chrome_select_file_policy.h" | 28 #include "chrome/browser/ui/chrome_select_file_policy.h" |
28 #include "chrome/browser/ui/host_desktop.h" | 29 #include "chrome/browser/ui/host_desktop.h" |
29 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
30 #include "chrome/browser/ui/views/extensions/extension_dialog.h" | 31 #include "chrome/browser/ui/views/extensions/extension_dialog.h" |
31 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
33 #include "extensions/browser/app_window/app_window.h" | 34 #include "extensions/browser/app_window/app_window.h" |
34 #include "extensions/browser/app_window/app_window_registry.h" | |
35 #include "extensions/browser/app_window/native_app_window.h" | 35 #include "extensions/browser/app_window/native_app_window.h" |
36 #include "extensions/browser/extension_system.h" | 36 #include "extensions/browser/extension_system.h" |
37 #include "ui/base/base_window.h" | 37 #include "ui/base/base_window.h" |
38 #include "ui/shell_dialogs/selected_file_info.h" | 38 #include "ui/shell_dialogs/selected_file_info.h" |
39 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
40 | 40 |
41 #if defined(USE_ATHENA) | 41 #if defined(USE_ATHENA) |
42 #include "chrome/browser/ui/views/athena/athena_util.h" | 42 #include "chrome/browser/ui/views/athena/athena_util.h" |
43 #endif // USE_ATHENA | 43 #endif // USE_ATHENA |
44 | 44 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 Browser* owner_browser = NULL; | 116 Browser* owner_browser = NULL; |
117 AppWindow* app_window = NULL; | 117 AppWindow* app_window = NULL; |
118 | 118 |
119 // If owner_window is supplied, use that to find a browser or a app window. | 119 // If owner_window is supplied, use that to find a browser or a app window. |
120 if (owner_window) { | 120 if (owner_window) { |
121 owner_browser = chrome::FindBrowserWithWindow(owner_window); | 121 owner_browser = chrome::FindBrowserWithWindow(owner_window); |
122 if (!owner_browser) { | 122 if (!owner_browser) { |
123 // If an owner_window was supplied but we couldn't find a browser, this | 123 // If an owner_window was supplied but we couldn't find a browser, this |
124 // could be for a app window. | 124 // could be for a app window. |
125 app_window = | 125 app_window = |
126 extensions::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile( | 126 AppWindowRegistryUtil::GetAppWindowForNativeWindowAnyProfile( |
127 owner_window); | 127 owner_window); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 if (app_window) { | 131 if (app_window) { |
132 DCHECK(!app_window->window_type_is_panel()); | 132 DCHECK(!app_window->window_type_is_panel()); |
133 *base_window = app_window->GetBaseWindow(); | 133 *base_window = app_window->GetBaseWindow(); |
134 *web_contents = app_window->web_contents(); | 134 *web_contents = app_window->web_contents(); |
135 } else { | 135 } else { |
136 // If the owning window is still unknown, this could be a background page or | 136 // If the owning window is still unknown, this could be a background page or |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 } | 434 } |
435 | 435 |
436 // Connect our listener to FileDialogFunction's per-tab callbacks. | 436 // Connect our listener to FileDialogFunction's per-tab callbacks. |
437 AddPending(routing_id); | 437 AddPending(routing_id); |
438 | 438 |
439 extension_dialog_ = dialog; | 439 extension_dialog_ = dialog; |
440 params_ = params; | 440 params_ = params; |
441 routing_id_ = routing_id; | 441 routing_id_ = routing_id; |
442 owner_window_ = owner_window; | 442 owner_window_ = owner_window; |
443 } | 443 } |
OLD | NEW |