app_list_linux.h revision 010d83a9304c5a91596085d917d248abff47903a
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#ifndef CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_LINUX_H_
6#define CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_LINUX_H_
7
8#include "chrome/browser/ui/app_list/app_list_positioner.h"
9
10namespace app_list {
11class AppListView;
12}
13
14namespace gfx {
15class Display;
16class Point;
17class Size;
18}  // namespace gfx
19
20// Responsible for positioning an AppListView on Linux.
21// TODO(tapted): Shouldn't be a class - move the static member functions out.
22class AppListLinux {
23 public:
24  // Determines which screen edge the shelf is aligned to. This tries to find
25  // the edge of the surface where the user normally launches apps from (so, for
26  // example, on Gnome Classic, this is the applications menu, not the taskbar).
27  static AppListPositioner::ScreenEdge ShelfLocationInDisplay(
28      const gfx::Display& display);
29
30  // Finds the position for a window to anchor it to the shelf. This chooses the
31  // most appropriate position for the window based on whether the shelf exists,
32  // the position of the shelf, and the mouse cursor. Returns the intended
33  // coordinates for the center of the window. If |shelf_rect| is empty, assumes
34  // there is no shelf on the given display.
35  static gfx::Point FindAnchorPoint(const gfx::Size& view_size,
36                                    const gfx::Display& display,
37                                    const gfx::Point& cursor,
38                                    AppListPositioner::ScreenEdge edge,
39                                    bool center_window);
40
41  static void MoveNearCursor(app_list::AppListView* view);
42};
43
44#endif  // CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_LINUX_H_
45