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 #include <ApplicationServices/ApplicationServices.h> | 5 #include <ApplicationServices/ApplicationServices.h> |
6 #import <Cocoa/Cocoa.h> | 6 #import <Cocoa/Cocoa.h> |
7 | 7 |
8 #include "apps/app_launcher.h" | 8 #include "apps/app_launcher.h" |
9 #include "apps/app_shim/app_shim_handler_mac.h" | 9 #include "apps/app_shim/app_shim_handler_mac.h" |
10 #include "apps/app_shim/app_shim_mac.h" | 10 #include "apps/app_shim/app_shim_mac.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "chrome/browser/web_applications/web_app.h" | 30 #include "chrome/browser/web_applications/web_app.h" |
31 #include "chrome/browser/web_applications/web_app_mac.h" | 31 #include "chrome/browser/web_applications/web_app_mac.h" |
32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/chrome_version_info.h" | 33 #include "chrome/common/chrome_version_info.h" |
34 #include "chrome/common/mac/app_mode_common.h" | 34 #include "chrome/common/mac/app_mode_common.h" |
35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
36 #include "grit/chrome_unscaled_resources.h" | 36 #include "grit/chrome_unscaled_resources.h" |
37 #include "grit/google_chrome_strings.h" | 37 #include "grit/google_chrome_strings.h" |
38 #import "ui/app_list/cocoa/app_list_view_controller.h" | 38 #import "ui/app_list/cocoa/app_list_view_controller.h" |
39 #import "ui/app_list/cocoa/app_list_window_controller.h" | 39 #import "ui/app_list/cocoa/app_list_window_controller.h" |
| 40 #import "ui/app_list/cocoa/apps_grid_controller.h" |
40 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
41 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
42 #include "ui/gfx/display.h" | 43 #include "ui/gfx/display.h" |
43 #include "ui/gfx/screen.h" | 44 #include "ui/gfx/screen.h" |
44 | 45 |
45 namespace gfx { | 46 namespace gfx { |
46 class ImageSkia; | 47 class ImageSkia; |
47 } | 48 } |
48 | 49 |
49 namespace { | 50 namespace { |
(...skipping 16 matching lines...) Expand all Loading... |
66 void ShowWindowNearDock(); | 67 void ShowWindowNearDock(); |
67 | 68 |
68 // AppListService overrides: | 69 // AppListService overrides: |
69 virtual void Init(Profile* initial_profile) OVERRIDE; | 70 virtual void Init(Profile* initial_profile) OVERRIDE; |
70 virtual void CreateForProfile(Profile* requested_profile) OVERRIDE; | 71 virtual void CreateForProfile(Profile* requested_profile) OVERRIDE; |
71 virtual void ShowForProfile(Profile* requested_profile) OVERRIDE; | 72 virtual void ShowForProfile(Profile* requested_profile) OVERRIDE; |
72 virtual void DismissAppList() OVERRIDE; | 73 virtual void DismissAppList() OVERRIDE; |
73 virtual bool IsAppListVisible() const OVERRIDE; | 74 virtual bool IsAppListVisible() const OVERRIDE; |
74 virtual gfx::NativeWindow GetAppListWindow() OVERRIDE; | 75 virtual gfx::NativeWindow GetAppListWindow() OVERRIDE; |
75 virtual AppListControllerDelegate* CreateControllerDelegate() OVERRIDE; | 76 virtual AppListControllerDelegate* CreateControllerDelegate() OVERRIDE; |
| 77 virtual app_list::AppListModel* GetAppListModelForTesting() OVERRIDE; |
76 | 78 |
77 // AppListServiceImpl overrides: | 79 // AppListServiceImpl overrides: |
78 virtual void CreateShortcut() OVERRIDE; | 80 virtual void CreateShortcut() OVERRIDE; |
79 | 81 |
80 // AppShimHandler overrides: | 82 // AppShimHandler overrides: |
81 virtual void OnShimLaunch(apps::AppShimHandler::Host* host, | 83 virtual void OnShimLaunch(apps::AppShimHandler::Host* host, |
82 apps::AppShimLaunchType launch_type) OVERRIDE; | 84 apps::AppShimLaunchType launch_type) OVERRIDE; |
83 virtual void OnShimClose(apps::AppShimHandler::Host* host) OVERRIDE; | 85 virtual void OnShimClose(apps::AppShimHandler::Host* host) OVERRIDE; |
84 virtual void OnShimFocus(apps::AppShimHandler::Host* host, | 86 virtual void OnShimFocus(apps::AppShimHandler::Host* host, |
85 apps::AppShimFocusType focus_type) OVERRIDE; | 87 apps::AppShimFocusType focus_type) OVERRIDE; |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 } | 394 } |
393 | 395 |
394 NSWindow* AppListServiceMac::GetAppListWindow() { | 396 NSWindow* AppListServiceMac::GetAppListWindow() { |
395 return [window_controller_ window]; | 397 return [window_controller_ window]; |
396 } | 398 } |
397 | 399 |
398 AppListControllerDelegate* AppListServiceMac::CreateControllerDelegate() { | 400 AppListControllerDelegate* AppListServiceMac::CreateControllerDelegate() { |
399 return new AppListControllerDelegateCocoa(); | 401 return new AppListControllerDelegateCocoa(); |
400 } | 402 } |
401 | 403 |
| 404 app_list::AppListModel* AppListServiceMac::GetAppListModelForTesting() { |
| 405 AppListViewController* view_controller = |
| 406 [window_controller_ appListViewController]; |
| 407 return [[view_controller appsGridController] model]; |
| 408 } |
| 409 |
402 void AppListServiceMac::OnShimLaunch(apps::AppShimHandler::Host* host, | 410 void AppListServiceMac::OnShimLaunch(apps::AppShimHandler::Host* host, |
403 apps::AppShimLaunchType launch_type) { | 411 apps::AppShimLaunchType launch_type) { |
404 if (IsAppListVisible()) | 412 if (IsAppListVisible()) |
405 DismissAppList(); | 413 DismissAppList(); |
406 else | 414 else |
407 Show(); | 415 Show(); |
408 | 416 |
409 // Always close the shim process immediately. | 417 // Always close the shim process immediately. |
410 host->OnAppLaunchComplete(apps::APP_SHIM_LAUNCH_DUPLICATE_HOST); | 418 host->OnAppLaunchComplete(apps::APP_SHIM_LAUNCH_DUPLICATE_HOST); |
411 } | 419 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 | 542 |
535 // static | 543 // static |
536 AppListService* AppListService::Get() { | 544 AppListService* AppListService::Get() { |
537 return AppListServiceMac::GetInstance(); | 545 return AppListServiceMac::GetInstance(); |
538 } | 546 } |
539 | 547 |
540 // static | 548 // static |
541 void AppListService::InitAll(Profile* initial_profile) { | 549 void AppListService::InitAll(Profile* initial_profile) { |
542 Get()->Init(initial_profile); | 550 Get()->Init(initial_profile); |
543 } | 551 } |
OLD | NEW |