Chromium Code Reviews| 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 #import "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" | 67 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" |
| 68 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" | 68 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" |
| 69 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 69 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 70 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 70 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
| 71 #include "chrome/browser/ui/cocoa/task_manager_mac.h" | 71 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
| 72 #include "chrome/browser/ui/extensions/application_launch.h" | 72 #include "chrome/browser/ui/extensions/application_launch.h" |
| 73 #include "chrome/browser/ui/host_desktop.h" | 73 #include "chrome/browser/ui/host_desktop.h" |
| 74 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 74 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 75 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 75 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
| 76 #include "chrome/browser/ui/user_manager.h" | 76 #include "chrome/browser/ui/user_manager.h" |
| 77 #include "chrome/browser/web_applications/web_app_mac.h" | |
| 77 #include "chrome/common/chrome_paths_internal.h" | 78 #include "chrome/common/chrome_paths_internal.h" |
| 78 #include "chrome/common/chrome_switches.h" | 79 #include "chrome/common/chrome_switches.h" |
| 79 #include "chrome/common/cloud_print/cloud_print_class_mac.h" | 80 #include "chrome/common/cloud_print/cloud_print_class_mac.h" |
| 80 #include "chrome/common/extensions/extension_constants.h" | 81 #include "chrome/common/extensions/extension_constants.h" |
| 81 #include "chrome/common/mac/app_mode_common.h" | 82 #include "chrome/common/mac/app_mode_common.h" |
| 82 #include "chrome/common/pref_names.h" | 83 #include "chrome/common/pref_names.h" |
| 83 #include "chrome/common/url_constants.h" | 84 #include "chrome/common/url_constants.h" |
| 84 #include "chrome/grit/chromium_strings.h" | 85 #include "chrome/grit/chromium_strings.h" |
| 85 #include "chrome/grit/generated_resources.h" | 86 #include "chrome/grit/generated_resources.h" |
| 86 #include "components/handoff/handoff_utility.h" | 87 #include "components/handoff/handoff_utility.h" |
| 87 #include "components/signin/core/browser/signin_manager.h" | 88 #include "components/signin/core/browser/signin_manager.h" |
| 88 #include "components/signin/core/common/profile_management_switches.h" | 89 #include "components/signin/core/common/profile_management_switches.h" |
| 89 #include "content/public/browser/browser_thread.h" | 90 #include "content/public/browser/browser_thread.h" |
| 90 #include "content/public/browser/download_manager.h" | 91 #include "content/public/browser/download_manager.h" |
| 91 #include "content/public/browser/notification_service.h" | 92 #include "content/public/browser/notification_service.h" |
| 92 #include "content/public/browser/notification_types.h" | 93 #include "content/public/browser/notification_types.h" |
| 93 #include "content/public/browser/plugin_service.h" | 94 #include "content/public/browser/plugin_service.h" |
| 94 #include "content/public/browser/user_metrics.h" | 95 #include "content/public/browser/user_metrics.h" |
| 95 #include "extensions/browser/extension_system.h" | 96 #include "extensions/browser/extension_system.h" |
| 97 #include "extensions/browser/extension_registry.h" | |
| 96 #include "net/base/filename_util.h" | 98 #include "net/base/filename_util.h" |
| 97 #include "ui/base/cocoa/focus_window_set.h" | 99 #include "ui/base/cocoa/focus_window_set.h" |
| 98 #include "ui/base/l10n/l10n_util.h" | 100 #include "ui/base/l10n/l10n_util.h" |
| 99 #include "ui/base/l10n/l10n_util_mac.h" | 101 #include "ui/base/l10n/l10n_util_mac.h" |
| 100 | 102 |
| 101 using base::UserMetricsAction; | 103 using base::UserMetricsAction; |
| 102 using content::BrowserContext; | 104 using content::BrowserContext; |
| 103 using content::BrowserThread; | 105 using content::BrowserThread; |
| 104 using content::DownloadManager; | 106 using content::DownloadManager; |
| 105 | 107 |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1180 | 1182 |
| 1181 // Bring all browser windows to the front. Specifically, this brings them in | 1183 // Bring all browser windows to the front. Specifically, this brings them in |
| 1182 // front of any app windows. FocusWindowSet will also unminimize the most | 1184 // front of any app windows. FocusWindowSet will also unminimize the most |
| 1183 // recently minimized window if no windows in the set are visible. | 1185 // recently minimized window if no windows in the set are visible. |
| 1184 // If there are any, return here. Otherwise, the windows are panels or | 1186 // If there are any, return here. Otherwise, the windows are panels or |
| 1185 // notifications so we still need to open a new window. | 1187 // notifications so we still need to open a new window. |
| 1186 if (hasVisibleWindows) { | 1188 if (hasVisibleWindows) { |
| 1187 std::set<NSWindow*> browserWindows; | 1189 std::set<NSWindow*> browserWindows; |
| 1188 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { | 1190 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { |
| 1189 Browser* browser = *iter; | 1191 Browser* browser = *iter; |
| 1192 if (browser && browser->is_app()) { | |
| 1193 extensions::ExtensionRegistry* registry = | |
| 1194 extensions::ExtensionRegistry::Get(browser->profile()); | |
| 1195 const extensions::Extension* extension = registry->GetExtensionById( | |
| 1196 web_app::GetExtensionIdFromApplicationName(browser->app_name()), | |
| 1197 extensions::ExtensionRegistry::ENABLED); | |
| 1198 if (extension->is_hosted_app()) { | |
|
jackhou1
2014/12/11 02:43:18
The goal here is to identify windows that are not
mitchellj
2014/12/12 00:03:45
Done.
| |
| 1199 continue; | |
| 1200 } | |
| 1201 } | |
| 1190 browserWindows.insert(browser->window()->GetNativeWindow()); | 1202 browserWindows.insert(browser->window()->GetNativeWindow()); |
| 1191 } | 1203 } |
| 1192 if (!browserWindows.empty()) { | 1204 if (!browserWindows.empty()) { |
| 1193 NSWindow* keyWindow = [NSApp keyWindow]; | 1205 NSWindow* keyWindow = [NSApp keyWindow]; |
| 1194 if (keyWindow && ![keyWindow isOnActiveSpace]) { | 1206 if (keyWindow && ![keyWindow isOnActiveSpace]) { |
| 1195 // The key window is not on the active space. We must be mid-animation | 1207 // The key window is not on the active space. We must be mid-animation |
| 1196 // for a space transition triggered by the dock. Delay the call to | 1208 // for a space transition triggered by the dock. Delay the call to |
| 1197 // |ui::FocusWindowSet| until the transition completes. Otherwise, the | 1209 // |ui::FocusWindowSet| until the transition completes. Otherwise, the |
| 1198 // wrong space's windows get raised, resulting in an off-screen key | 1210 // wrong space's windows get raised, resulting in an off-screen key |
| 1199 // window. It does not work to |ui::FocusWindowSet| twice, once here | 1211 // window. It does not work to |ui::FocusWindowSet| twice, once here |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1642 | 1654 |
| 1643 //--------------------------------------------------------------------------- | 1655 //--------------------------------------------------------------------------- |
| 1644 | 1656 |
| 1645 namespace app_controller_mac { | 1657 namespace app_controller_mac { |
| 1646 | 1658 |
| 1647 bool IsOpeningNewWindow() { | 1659 bool IsOpeningNewWindow() { |
| 1648 return g_is_opening_new_window; | 1660 return g_is_opening_new_window; |
| 1649 } | 1661 } |
| 1650 | 1662 |
| 1651 } // namespace app_controller_mac | 1663 } // namespace app_controller_mac |
| OLD | NEW |