blob: 80959d90a4d0a0d3e9640cea0a422a49c3bedbd4 [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/first_run/steps/tray_step.h"
#include "ash/first_run/first_run_helper.h"
#include "ash/shell.h"
#include "base/i18n/rtl.h"
#include "chrome/browser/chromeos/first_run/step_names.h"
#include "chrome/browser/ui/webui/chromeos/first_run/first_run_actor.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
namespace chromeos {
namespace first_run {
TrayStep::TrayStep(ash::FirstRunHelper* shell_helper, FirstRunActor* actor)
: Step(kTrayStep, shell_helper, actor) {
}
void TrayStep::DoShow() {
if (!shell_helper()->IsTrayBubbleOpened())
shell_helper()->OpenTrayBubble();
gfx::Rect bounds = shell_helper()->GetTrayBubbleBounds();
actor()->AddRectangularHole(bounds.x(), bounds.y(), bounds.width(),
bounds.height());
FirstRunActor::StepPosition position;
position.SetTop(bounds.y());
ash::Shell* shell = ash::Shell::GetInstance();
ash::ShelfAlignment alignment =
shell->GetShelfAlignment(shell->GetPrimaryRootWindow());
if ((!base::i18n::IsRTL() && alignment != ash::SHELF_ALIGNMENT_LEFT) ||
alignment == ash::SHELF_ALIGNMENT_RIGHT)
position.SetRight(GetOverlaySize().width() - bounds.x());
else
position.SetLeft(bounds.right());
actor()->ShowStepPositioned(name(), position);
}
} // namespace first_run
} // namespace chromeos