| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "ash/common/login_status.h" | 8 #include "ash/common/login_status.h" |
| 9 #include "ash/common/material_design/material_design_controller.h" | |
| 10 #include "ash/common/strings/grit/ash_strings.h" | 9 #include "ash/common/strings/grit/ash_strings.h" |
| 11 #include "ash/common/system/date/date_default_view.h" | 10 #include "ash/common/system/date/date_default_view.h" |
| 12 #include "ash/common/system/date/tray_date.h" | 11 #include "ash/common/system/date/tray_date.h" |
| 13 #include "ash/common/system/tiles/tiles_default_view.h" | 12 #include "ash/common/system/tiles/tiles_default_view.h" |
| 14 #include "ash/common/system/tiles/tray_tiles.h" | 13 #include "ash/common/system/tiles/tray_tiles.h" |
| 15 #include "ash/common/system/tray/system_tray.h" | 14 #include "ash/common/system/tray/system_tray.h" |
| 16 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 17 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 18 #include "base/location.h" | 17 #include "base/location.h" |
| 19 #include "base/macros.h" | 18 #include "base/macros.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 152 } |
| 154 | 153 |
| 155 // Closes the system tray menu. This deletes the tray views. | 154 // Closes the system tray menu. This deletes the tray views. |
| 156 void CloseSystemTrayMenu() { | 155 void CloseSystemTrayMenu() { |
| 157 ash::Shell::GetInstance()->GetPrimarySystemTray()->CloseSystemBubble(); | 156 ash::Shell::GetInstance()->GetPrimarySystemTray()->CloseSystemBubble(); |
| 158 } | 157 } |
| 159 | 158 |
| 160 // Gets the shutdown button view. | 159 // Gets the shutdown button view. |
| 161 const views::View* GetShutdownButton() { | 160 const views::View* GetShutdownButton() { |
| 162 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); | 161 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); |
| 163 if (ash::MaterialDesignController::IsSystemTrayMenuMaterial()) { | 162 return tray->GetTrayTilesForTesting() |
| 164 return tray->GetTrayTilesForTesting() | |
| 165 ->GetDefaultViewForTesting() | |
| 166 ->GetShutdownButtonViewForTest(); | |
| 167 } | |
| 168 return tray->GetTrayDateForTesting() | |
| 169 ->GetDefaultViewForTesting() | 163 ->GetDefaultViewForTesting() |
| 170 ->GetShutdownButtonViewForTest(); | 164 ->GetShutdownButtonViewForTest(); |
| 171 } | 165 } |
| 172 | 166 |
| 173 // Returns true if the shutdown button's tooltip matches the text of the | 167 // Returns true if the shutdown button's tooltip matches the text of the |
| 174 // resource |message_id|. | 168 // resource |message_id|. |
| 175 bool HasShutdownButtonTooltip(int message_id) { | 169 bool HasShutdownButtonTooltip(int message_id) { |
| 176 const views::View* button = GetShutdownButton(); | 170 const views::View* button = GetShutdownButton(); |
| 177 base::string16 actual_tooltip; | 171 base::string16 actual_tooltip; |
| 178 button->GetTooltipText(gfx::Point(), &actual_tooltip); | 172 button->GetTooltipText(gfx::Point(), &actual_tooltip); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 PrepareAndRunScript("restart-header-bar-item", false); | 335 PrepareAndRunScript("restart-header-bar-item", false); |
| 342 PrepareAndRunScript("shutdown-header-bar-item", true); | 336 PrepareAndRunScript("shutdown-header-bar-item", true); |
| 343 | 337 |
| 344 UpdateRebootOnShutdownPolicy(false); | 338 UpdateRebootOnShutdownPolicy(false); |
| 345 RefreshDevicePolicy(); | 339 RefreshDevicePolicy(); |
| 346 PrepareAndRunScript("restart-header-bar-item", true); | 340 PrepareAndRunScript("restart-header-bar-item", true); |
| 347 PrepareAndRunScript("shutdown-header-bar-item", false); | 341 PrepareAndRunScript("shutdown-header-bar-item", false); |
| 348 } | 342 } |
| 349 | 343 |
| 350 } // namespace chromeos | 344 } // namespace chromeos |
| OLD | NEW |