Commit 9eda0c61 authored by pkotwicz's avatar pkotwicz Committed by Commit bot

Make login code not depend on Ash when use_athena=1

BUG=426561
TEST=None

Review URL: https://codereview.chromium.org/689683004

Cr-Commit-Position: refs/heads/master@{#302270}
parent 2f4ed501
......@@ -6,7 +6,6 @@
#include <vector>
#include "ash/ash_switches.h"
#include "base/command_line.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
......@@ -47,6 +46,10 @@
#include "ui/wm/core/wm_core_switches.h"
#include "url/gurl.h"
#if !defined(USE_ATHENA)
#include "ash/ash_switches.h"
#endif
using content::BrowserThread;
namespace chromeos {
......@@ -163,6 +166,7 @@ std::string DeriveCommandLine(const GURL& start_url,
#endif
app_list::switches::kDisableSyncAppList,
app_list::switches::kEnableSyncAppList,
#if !defined(USE_ATHENA)
ash::switches::kAshDefaultWallpaperLarge,
ash::switches::kAshDefaultWallpaperSmall,
ash::switches::kAshGuestWallpaperLarge,
......@@ -170,6 +174,7 @@ std::string DeriveCommandLine(const GURL& start_url,
ash::switches::kAshHostWindowBounds,
ash::switches::kAshTouchHud,
ash::switches::kAuraLegacyPowerButton,
#endif
// Please keep these in alphabetical order. Non-UI Compositor switches
// here should also be added to
// content/browser/renderer_host/render_process_host_impl.cc.
......
......@@ -4,7 +4,6 @@
#include "chrome/browser/chromeos/login/helper.h"
#include "ash/shell.h"
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/grit/generated_resources.h"
......@@ -20,7 +19,8 @@
namespace chromeos {
gfx::Rect CalculateScreenBounds(const gfx::Size& size) {
gfx::Rect bounds(ash::Shell::GetScreen()->GetPrimaryDisplay().bounds());
gfx::Rect bounds =
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().bounds();
if (!size.IsEmpty()) {
int horizontal_diff = bounds.width() - size.width();
int vertical_diff = bounds.height() - size.height();
......
......@@ -4,9 +4,6 @@
#include "chrome/browser/chromeos/login/lock/webui_screen_locker.h"
#include "ash/shell.h"
#include "ash/wm/lock_state_controller.h"
#include "ash/wm/lock_state_observer.h"
#include "base/command_line.h"
#include "base/metrics/histogram.h"
#include "base/strings/utf_string_conversions.h"
......@@ -35,6 +32,11 @@
#include "ui/keyboard/keyboard_util.h"
#include "ui/views/controls/webview/webview.h"
#if !defined(USE_ATHENA)
#include "ash/wm/lock_state_controller.h"
#include "ash/wm/lock_state_observer.h"
#endif
namespace {
// URL which corresponds to the login WebUI.
......@@ -80,7 +82,8 @@ WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker)
}
void WebUIScreenLocker::LockScreen() {
gfx::Rect bounds(ash::Shell::GetScreen()->GetPrimaryDisplay().bounds());
gfx::Rect bounds =
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().bounds();
lock_time_ = base::TimeTicks::Now();
LockWindow* lock_window = LockWindow::Create();
......@@ -303,6 +306,7 @@ void WebUIScreenLocker::OnLockWindowReady() {
////////////////////////////////////////////////////////////////////////////////
// SessionLockStateObserver override.
#if !defined(USE_ATHENA)
void WebUIScreenLocker::OnLockStateEvent(
ash::LockStateObserver::EventType event) {
if (event == ash::LockStateObserver::EVENT_LOCK_ANIMATION_FINISHED) {
......@@ -312,6 +316,7 @@ void WebUIScreenLocker::OnLockStateEvent(
GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.animateOnceFullyDisplayed");
}
}
#endif
////////////////////////////////////////////////////////////////////////////////
// WidgetObserver override.
......@@ -350,6 +355,7 @@ void WebUIScreenLocker::RenderProcessGone(base::TerminationStatus status) {
////////////////////////////////////////////////////////////////////////////////
// ash::KeyboardStateObserver overrides.
#if !defined(USE_ATHENA)
void WebUIScreenLocker::OnVirtualKeyboardStateChanged(bool activated) {
if (keyboard::KeyboardController::GetInstance()) {
if (activated) {
......@@ -363,6 +369,7 @@ void WebUIScreenLocker::OnVirtualKeyboardStateChanged(bool activated) {
}
}
}
#endif
////////////////////////////////////////////////////////////////////////////////
// keyboard::KeyboardControllerObserver overrides.
......
......@@ -49,10 +49,14 @@ class WebUIScreenLocker : public WebUILoginView,
public LoginDisplay::Delegate,
public ScreenLockerDelegate,
public LockWindow::Observer,
#if !defined(USE_ATHENA)
public ash::LockStateObserver,
#endif
public views::WidgetObserver,
public PowerManagerClient::Observer,
#if !defined(USE_ATHENA)
public ash::VirtualKeyboardStateObserver,
#endif
public keyboard::KeyboardControllerObserver {
public:
explicit WebUIScreenLocker(ScreenLocker* screen_locker);
......@@ -99,9 +103,11 @@ class WebUIScreenLocker : public WebUILoginView,
// LockWindow::Observer implementation.
virtual void OnLockWindowReady() override;
#if !defined(USE_ATHENA)
// LockStateObserver override.
virtual void OnLockStateEvent(
ash::LockStateObserver::EventType event) override;
#endif
// WidgetObserver override.
virtual void OnWidgetDestroying(views::Widget* widget) override;
......@@ -114,8 +120,10 @@ class WebUIScreenLocker : public WebUILoginView,
// Overridden from content::WebContentsObserver:
virtual void RenderProcessGone(base::TerminationStatus status) override;
#if !defined(USE_ATHENA)
// Overridden from ash::KeyboardStateObserver:
virtual void OnVirtualKeyboardStateChanged(bool activated) override;
#endif
// Overridden from keyboard::KeyboardControllerObserver:
virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
......
......@@ -4,8 +4,6 @@
#include "chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.h"
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/shell.h"
#include "base/rand_util.h"
#include "base/values.h"
#include "chrome/browser/chromeos/camera_detector.h"
......@@ -39,6 +37,11 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/image/image_skia.h"
#if !defined(USE_ATHENA)
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/shell.h"
#endif
namespace chromeos {
namespace {
......@@ -359,8 +362,10 @@ void SupervisedUserCreationScreen::OnManagerFullyAuthenticated(
DCHECK(controller_.get());
// For manager user, move desktop to locked container so that windows created
// during the user image picker step are below it.
#if !defined(USE_ATHENA)
ash::Shell::GetInstance()->
desktop_background_controller()->MoveDesktopToLockedContainer();
#endif
controller_->SetManagerProfile(manager_profile);
if (actor_)
......
......@@ -6,11 +6,6 @@
#include <vector>
#include "ash/audio/sounds.h"
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/desktop_background/user_wallpaper_delegate.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
......@@ -42,7 +37,6 @@
#include "chrome/browser/chromeos/login/screens/core_oobe_actor.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/ui/input_events_blocker.h"
#include "chrome/browser/chromeos/login/ui/keyboard_driven_oobe_key_handler.h"
#include "chrome/browser/chromeos/login/ui/oobe_display.h"
#include "chrome/browser/chromeos/login/ui/webui_login_display.h"
#include "chrome/browser/chromeos/login/ui/webui_login_view.h"
......@@ -96,6 +90,15 @@
#include "ui/wm/core/window_animations.h"
#include "url/gurl.h"
#if !defined(USE_ATHENA)
#include "ash/audio/sounds.h"
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/desktop_background/user_wallpaper_delegate.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "chrome/browser/chromeos/login/ui/keyboard_driven_oobe_key_handler.h"
#endif
#if defined(USE_ATHENA)
#include "athena/screen/public/screen_manager.h"
#include "athena/util/container_priorities.h"
......@@ -458,10 +461,12 @@ void LoginDisplayHostImpl::BeforeSessionStart() {
void LoginDisplayHostImpl::Finalize() {
DVLOG(1) << "Session starting";
#if !defined(USE_ATHENA)
if (ash::Shell::HasInstance()) {
ash::Shell::GetInstance()->
desktop_background_controller()->MoveDesktopToUnlockedContainer();
}
#endif
if (wizard_controller_.get())
wizard_controller_->OnSessionStart();
......@@ -470,8 +475,10 @@ void LoginDisplayHostImpl::Finalize() {
ShutdownDisplayHost(false);
break;
case ANIMATION_WORKSPACE:
#if !defined(USE_ATHENA)
if (ash::Shell::HasInstance())
ScheduleWorkspaceAnimation();
#endif
ShutdownDisplayHost(false);
break;
......@@ -573,6 +580,7 @@ void LoginDisplayHostImpl::StartUserAdding(
// We should emit this signal only at login screen (after reboot or sign out).
login_view_->set_should_emit_login_prompt_visible(false);
#if !defined(USE_ATHENA)
// Lock container can be transparent after lock screen animation.
aura::Window* lock_container = ash::Shell::GetContainer(
ash::Shell::GetPrimaryRootWindow(),
......@@ -581,6 +589,7 @@ void LoginDisplayHostImpl::StartUserAdding(
ash::Shell::GetInstance()->
desktop_background_controller()->MoveDesktopToLockedContainer();
#endif
sign_in_controller_.reset(); // Only one controller in a time.
sign_in_controller_.reset(new chromeos::ExistingUserController(this));
......@@ -848,6 +857,7 @@ void LoginDisplayHostImpl::OnActiveOutputNodeChanged() {
TryToPlayStartupSound();
}
#if !defined(USE_ATHENA)
////////////////////////////////////////////////////////////////////////////////
// LoginDisplayHostImpl, ash::KeyboardStateObserver:
// implementation:
......@@ -865,6 +875,7 @@ void LoginDisplayHostImpl::OnVirtualKeyboardStateChanged(bool activated) {
}
}
}
#endif
////////////////////////////////////////////////////////////////////////////////
// LoginDisplayHostImpl, keyboard::KeyboardControllerObserver:
......@@ -902,13 +913,15 @@ void LoginDisplayHostImpl::OnDisplayRemoved(const gfx::Display& old_display) {
void LoginDisplayHostImpl::OnDisplayMetricsChanged(const gfx::Display& display,
uint32_t changed_metrics) {
if (display.id() != ash::Shell::GetScreen()->GetPrimaryDisplay().id() ||
gfx::Display primary_display =
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
if (display.id() != primary_display.id() ||
!(changed_metrics & DISPLAY_METRIC_BOUNDS)) {
return;
}
if (GetOobeUI()) {
const gfx::Size& size = ash::Shell::GetScreen()->GetPrimaryDisplay().size();
const gfx::Size& size = primary_display.size();
GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(),
size.height());
}
......@@ -942,6 +955,7 @@ void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) {
}
void LoginDisplayHostImpl::ScheduleWorkspaceAnimation() {
#if !defined(USE_ATHENA)
if (ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(),
ash::kShellWindowId_DesktopBackgroundContainer)
->children()
......@@ -954,6 +968,7 @@ void LoginDisplayHostImpl::ScheduleWorkspaceAnimation() {
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableLoginAnimations))
ash::Shell::GetInstance()->DoInitialWorkspaceAnimation();
#endif
}
void LoginDisplayHostImpl::ScheduleFadeOutAnimation() {
......@@ -1053,9 +1068,9 @@ void LoginDisplayHostImpl::InitLoginWindowAndView() {
// crbug.com/405859
focus_ring_controller_.reset(new FocusRingController);
focus_ring_controller_->SetVisible(true);
#endif
keyboard_driven_oobe_key_handler_.reset(new KeyboardDrivenOobeKeyHandler);
#endif
}
views::Widget::InitParams params(
......@@ -1149,13 +1164,13 @@ void LoginDisplayHostImpl::TryToPlayStartupSound() {
return;
}
#if !defined(USE_ATHENA)
if (!startup_sound_honors_spoken_feedback_ &&
!ash::PlaySystemSoundAlways(SOUND_STARTUP)) {
EnableSystemSoundsForAccessibility();
return;
}
#if !defined(USE_ATHENA)
// crbug.com/408733
if (startup_sound_honors_spoken_feedback_ &&
!ash::PlaySystemSoundIfSpokenFeedback(SOUND_STARTUP)) {
......
......@@ -8,7 +8,6 @@
#include <string>
#include <vector>
#include "ash/shell_delegate.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
......@@ -29,6 +28,10 @@
#include "ui/keyboard/keyboard_controller_observer.h"
#include "ui/views/widget/widget_removals_observer.h"
#if !defined(USE_ATHENA)
#include "ash/shell_delegate.h"
#endif
class PrefService;
namespace content {
......@@ -40,11 +43,14 @@ namespace chromeos {
class DemoAppLauncher;
class FocusRingController;
class KeyboardDrivenOobeKeyHandler;
class OobeUI;
class WebUILoginDisplay;
class WebUILoginView;
#if !defined(USE_ATHENA)
class KeyboardDrivenOobeKeyHandler;
#endif
// An implementation class for OOBE/login WebUI screen host.
// It encapsulates controllers, background integration and flow.
class LoginDisplayHostImpl : public LoginDisplayHost,
......@@ -52,7 +58,9 @@ class LoginDisplayHostImpl : public LoginDisplayHost,
public content::WebContentsObserver,
public chromeos::SessionManagerClient::Observer,
public chromeos::CrasAudioHandler::AudioObserver,
#if !defined(USE_ATHENA)
public ash::VirtualKeyboardStateObserver,
#endif
public keyboard::KeyboardControllerObserver,
public gfx::DisplayObserver,
public views::WidgetRemovalsObserver {
......@@ -123,8 +131,10 @@ class LoginDisplayHostImpl : public LoginDisplayHost,
// Overridden from chromeos::CrasAudioHandler::AudioObserver:
virtual void OnActiveOutputNodeChanged() override;
#if !defined(USE_ATHENA)
// Overridden from ash::KeyboardStateObserver:
virtual void OnVirtualKeyboardStateChanged(bool activated) override;
#endif
// Overridden from keyboard::KeyboardControllerObserver:
virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
......@@ -293,8 +303,10 @@ class LoginDisplayHostImpl : public LoginDisplayHost,
// driven oobe.
scoped_ptr<FocusRingController> focus_ring_controller_;
#if !defined(USE_ATHENA)
// Handles special keys for keyboard driven oobe.
scoped_ptr<KeyboardDrivenOobeKeyHandler> keyboard_driven_oobe_key_handler_;
#endif
FinalizeAnimationType finalize_animation_type_;
......
......@@ -4,8 +4,6 @@
#include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
#include "base/bind.h"
#include "base/memory/singleton.h"
#include "base/observer_list.h"
......@@ -19,6 +17,8 @@
#include "ui/gfx/size.h"
#if !defined(USE_ATHENA)
#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
#include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
#endif
......@@ -66,8 +66,10 @@ void UserAddingScreenImpl::Start() {
void UserAddingScreenImpl::Cancel() {
CHECK(IsRunning());
#if !defined(USE_ATHENA)
// Make sure that system tray is enabled after this flow.
ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(true);
#endif
display_host_->Finalize();
#if !defined(USE_ATHENA)
......
......@@ -7,7 +7,6 @@
#include <cstddef>
#include <set>
#include "ash/multi_profile_uma.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
......@@ -60,6 +59,7 @@
#include "ui/wm/core/wm_core_switches.h"
#if !defined(USE_ATHENA)
#include "ash/multi_profile_uma.h"
#include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
#endif
......@@ -1062,12 +1062,14 @@ void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) {
}
void ChromeUserManagerImpl::UpdateNumberOfUsers() {
#if !defined(USE_ATHENA)
size_t users = GetLoggedInUsers().size();
if (users) {
// Write the user number as UMA stat when a multi user session is possible.
if ((users + GetUsersAllowedForMultiProfile().size()) > 1)
ash::MultiProfileUMA::RecordUserCount(users);
}
#endif
base::debug::SetCrashKeyValue(
crash_keys::kNumberOfUsers,
......
......@@ -586,8 +586,6 @@
'browser/chromeos/login/ui/captive_portal_window_proxy.h',
'browser/chromeos/login/ui/input_events_blocker.cc',
'browser/chromeos/login/ui/input_events_blocker.h',
'browser/chromeos/login/ui/keyboard_driven_oobe_key_handler.cc',
'browser/chromeos/login/ui/keyboard_driven_oobe_key_handler.h',
'browser/chromeos/login/ui/lock_window.cc',
'browser/chromeos/login/ui/lock_window.h',
'browser/chromeos/login/ui/lock_window_aura.cc',
......@@ -948,6 +946,8 @@
'browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h',
'browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc',
'browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h',
'browser/chromeos/login/ui/keyboard_driven_oobe_key_handler.cc',
'browser/chromeos/login/ui/keyboard_driven_oobe_key_handler.h',
'browser/chromeos/login/users/wallpaper/wallpaper_manager.cc',
'browser/chromeos/login/users/wallpaper/wallpaper_manager.h',
'browser/chromeos/ui/kiosk_external_update_notification.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment