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 15 matching lines...) Expand all Loading... |
65 | 66 |
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; |
| 76 virtual app_list::AppListModel* GetAppListModelForTesting() OVERRIDE; |
75 | 77 |
76 // AppListServiceImpl overrides: | 78 // AppListServiceImpl overrides: |
77 virtual void CreateShortcut() OVERRIDE; | 79 virtual void CreateShortcut() OVERRIDE; |
78 | 80 |
79 // AppShimHandler overrides: | 81 // AppShimHandler overrides: |
80 virtual void OnShimLaunch(apps::AppShimHandler::Host* host, | 82 virtual void OnShimLaunch(apps::AppShimHandler::Host* host, |
81 apps::AppShimLaunchType launch_type) OVERRIDE; | 83 apps::AppShimLaunchType launch_type) OVERRIDE; |
82 virtual void OnShimClose(apps::AppShimHandler::Host* host) OVERRIDE; | 84 virtual void OnShimClose(apps::AppShimHandler::Host* host) OVERRIDE; |
83 virtual void OnShimFocus(apps::AppShimHandler::Host* host, | 85 virtual void OnShimFocus(apps::AppShimHandler::Host* host, |
84 apps::AppShimFocusType focus_type) OVERRIDE; | 86 apps::AppShimFocusType focus_type) OVERRIDE; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 389 |
388 void AppListServiceMac::CreateShortcut() { | 390 void AppListServiceMac::CreateShortcut() { |
389 CreateAppListShim(GetProfilePath( | 391 CreateAppListShim(GetProfilePath( |
390 g_browser_process->profile_manager()->user_data_dir())); | 392 g_browser_process->profile_manager()->user_data_dir())); |
391 } | 393 } |
392 | 394 |
393 NSWindow* AppListServiceMac::GetAppListWindow() { | 395 NSWindow* AppListServiceMac::GetAppListWindow() { |
394 return [window_controller_ window]; | 396 return [window_controller_ window]; |
395 } | 397 } |
396 | 398 |
| 399 app_list::AppListModel* AppListServiceMac::GetAppListModelForTesting() { |
| 400 return |
| 401 [[[window_controller_ appListViewController] appsGridController] model]; |
| 402 } |
| 403 |
397 void AppListServiceMac::OnShimLaunch(apps::AppShimHandler::Host* host, | 404 void AppListServiceMac::OnShimLaunch(apps::AppShimHandler::Host* host, |
398 apps::AppShimLaunchType launch_type) { | 405 apps::AppShimLaunchType launch_type) { |
399 if (IsAppListVisible()) | 406 if (IsAppListVisible()) |
400 DismissAppList(); | 407 DismissAppList(); |
401 else | 408 else |
402 Show(); | 409 Show(); |
403 | 410 |
404 // Always close the shim process immediately. | 411 // Always close the shim process immediately. |
405 host->OnAppLaunchComplete(apps::APP_SHIM_LAUNCH_DUPLICATE_HOST); | 412 host->OnAppLaunchComplete(apps::APP_SHIM_LAUNCH_DUPLICATE_HOST); |
406 } | 413 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 536 |
530 // static | 537 // static |
531 AppListService* AppListService::Get() { | 538 AppListService* AppListService::Get() { |
532 return AppListServiceMac::GetInstance(); | 539 return AppListServiceMac::GetInstance(); |
533 } | 540 } |
534 | 541 |
535 // static | 542 // static |
536 void AppListService::InitAll(Profile* initial_profile) { | 543 void AppListService::InitAll(Profile* initial_profile) { |
537 Get()->Init(initial_profile); | 544 Get()->Init(initial_profile); |
538 } | 545 } |
OLD | NEW |