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

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

Issue 782673002: MacViews: tryjobs for toolkit_views=1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_ 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_ 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" 12 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h"
13 #include "chrome/browser/ui/app_list/app_list_service_impl.h" 13 #include "chrome/browser/ui/app_list/app_list_service_impl.h"
14 14
15 class AppListControllerDelegateImpl;
16
17 @class AppListAnimationController; 15 @class AppListAnimationController;
18 @class AppListWindowController;
19 template <typename T> struct DefaultSingletonTraits;
20 16
21 namespace gfx { 17 namespace gfx {
22 class Display; 18 class Display;
23 class Point; 19 class Point;
24 } 20 }
25 21
26 namespace test {
27 class AppListServiceMacTestApi;
28 }
29
30 // AppListServiceMac manages global resources needed for the app list to 22 // AppListServiceMac manages global resources needed for the app list to
31 // operate, and controls when the app list is opened and closed. 23 // operate, and controls when and how the app list is opened and closed.
32 class AppListServiceMac : public AppListServiceImpl, 24 class AppListServiceMac : public AppListServiceImpl,
33 public apps::AppShimHandler { 25 public apps::AppShimHandler {
34 public: 26 public:
35 ~AppListServiceMac() override; 27 ~AppListServiceMac() override;
36 28
37 static AppListServiceMac* GetInstance();
38
39 // Finds the position for a window to anchor it to the dock. This chooses the 29 // Finds the position for a window to anchor it to the dock. This chooses the
40 // most appropriate position for the window based on whether the dock exists, 30 // most appropriate position for the window based on whether the dock exists,
41 // the position of the dock (calculated by the difference between the display 31 // the position of the dock (calculated by the difference between the display
42 // bounds and display work area), whether the mouse cursor is visible and its 32 // bounds and display work area), whether the mouse cursor is visible and its
43 // position. Sets |target_origin| to the coordinates for the window to appear 33 // position. Sets |target_origin| to the coordinates for the window to appear
44 // at, and |start_origin| to the coordinates the window should begin animating 34 // at, and |start_origin| to the coordinates the window should begin animating
45 // from. Coordinates are for the bottom-left coordinate of the window, in 35 // from. Coordinates are for the bottom-left coordinate of the window, in
46 // AppKit space (Y positive is up). 36 // AppKit space (Y positive is up).
47 static void FindAnchorPoint(const gfx::Size& window_size, 37 static void FindAnchorPoint(const gfx::Size& window_size,
48 const gfx::Display& display, 38 const gfx::Display& display,
49 int primary_display_height, 39 int primary_display_height,
50 bool cursor_is_visible, 40 bool cursor_is_visible,
51 const gfx::Point& cursor, 41 const gfx::Point& cursor,
52 NSPoint* target_origin, 42 NSPoint* target_origin,
53 NSPoint* start_origin); 43 NSPoint* start_origin);
54 44
55 void ShowWindowNearDock(); 45 void ShowWindowNearDock();
56 void WindowAnimationDidEnd(); 46 void WindowAnimationDidEnd();
57 void InitWithProfilePath(Profile* initial_profile, 47 void InitWithProfilePath(Profile* initial_profile,
58 const base::FilePath& profile_path); 48 const base::FilePath& profile_path);
59 49
60 // AppListService overrides: 50 // AppListService overrides:
61 void Init(Profile* initial_profile) override; 51 void Init(Profile* initial_profile) override;
62 void ShowForProfile(Profile* requested_profile) override;
63 void DismissAppList() override; 52 void DismissAppList() override;
64 void ShowForCustomLauncherPage(Profile* profile) override; 53 void ShowForCustomLauncherPage(Profile* profile) override;
65 bool IsAppListVisible() const override; 54 bool IsAppListVisible() const override;
66 void EnableAppList(Profile* initial_profile, 55 void EnableAppList(Profile* initial_profile,
67 AppListEnableSource enable_source) override; 56 AppListEnableSource enable_source) override;
68 gfx::NativeWindow GetAppListWindow() override; 57 gfx::NativeWindow GetAppListWindow() override;
69 AppListControllerDelegate* GetControllerDelegate() override;
70 Profile* GetCurrentAppListProfile() override;
71 void CreateShortcut() override; 58 void CreateShortcut() override;
72 59
73 // AppListServiceImpl overrides: 60 // AppShimHandler overrides:
74 void CreateForProfile(Profile* requested_profile) override;
75 void DestroyAppList() override;
76
77 // AppShimHandler overrides:
78 void OnShimLaunch(apps::AppShimHandler::Host* host, 61 void OnShimLaunch(apps::AppShimHandler::Host* host,
79 apps::AppShimLaunchType launch_type, 62 apps::AppShimLaunchType launch_type,
80 const std::vector<base::FilePath>& files) override; 63 const std::vector<base::FilePath>& files) override;
81 void OnShimClose(apps::AppShimHandler::Host* host) override; 64 void OnShimClose(apps::AppShimHandler::Host* host) override;
82 void OnShimFocus(apps::AppShimHandler::Host* host, 65 void OnShimFocus(apps::AppShimHandler::Host* host,
83 apps::AppShimFocusType focus_type, 66 apps::AppShimFocusType focus_type,
84 const std::vector<base::FilePath>& files) override; 67 const std::vector<base::FilePath>& files) override;
85 void OnShimSetHidden(apps::AppShimHandler::Host* host, bool hidden) override; 68 void OnShimSetHidden(apps::AppShimHandler::Host* host, bool hidden) override;
86 void OnShimQuit(apps::AppShimHandler::Host* host) override; 69 void OnShimQuit(apps::AppShimHandler::Host* host) override;
87 70
88 private: 71 protected:
89 friend class test::AppListServiceMacTestApi;
90 friend struct DefaultSingletonTraits<AppListServiceMac>;
91
92 AppListServiceMac(); 72 AppListServiceMac();
93 73
94 base::scoped_nsobject<AppListWindowController> window_controller_; 74 virtual NSWindow* GetNativeWindow() const = 0;
75 virtual bool ReadyToShow() = 0;
76
77 private:
95 base::scoped_nsobject<AppListAnimationController> animation_controller_; 78 base::scoped_nsobject<AppListAnimationController> animation_controller_;
96 base::scoped_nsobject<NSRunningApplication> previously_active_application_; 79 base::scoped_nsobject<NSRunningApplication> previously_active_application_;
97 NSPoint last_start_origin_; 80 NSPoint last_start_origin_;
98 Profile* profile_;
99 scoped_ptr<AppListControllerDelegateImpl> controller_delegate_;
100 81
101 DISALLOW_COPY_AND_ASSIGN(AppListServiceMac); 82 DISALLOW_COPY_AND_ASSIGN(AppListServiceMac);
102 }; 83 };
103 84
104 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_ 85 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_cocoa_mac.mm ('k') | chrome/browser/ui/app_list/app_list_service_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698