app_list_controller_delegate_views.cc revision 116680a4aac90f2aa7413d9095a592090648e557
1// Copyright 2014 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 "chrome/browser/ui/app_list/app_list_controller_delegate_views.h"
6
7#include "chrome/browser/ui/app_list/app_list_service_views.h"
8#include "ui/app_list/views/app_list_view.h"
9
10AppListControllerDelegateViews::AppListControllerDelegateViews(
11    AppListServiceViews* service)
12    : AppListControllerDelegateImpl(service),
13      service_(service) {
14}
15
16AppListControllerDelegateViews::~AppListControllerDelegateViews() {}
17
18gfx::Rect AppListControllerDelegateViews::GetAppListBounds() {
19  // We use the bounds of the app list view here because the bounds of the app
20  // list window include the shadow behind it (and the shadow size varies across
21  // platforms).
22  app_list::AppListView* app_list_view = service_->shower().app_list();
23  if (app_list_view)
24    return app_list_view->GetBoundsInScreen();
25  return gfx::Rect();
26}
27
28void AppListControllerDelegateViews::ViewClosing() {
29  service_->OnViewBeingDestroyed();
30}
31
32void AppListControllerDelegateViews::OnShowChildDialog() {
33  DCHECK(service_->shower().app_list());
34  service_->shower().app_list()->SetAppListOverlayVisible(true);
35  service_->set_can_dismiss(false);
36}
37
38void AppListControllerDelegateViews::OnCloseChildDialog() {
39  DCHECK(service_->shower().app_list());
40  service_->shower().app_list()->SetAppListOverlayVisible(false);
41  service_->set_can_dismiss(true);
42}
43
44bool AppListControllerDelegateViews::CanDoCreateShortcutsFlow() {
45  return true;
46}
47