Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1119)

Side by Side Diff: chrome/browser/ui/app_list/app_list_service_mac.h

Issue 2131463002: Purge the App Launcher code from Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Zap mac-specific icon assets Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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_APP_LIST_APP_LIST_SERVICE_MAC_H_
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #include <memory>
11
12 #include "base/mac/scoped_nsobject.h"
13 #include "base/macros.h"
14 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h"
15 #include "chrome/browser/ui/app_list/app_list_service_impl.h"
16
17 @class AppListAnimationController;
18
19 namespace display {
20 class Display;
21 }
22
23 namespace gfx {
24 class Point;
25 }
26
27 // AppListServiceMac manages global resources needed for the app list to
28 // operate, and controls when and how the app list is opened and closed.
29 class AppListServiceMac : public AppListServiceImpl,
30 public apps::AppShimHandler {
31 public:
32 ~AppListServiceMac() override;
33
34 // Finds the position for a window to anchor it to the dock. This chooses the
35 // most appropriate position for the window based on whether the dock exists,
36 // the position of the dock (calculated by the difference between the display
37 // bounds and display work area), whether the mouse cursor is visible and its
38 // position. Sets |target_origin| to the coordinates for the window to appear
39 // at, and |start_origin| to the coordinates the window should begin animating
40 // from. Coordinates are for the bottom-left coordinate of the window, in
41 // AppKit space (Y positive is up).
42 static void FindAnchorPoint(const gfx::Size& window_size,
43 const display::Display& display,
44 int primary_display_height,
45 bool cursor_is_visible,
46 const gfx::Point& cursor,
47 NSPoint* target_origin,
48 NSPoint* start_origin);
49
50 void ShowWindowNearDock();
51 void WindowAnimationDidEnd();
52 void InitWithProfilePath(Profile* initial_profile,
53 const base::FilePath& profile_path);
54
55 // AppListService overrides:
56 void Init(Profile* initial_profile) override;
57 void DismissAppList() override;
58 void ShowForCustomLauncherPage(Profile* profile) override;
59 void HideCustomLauncherPage() override;
60 bool IsAppListVisible() const override;
61 void EnableAppList(Profile* initial_profile,
62 AppListEnableSource enable_source) override;
63 gfx::NativeWindow GetAppListWindow() override;
64 void CreateShortcut() override;
65
66 // AppShimHandler overrides:
67 void OnShimLaunch(apps::AppShimHandler::Host* host,
68 apps::AppShimLaunchType launch_type,
69 const std::vector<base::FilePath>& files) override;
70 void OnShimClose(apps::AppShimHandler::Host* host) override;
71 void OnShimFocus(apps::AppShimHandler::Host* host,
72 apps::AppShimFocusType focus_type,
73 const std::vector<base::FilePath>& files) override;
74 void OnShimSetHidden(apps::AppShimHandler::Host* host, bool hidden) override;
75 void OnShimQuit(apps::AppShimHandler::Host* host) override;
76
77 protected:
78 AppListServiceMac();
79
80 // Returns the native window for the app list, or nil if can't be shown yet.
81 // Note that, unlike GetAppListWindow(), this does not return null when the
82 // app list is loaded, but not visible.
83 virtual NSWindow* GetNativeWindow() const = 0;
84
85 // If the app list is loaded, return true. Otherwise, if supported,
86 // synchronously prepare an unpopulated app list window to begin showing on
87 // screen and return true. If that's not supported, return false.
88 virtual bool ReadyToShow() = 0;
89
90 private:
91 base::scoped_nsobject<AppListAnimationController> animation_controller_;
92 base::scoped_nsobject<NSRunningApplication> previously_active_application_;
93 NSPoint last_start_origin_;
94
95 DISALLOW_COPY_AND_ASSIGN(AppListServiceMac);
96 };
97
98 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698