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/chromeos/first_run/steps/tray_step.h" | 5 #include "chrome/browser/chromeos/first_run/steps/tray_step.h" |
6 | 6 |
7 #include "ash/first_run/first_run_helper.h" | 7 #include "ash/first_run/first_run_helper.h" |
8 #include "ash/shelf/wm_shelf.h" | 8 #include "ash/shelf/wm_shelf.h" |
9 #include "ash/shell_port.h" | 9 #include "ash/shell.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "chrome/browser/chromeos/first_run/step_names.h" | 11 #include "chrome/browser/chromeos/first_run/step_names.h" |
12 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_actor.h" | 12 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_actor.h" |
13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 namespace first_run { | 17 namespace first_run { |
18 | 18 |
19 TrayStep::TrayStep(ash::FirstRunHelper* shell_helper, FirstRunActor* actor) | 19 TrayStep::TrayStep(ash::FirstRunHelper* shell_helper, FirstRunActor* actor) |
20 : Step(kTrayStep, shell_helper, actor) { | 20 : Step(kTrayStep, shell_helper, actor) { |
21 } | 21 } |
22 | 22 |
23 void TrayStep::DoShow() { | 23 void TrayStep::DoShow() { |
24 if (!shell_helper()->IsTrayBubbleOpened()) | 24 if (!shell_helper()->IsTrayBubbleOpened()) |
25 shell_helper()->OpenTrayBubble(); | 25 shell_helper()->OpenTrayBubble(); |
26 gfx::Rect bounds = shell_helper()->GetTrayBubbleBounds(); | 26 gfx::Rect bounds = shell_helper()->GetTrayBubbleBounds(); |
27 actor()->AddRectangularHole(bounds.x(), bounds.y(), bounds.width(), | 27 actor()->AddRectangularHole(bounds.x(), bounds.y(), bounds.width(), |
28 bounds.height()); | 28 bounds.height()); |
29 FirstRunActor::StepPosition position; | 29 FirstRunActor::StepPosition position; |
30 position.SetTop(bounds.y()); | 30 position.SetTop(bounds.y()); |
31 ash::ShelfAlignment alignment = | 31 ash::ShelfAlignment alignment = |
32 ash::WmShelf::ForWindow(ash::ShellPort::Get()->GetPrimaryRootWindow()) | 32 ash::WmShelf::ForWindow(ash::Shell::GetPrimaryRootWindow())->alignment(); |
33 ->alignment(); | |
34 if ((!base::i18n::IsRTL() && alignment != ash::SHELF_ALIGNMENT_LEFT) || | 33 if ((!base::i18n::IsRTL() && alignment != ash::SHELF_ALIGNMENT_LEFT) || |
35 alignment == ash::SHELF_ALIGNMENT_RIGHT) | 34 alignment == ash::SHELF_ALIGNMENT_RIGHT) |
36 position.SetRight(GetOverlaySize().width() - bounds.x()); | 35 position.SetRight(GetOverlaySize().width() - bounds.x()); |
37 else | 36 else |
38 position.SetLeft(bounds.right()); | 37 position.SetLeft(bounds.right()); |
39 actor()->ShowStepPositioned(name(), position); | 38 actor()->ShowStepPositioned(name(), position); |
40 } | 39 } |
41 | 40 |
42 } // namespace first_run | 41 } // namespace first_run |
43 } // namespace chromeos | 42 } // namespace chromeos |
44 | 43 |
OLD | NEW |