app_list_win.h revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
18b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org// Copyright 2013 The Chromium Authors. All rights reserved. 28b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org// Use of this source code is governed by a BSD-style license that can be 38b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org// found in the LICENSE file. 48b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org 58b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org#ifndef CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_WIN_H_ 68b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org#define CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_WIN_H_ 78b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org 88b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org#include "base/callback_forward.h" 98b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org#include "chrome/browser/ui/app_list/app_list.h" 108b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org#include "chrome/browser/ui/views/app_list/win/activation_tracker_win.h" 118b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org#include "ui/app_list/views/app_list_view.h" 128b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org 138b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.orgnamespace gfx { 148b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.orgclass Display; 158b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.orgclass Point; 168b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.orgclass Size; 178b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org} // namespace gfx 188b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org 198b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org// Responsible for positioning, hiding and showing an AppListView on Windows. 208b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org// This includes watching window activation/deactivation messages to determine 218b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org// if the user has clicked away from it. 228b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.orgclass AppListWin : public AppList { 238b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org public: 248b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org AppListWin(app_list::AppListView* view, 258b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org const base::Closure& on_should_dismiss); 268b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org virtual ~AppListWin(); 278b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org 288b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org // Finds the position for a window to anchor it to the taskbar. This chooses 298b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org // the most appropriate position for the window based on whether the taskbar 308b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org // exists, the position of the taskbar, and the mouse cursor. Returns the 318b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org // intended coordinates for the center of the window. If |taskbar_rect| is 328b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org // empty, assumes there is no taskbar on the given display. 338b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org static gfx::Point FindAnchorPoint(const gfx::Size& view_size, 348b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org const gfx::Display& display, 358b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org const gfx::Point& cursor, 368b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org const gfx::Rect& taskbar_rect); 378b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org 388b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org // AppList overrides. 398b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org virtual void Show() OVERRIDE; 408b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org virtual void Hide() OVERRIDE; 418b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org virtual void MoveNearCursor() OVERRIDE; 428b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org virtual bool IsVisible() OVERRIDE; 438b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org virtual void Prerender() OVERRIDE; 448b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org virtual void ReactivateOnNextFocusLoss() OVERRIDE; 458b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org virtual gfx::NativeWindow GetWindow() OVERRIDE; 468b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org virtual void SetProfile(Profile* profile) OVERRIDE; 478b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org 488b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org private: 498b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org // Weak pointer. The view manages its own lifetime. 508b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org app_list::AppListView* view_; 518b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org ActivationTrackerWin activation_tracker_; 528b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org bool window_icon_updated_; 538b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org 548b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org DISALLOW_COPY_AND_ASSIGN(AppListWin); 558b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org}; 568b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org 578b79028d27653fafcde6901affba48b987b52e43commit-bot@chromium.org#endif // CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_WIN_H_ 58