- add sources.
[platform/framework/web/crosswalk.git] / src / ash / first_run / first_run_helper_impl.cc
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
3 // found in the LICENSE file.
4
5 #include "ash/first_run/first_run_helper_impl.h"
6
7 #include "ash/launcher/launcher.h"
8 #include "ash/shell.h"
9 #include "base/logging.h"
10 #include "ui/app_list/views/app_list_view.h"
11 #include "ui/aura/window.h"
12 #include "ui/gfx/rect.h"
13 #include "ui/views/view.h"
14
15 namespace ash {
16
17 FirstRunHelperImpl::FirstRunHelperImpl() {}
18
19 void FirstRunHelperImpl::OpenAppList() {
20   if (Shell::GetInstance()->GetAppListTargetVisibility())
21     return;
22   Shell::GetInstance()->ToggleAppList(NULL);
23 }
24
25 void FirstRunHelperImpl::CloseAppList() {
26   if (!Shell::GetInstance()->GetAppListTargetVisibility())
27     return;
28   Shell::GetInstance()->ToggleAppList(NULL);
29 }
30
31 gfx::Rect FirstRunHelperImpl::GetLauncherBounds() {
32   ash::Launcher* launcher = ash::Launcher::ForPrimaryDisplay();
33   return launcher->GetVisibleItemsBoundsInScreen();
34 }
35
36 gfx::Rect FirstRunHelperImpl::GetAppListButtonBounds() {
37   ash::Launcher* launcher = ash::Launcher::ForPrimaryDisplay();
38   views::View* app_button = launcher->GetAppListButtonView();
39   return app_button->GetBoundsInScreen();
40 }
41
42 gfx::Rect FirstRunHelperImpl::GetAppListBounds() {
43   app_list::AppListView* view = Shell::GetInstance()->GetAppListView();
44   CHECK(view);
45   return view->GetBoundsInScreen();
46 }
47
48 }  // namespace ash
49