| OLD | NEW |
| 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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 namespace test { | 26 namespace test { |
| 27 class AppListServiceMacTestApi; | 27 class AppListServiceMacTestApi; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // AppListServiceMac manages global resources needed for the app list to | 30 // AppListServiceMac manages global resources needed for the app list to |
| 31 // operate, and controls when the app list is opened and closed. | 31 // operate, and controls when the app list is opened and closed. |
| 32 class AppListServiceMac : public AppListServiceImpl, | 32 class AppListServiceMac : public AppListServiceImpl, |
| 33 public apps::AppShimHandler { | 33 public apps::AppShimHandler { |
| 34 public: | 34 public: |
| 35 virtual ~AppListServiceMac(); | 35 ~AppListServiceMac() override; |
| 36 | 36 |
| 37 static AppListServiceMac* GetInstance(); | 37 static AppListServiceMac* GetInstance(); |
| 38 | 38 |
| 39 // Finds the position for a window to anchor it to the dock. This chooses the | 39 // 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, | 40 // 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 | 41 // 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 | 42 // 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 | 43 // 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 | 44 // 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 | 45 // from. Coordinates are for the bottom-left coordinate of the window, in |
| 46 // AppKit space (Y positive is up). | 46 // AppKit space (Y positive is up). |
| 47 static void FindAnchorPoint(const gfx::Size& window_size, | 47 static void FindAnchorPoint(const gfx::Size& window_size, |
| 48 const gfx::Display& display, | 48 const gfx::Display& display, |
| 49 int primary_display_height, | 49 int primary_display_height, |
| 50 bool cursor_is_visible, | 50 bool cursor_is_visible, |
| 51 const gfx::Point& cursor, | 51 const gfx::Point& cursor, |
| 52 NSPoint* target_origin, | 52 NSPoint* target_origin, |
| 53 NSPoint* start_origin); | 53 NSPoint* start_origin); |
| 54 | 54 |
| 55 void ShowWindowNearDock(); | 55 void ShowWindowNearDock(); |
| 56 void WindowAnimationDidEnd(); | 56 void WindowAnimationDidEnd(); |
| 57 | 57 |
| 58 // AppListService overrides: | 58 // AppListService overrides: |
| 59 virtual void Init(Profile* initial_profile) override; | 59 void Init(Profile* initial_profile) override; |
| 60 virtual void ShowForProfile(Profile* requested_profile) override; | 60 void ShowForProfile(Profile* requested_profile) override; |
| 61 virtual void DismissAppList() override; | 61 void DismissAppList() override; |
| 62 virtual bool IsAppListVisible() const override; | 62 bool IsAppListVisible() const override; |
| 63 virtual void EnableAppList(Profile* initial_profile, | 63 void EnableAppList(Profile* initial_profile, |
| 64 AppListEnableSource enable_source) override; | 64 AppListEnableSource enable_source) override; |
| 65 virtual gfx::NativeWindow GetAppListWindow() override; | 65 gfx::NativeWindow GetAppListWindow() override; |
| 66 virtual AppListControllerDelegate* GetControllerDelegate() override; | 66 AppListControllerDelegate* GetControllerDelegate() override; |
| 67 virtual Profile* GetCurrentAppListProfile() override; | 67 Profile* GetCurrentAppListProfile() override; |
| 68 virtual void CreateShortcut() override; | 68 void CreateShortcut() override; |
| 69 | 69 |
| 70 // AppListServiceImpl overrides: | 70 // AppListServiceImpl overrides: |
| 71 virtual void CreateForProfile(Profile* requested_profile) override; | 71 void CreateForProfile(Profile* requested_profile) override; |
| 72 virtual void DestroyAppList() override; | 72 void DestroyAppList() override; |
| 73 | 73 |
| 74 // AppShimHandler overrides: | 74 // AppShimHandler overrides: |
| 75 virtual void OnShimLaunch(apps::AppShimHandler::Host* host, | 75 void OnShimLaunch(apps::AppShimHandler::Host* host, |
| 76 apps::AppShimLaunchType launch_type, | 76 apps::AppShimLaunchType launch_type, |
| 77 const std::vector<base::FilePath>& files) override; | 77 const std::vector<base::FilePath>& files) override; |
| 78 virtual void OnShimClose(apps::AppShimHandler::Host* host) override; | 78 void OnShimClose(apps::AppShimHandler::Host* host) override; |
| 79 virtual void OnShimFocus(apps::AppShimHandler::Host* host, | 79 void OnShimFocus(apps::AppShimHandler::Host* host, |
| 80 apps::AppShimFocusType focus_type, | 80 apps::AppShimFocusType focus_type, |
| 81 const std::vector<base::FilePath>& files) override; | 81 const std::vector<base::FilePath>& files) override; |
| 82 virtual void OnShimSetHidden(apps::AppShimHandler::Host* host, | 82 void OnShimSetHidden(apps::AppShimHandler::Host* host, bool hidden) override; |
| 83 bool hidden) override; | 83 void OnShimQuit(apps::AppShimHandler::Host* host) override; |
| 84 virtual void OnShimQuit(apps::AppShimHandler::Host* host) override; | |
| 85 | 84 |
| 86 private: | 85 private: |
| 87 friend class test::AppListServiceMacTestApi; | 86 friend class test::AppListServiceMacTestApi; |
| 88 friend struct DefaultSingletonTraits<AppListServiceMac>; | 87 friend struct DefaultSingletonTraits<AppListServiceMac>; |
| 89 | 88 |
| 90 AppListServiceMac(); | 89 AppListServiceMac(); |
| 91 | 90 |
| 92 base::scoped_nsobject<AppListWindowController> window_controller_; | 91 base::scoped_nsobject<AppListWindowController> window_controller_; |
| 93 base::scoped_nsobject<AppListAnimationController> animation_controller_; | 92 base::scoped_nsobject<AppListAnimationController> animation_controller_; |
| 94 base::scoped_nsobject<NSRunningApplication> previously_active_application_; | 93 base::scoped_nsobject<NSRunningApplication> previously_active_application_; |
| 95 NSPoint last_start_origin_; | 94 NSPoint last_start_origin_; |
| 96 Profile* profile_; | 95 Profile* profile_; |
| 97 scoped_ptr<AppListControllerDelegateImpl> controller_delegate_; | 96 scoped_ptr<AppListControllerDelegateImpl> controller_delegate_; |
| 98 | 97 |
| 99 DISALLOW_COPY_AND_ASSIGN(AppListServiceMac); | 98 DISALLOW_COPY_AND_ASSIGN(AppListServiceMac); |
| 100 }; | 99 }; |
| 101 | 100 |
| 102 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_ | 101 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_ |
| OLD | NEW |