| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ash/system_tray_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 70 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 71 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h" | 71 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h" |
| 72 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" | 72 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" |
| 73 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 73 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 74 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" | 74 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" |
| 75 #include "chrome/browser/ui/ash/system_tray_client.h" | 75 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 76 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" | 76 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" |
| 77 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" | 77 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" |
| 78 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" | 78 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" |
| 79 #include "chrome/browser/ui/browser.h" | 79 #include "chrome/browser/ui/browser.h" |
| 80 #include "chrome/browser/ui/browser_finder.h" | |
| 81 #include "chrome/browser/ui/browser_list.h" | 80 #include "chrome/browser/ui/browser_list.h" |
| 82 #include "chrome/browser/ui/chrome_pages.h" | 81 #include "chrome/browser/ui/chrome_pages.h" |
| 83 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 82 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 84 #include "chrome/browser/ui/singleton_tabs.h" | 83 #include "chrome/browser/ui/singleton_tabs.h" |
| 85 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
| 86 #include "chrome/browser/upgrade_detector.h" | 84 #include "chrome/browser/upgrade_detector.h" |
| 87 #include "chrome/common/chrome_switches.h" | 85 #include "chrome/common/chrome_switches.h" |
| 88 #include "chrome/common/pref_names.h" | 86 #include "chrome/common/pref_names.h" |
| 89 #include "chrome/common/url_constants.h" | 87 #include "chrome/common/url_constants.h" |
| 90 #include "chrome/grit/generated_resources.h" | 88 #include "chrome/grit/generated_resources.h" |
| 91 #include "chrome/grit/locale_settings.h" | 89 #include "chrome/grit/locale_settings.h" |
| 92 #include "chromeos/dbus/dbus_thread_manager.h" | 90 #include "chromeos/dbus/dbus_thread_manager.h" |
| 93 #include "chromeos/dbus/session_manager_client.h" | 91 #include "chromeos/dbus/session_manager_client.h" |
| 94 #include "chromeos/login/login_state.h" | 92 #include "chromeos/login/login_state.h" |
| 95 #include "chromeos/network/portal_detector/network_portal_detector.h" | 93 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 96 #include "components/google/core/browser/google_util.h" | 94 #include "components/google/core/browser/google_util.h" |
| 97 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 95 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 98 #include "components/prefs/pref_service.h" | 96 #include "components/prefs/pref_service.h" |
| 99 #include "components/user_manager/user.h" | 97 #include "components/user_manager/user.h" |
| 100 #include "components/user_manager/user_manager.h" | 98 #include "components/user_manager/user_manager.h" |
| 101 #include "components/user_manager/user_type.h" | 99 #include "components/user_manager/user_type.h" |
| 102 #include "content/public/browser/notification_observer.h" | 100 #include "content/public/browser/notification_observer.h" |
| 103 #include "content/public/browser/notification_service.h" | 101 #include "content/public/browser/notification_service.h" |
| 104 #include "content/public/browser/user_metrics.h" | 102 #include "content/public/browser/user_metrics.h" |
| 105 #include "content/public/browser/web_contents.h" | |
| 106 #include "device/bluetooth/bluetooth_adapter.h" | 103 #include "device/bluetooth/bluetooth_adapter.h" |
| 107 #include "device/bluetooth/bluetooth_adapter_factory.h" | 104 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 108 #include "device/bluetooth/bluetooth_device.h" | 105 #include "device/bluetooth/bluetooth_device.h" |
| 109 #include "third_party/cros_system_api/dbus/service_constants.h" | 106 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 110 #include "ui/base/ime/chromeos/extension_ime_util.h" | 107 #include "ui/base/ime/chromeos/extension_ime_util.h" |
| 111 #include "ui/base/ime/chromeos/ime_keyboard.h" | 108 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| 112 #include "ui/base/ime/chromeos/input_method_manager.h" | 109 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 113 #include "ui/base/l10n/l10n_util.h" | 110 #include "ui/base/l10n/l10n_util.h" |
| 114 #include "ui/base/l10n/time_format.h" | 111 #include "ui/base/l10n/time_format.h" |
| 115 #include "ui/chromeos/ime/input_method_menu_item.h" | 112 #include "ui/chromeos/ime/input_method_menu_item.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 ash::WmShell* wm_shell = ash::WmShell::Get(); | 391 ash::WmShell* wm_shell = ash::WmShell::Get(); |
| 395 return ChromeUserManager::Get()->GetCurrentUserFlow()->ShouldShowSettings() && | 392 return ChromeUserManager::Get()->GetCurrentUserFlow()->ShouldShowSettings() && |
| 396 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 393 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
| 397 } | 394 } |
| 398 | 395 |
| 399 void SystemTrayDelegateChromeOS::ShowSetTimeDialog() { | 396 void SystemTrayDelegateChromeOS::ShowSetTimeDialog() { |
| 400 // TODO(mash): Refactor out GetNativeWindow and move to SystemTrayClient. | 397 // TODO(mash): Refactor out GetNativeWindow and move to SystemTrayClient. |
| 401 SetTimeDialog::ShowDialog(GetNativeWindow()); | 398 SetTimeDialog::ShowDialog(GetNativeWindow()); |
| 402 } | 399 } |
| 403 | 400 |
| 404 bool SystemTrayDelegateChromeOS::ShouldShowDisplayNotification() { | |
| 405 // Packaged app is not counted as 'last active', so if a browser opening the | |
| 406 // display settings is in background of a packaged app, it will return true. | |
| 407 // TODO(mukai): fix this. | |
| 408 Browser* active_browser = chrome::FindLastActive(); | |
| 409 if (!active_browser) | |
| 410 return true; | |
| 411 | |
| 412 content::WebContents* active_contents = | |
| 413 active_browser->tab_strip_model()->GetActiveWebContents(); | |
| 414 if (!active_contents) | |
| 415 return true; | |
| 416 | |
| 417 GURL visible_url = active_contents->GetLastCommittedURL(); | |
| 418 return !chrome::IsSettingsSubPage( | |
| 419 visible_url, SystemTrayClient::kDisplaySettingsSubPageName) && | |
| 420 !chrome::IsSettingsSubPage( | |
| 421 visible_url, | |
| 422 SystemTrayClient::kDisplayOverscanSettingsSubPageName); | |
| 423 } | |
| 424 | |
| 425 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { | 401 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { |
| 426 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient. | 402 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient. |
| 427 ash::LoginStatus status = GetUserLoginStatus(); | 403 ash::LoginStatus status = GetUserLoginStatus(); |
| 428 ash::WmShell* wm_shell = ash::WmShell::Get(); | 404 ash::WmShell* wm_shell = ash::WmShell::Get(); |
| 429 if (status == ash::LoginStatus::NOT_LOGGED_IN || | 405 if (status == ash::LoginStatus::NOT_LOGGED_IN || |
| 430 status == ash::LoginStatus::LOCKED || | 406 status == ash::LoginStatus::LOCKED || |
| 431 wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) { | 407 wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) { |
| 432 scoped_refptr<chromeos::HelpAppLauncher> help_app( | 408 scoped_refptr<chromeos::HelpAppLauncher> help_app( |
| 433 new chromeos::HelpAppLauncher(GetNativeWindow())); | 409 new chromeos::HelpAppLauncher(GetNativeWindow())); |
| 434 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE); | 410 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE); |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1168 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1193 << "ENABLE_SUPERVISED_USERS undefined."; | 1169 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1194 return base::string16(); | 1170 return base::string16(); |
| 1195 } | 1171 } |
| 1196 | 1172 |
| 1197 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1173 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1198 return new SystemTrayDelegateChromeOS(); | 1174 return new SystemTrayDelegateChromeOS(); |
| 1199 } | 1175 } |
| 1200 | 1176 |
| 1201 } // namespace chromeos | 1177 } // namespace chromeos |
| OLD | NEW |