| 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/app_window.h" | |
| 8 #include "apps/app_window_registry.h" | |
| 9 #include "base/bind.h" | 7 #include "base/bind.h" |
| 10 #include "base/callback.h" | 8 #include "base/callback.h" |
| 11 #include "base/logging.h" | 9 #include "base/logging.h" |
| 12 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 14 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 15 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 16 #include "chrome/browser/app_mode/app_mode_utils.h" | 14 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 17 #include "chrome/browser/chromeos/file_manager/app_id.h" | 15 #include "chrome/browser/chromeos/file_manager/app_id.h" |
| 18 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 16 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 19 #include "chrome/browser/chromeos/file_manager/select_file_dialog_util.h" | 17 #include "chrome/browser/chromeos/file_manager/select_file_dialog_util.h" |
| 20 #include "chrome/browser/chromeos/file_manager/url_util.h" | 18 #include "chrome/browser/chromeos/file_manager/url_util.h" |
| 21 #include "chrome/browser/chromeos/login/ui/login_web_dialog.h" | 19 #include "chrome/browser/chromeos/login/ui/login_web_dialog.h" |
| 22 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
| 23 #include "chrome/browser/extensions/extension_view_host.h" | 21 #include "chrome/browser/extensions/extension_view_host.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/sessions/session_tab_helper.h" | 23 #include "chrome/browser/sessions/session_tab_helper.h" |
| 26 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/browser_finder.h" | 25 #include "chrome/browser/ui/browser_finder.h" |
| 28 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
| 29 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 30 #include "chrome/browser/ui/chrome_select_file_policy.h" | 28 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 31 #include "chrome/browser/ui/host_desktop.h" | 29 #include "chrome/browser/ui/host_desktop.h" |
| 32 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 33 #include "chrome/browser/ui/views/extensions/extension_dialog.h" | 31 #include "chrome/browser/ui/views/extensions/extension_dialog.h" |
| 34 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 35 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 #include "extensions/browser/app_window/app_window.h" |
| 35 #include "extensions/browser/app_window/app_window_registry.h" |
| 36 #include "extensions/browser/app_window/native_app_window.h" | 36 #include "extensions/browser/app_window/native_app_window.h" |
| 37 #include "extensions/browser/extension_system.h" | 37 #include "extensions/browser/extension_system.h" |
| 38 #include "ui/base/base_window.h" | 38 #include "ui/base/base_window.h" |
| 39 #include "ui/shell_dialogs/selected_file_info.h" | 39 #include "ui/shell_dialogs/selected_file_info.h" |
| 40 #include "ui/views/widget/widget.h" | 40 #include "ui/views/widget/widget.h" |
| 41 | 41 |
| 42 using apps::AppWindow; | 42 using extensions::AppWindow; |
| 43 using content::BrowserThread; | 43 using content::BrowserThread; |
| 44 | 44 |
| 45 namespace { | 45 namespace { |
| 46 | 46 |
| 47 const int kFileManagerWidth = 972; // pixels | 47 const int kFileManagerWidth = 972; // pixels |
| 48 const int kFileManagerHeight = 640; // pixels | 48 const int kFileManagerHeight = 640; // pixels |
| 49 const int kFileManagerMinimumWidth = 640; // pixels | 49 const int kFileManagerMinimumWidth = 640; // pixels |
| 50 const int kFileManagerMinimumHeight = 240; // pixels | 50 const int kFileManagerMinimumHeight = 240; // pixels |
| 51 | 51 |
| 52 // Holds references to file manager dialogs that have callbacks pending | 52 // Holds references to file manager dialogs that have callbacks pending |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 Browser* owner_browser = NULL; | 109 Browser* owner_browser = NULL; |
| 110 AppWindow* app_window = NULL; | 110 AppWindow* app_window = NULL; |
| 111 | 111 |
| 112 // If owner_window is supplied, use that to find a browser or a app window. | 112 // If owner_window is supplied, use that to find a browser or a app window. |
| 113 if (owner_window) { | 113 if (owner_window) { |
| 114 owner_browser = chrome::FindBrowserWithWindow(owner_window); | 114 owner_browser = chrome::FindBrowserWithWindow(owner_window); |
| 115 if (!owner_browser) { | 115 if (!owner_browser) { |
| 116 // If an owner_window was supplied but we couldn't find a browser, this | 116 // If an owner_window was supplied but we couldn't find a browser, this |
| 117 // could be for a app window. | 117 // could be for a app window. |
| 118 app_window = | 118 app_window = |
| 119 apps::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile( | 119 extensions::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile( |
| 120 owner_window); | 120 owner_window); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 if (app_window) { | 124 if (app_window) { |
| 125 DCHECK(!app_window->window_type_is_panel()); | 125 DCHECK(!app_window->window_type_is_panel()); |
| 126 *base_window = app_window->GetBaseWindow(); | 126 *base_window = app_window->GetBaseWindow(); |
| 127 *web_contents = app_window->web_contents(); | 127 *web_contents = app_window->web_contents(); |
| 128 } else { | 128 } else { |
| 129 // If the owning window is still unknown, this could be a background page or | 129 // If the owning window is still unknown, this could be a background page or |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 426 } |
| 427 | 427 |
| 428 // Connect our listener to FileDialogFunction's per-tab callbacks. | 428 // Connect our listener to FileDialogFunction's per-tab callbacks. |
| 429 AddPending(routing_id); | 429 AddPending(routing_id); |
| 430 | 430 |
| 431 extension_dialog_ = dialog; | 431 extension_dialog_ = dialog; |
| 432 params_ = params; | 432 params_ = params; |
| 433 routing_id_ = routing_id; | 433 routing_id_ = routing_id; |
| 434 owner_window_ = owner_window; | 434 owner_window_ = owner_window; |
| 435 } | 435 } |
| OLD | NEW |