| 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 <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.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" | 15 #include "chrome/browser/ui/app_list/app_list_service_impl.h" |
| 16 | 16 |
| 17 @class AppListAnimationController; | 17 @class AppListAnimationController; |
| 18 | 18 |
| 19 namespace gfx { | 19 namespace gfx { |
| 20 class Display; | 20 class Display; |
| 21 class Point; | 21 class Point; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace display { |
| 25 using Display = gfx::Display; |
| 26 } |
| 27 |
| 24 // AppListServiceMac manages global resources needed for the app list to | 28 // AppListServiceMac manages global resources needed for the app list to |
| 25 // operate, and controls when and how the app list is opened and closed. | 29 // operate, and controls when and how the app list is opened and closed. |
| 26 class AppListServiceMac : public AppListServiceImpl, | 30 class AppListServiceMac : public AppListServiceImpl, |
| 27 public apps::AppShimHandler { | 31 public apps::AppShimHandler { |
| 28 public: | 32 public: |
| 29 ~AppListServiceMac() override; | 33 ~AppListServiceMac() override; |
| 30 | 34 |
| 31 // Finds the position for a window to anchor it to the dock. This chooses the | 35 // Finds the position for a window to anchor it to the dock. This chooses the |
| 32 // most appropriate position for the window based on whether the dock exists, | 36 // most appropriate position for the window based on whether the dock exists, |
| 33 // the position of the dock (calculated by the difference between the display | 37 // the position of the dock (calculated by the difference between the display |
| 34 // bounds and display work area), whether the mouse cursor is visible and its | 38 // bounds and display work area), whether the mouse cursor is visible and its |
| 35 // position. Sets |target_origin| to the coordinates for the window to appear | 39 // position. Sets |target_origin| to the coordinates for the window to appear |
| 36 // at, and |start_origin| to the coordinates the window should begin animating | 40 // at, and |start_origin| to the coordinates the window should begin animating |
| 37 // from. Coordinates are for the bottom-left coordinate of the window, in | 41 // from. Coordinates are for the bottom-left coordinate of the window, in |
| 38 // AppKit space (Y positive is up). | 42 // AppKit space (Y positive is up). |
| 39 static void FindAnchorPoint(const gfx::Size& window_size, | 43 static void FindAnchorPoint(const gfx::Size& window_size, |
| 40 const gfx::Display& display, | 44 const display::Display& display, |
| 41 int primary_display_height, | 45 int primary_display_height, |
| 42 bool cursor_is_visible, | 46 bool cursor_is_visible, |
| 43 const gfx::Point& cursor, | 47 const gfx::Point& cursor, |
| 44 NSPoint* target_origin, | 48 NSPoint* target_origin, |
| 45 NSPoint* start_origin); | 49 NSPoint* start_origin); |
| 46 | 50 |
| 47 void ShowWindowNearDock(); | 51 void ShowWindowNearDock(); |
| 48 void WindowAnimationDidEnd(); | 52 void WindowAnimationDidEnd(); |
| 49 void InitWithProfilePath(Profile* initial_profile, | 53 void InitWithProfilePath(Profile* initial_profile, |
| 50 const base::FilePath& profile_path); | 54 const base::FilePath& profile_path); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 90 |
| 87 private: | 91 private: |
| 88 base::scoped_nsobject<AppListAnimationController> animation_controller_; | 92 base::scoped_nsobject<AppListAnimationController> animation_controller_; |
| 89 base::scoped_nsobject<NSRunningApplication> previously_active_application_; | 93 base::scoped_nsobject<NSRunningApplication> previously_active_application_; |
| 90 NSPoint last_start_origin_; | 94 NSPoint last_start_origin_; |
| 91 | 95 |
| 92 DISALLOW_COPY_AND_ASSIGN(AppListServiceMac); | 96 DISALLOW_COPY_AND_ASSIGN(AppListServiceMac); |
| 93 }; | 97 }; |
| 94 | 98 |
| 95 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_ | 99 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_MAC_H_ |
| OLD | NEW |