| 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 #import "chrome/browser/ui/app_list/app_list_service_mac.h" | 5 #import "chrome/browser/ui/app_list/app_list_service_mac.h" |
| 6 | 6 |
| 7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "apps/app_shim/app_shim_mac.h" | 10 #include "apps/app_shim/app_shim_mac.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 340 } |
| 341 | 341 |
| 342 void AppListServiceMac::Init(Profile* initial_profile) { | 342 void AppListServiceMac::Init(Profile* initial_profile) { |
| 343 // On Mac, Init() is called multiple times for a process: any time there is no | 343 // On Mac, Init() is called multiple times for a process: any time there is no |
| 344 // browser window open and a new window is opened, and during process startup | 344 // browser window open and a new window is opened, and during process startup |
| 345 // to handle the silent launch case (e.g. for app shims). In the startup case, | 345 // to handle the silent launch case (e.g. for app shims). In the startup case, |
| 346 // a profile has not yet been determined so |initial_profile| will be NULL. | 346 // a profile has not yet been determined so |initial_profile| will be NULL. |
| 347 static bool init_called_with_profile = false; | 347 static bool init_called_with_profile = false; |
| 348 if (initial_profile && !init_called_with_profile) { | 348 if (initial_profile && !init_called_with_profile) { |
| 349 init_called_with_profile = true; | 349 init_called_with_profile = true; |
| 350 PerformStartupChecks(initial_profile); | 350 HandleCommandLineFlags(initial_profile); |
| 351 PrefService* local_state = g_browser_process->local_state(); | 351 PrefService* local_state = g_browser_process->local_state(); |
| 352 if (!IsAppLauncherEnabled()) { | 352 if (!IsAppLauncherEnabled()) { |
| 353 local_state->SetInteger(prefs::kAppLauncherShortcutVersion, 0); | 353 local_state->SetInteger(prefs::kAppLauncherShortcutVersion, 0); |
| 354 } else { | 354 } else { |
| 355 int installed_shortcut_version = | 355 int installed_shortcut_version = |
| 356 local_state->GetInteger(prefs::kAppLauncherShortcutVersion); | 356 local_state->GetInteger(prefs::kAppLauncherShortcutVersion); |
| 357 | 357 |
| 358 if (kShortcutVersion > installed_shortcut_version) | 358 if (kShortcutVersion > installed_shortcut_version) |
| 359 CreateShortcut(); | 359 CreateShortcut(); |
| 360 } | 360 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 [animation_controller_ animateWindow:[window_controller_ window] | 435 [animation_controller_ animateWindow:[window_controller_ window] |
| 436 targetOrigin:last_start_origin_ | 436 targetOrigin:last_start_origin_ |
| 437 closing:YES]; | 437 closing:YES]; |
| 438 } | 438 } |
| 439 | 439 |
| 440 bool AppListServiceMac::IsAppListVisible() const { | 440 bool AppListServiceMac::IsAppListVisible() const { |
| 441 return [[window_controller_ window] isVisible] && | 441 return [[window_controller_ window] isVisible] && |
| 442 ![animation_controller_ isClosing]; | 442 ![animation_controller_ isClosing]; |
| 443 } | 443 } |
| 444 | 444 |
| 445 void AppListServiceMac::EnableAppList(Profile* initial_profile, | 445 void AppListServiceMac::EnableAppList(Profile* initial_profile) { |
| 446 AppListEnableSource enable_source) { | 446 AppListServiceImpl::EnableAppList(initial_profile); |
| 447 AppListServiceImpl::EnableAppList(initial_profile, enable_source); | |
| 448 AppController* controller = [NSApp delegate]; | 447 AppController* controller = [NSApp delegate]; |
| 449 [controller initAppShimMenuController]; | 448 [controller initAppShimMenuController]; |
| 450 } | 449 } |
| 451 | 450 |
| 452 void AppListServiceMac::CreateShortcut() { | 451 void AppListServiceMac::CreateShortcut() { |
| 453 CreateAppListShim(GetProfilePath( | 452 CreateAppListShim(GetProfilePath( |
| 454 g_browser_process->profile_manager()->user_data_dir())); | 453 g_browser_process->profile_manager()->user_data_dir())); |
| 455 } | 454 } |
| 456 | 455 |
| 457 NSWindow* AppListServiceMac::GetAppListWindow() { | 456 NSWindow* AppListServiceMac::GetAppListWindow() { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 | 594 |
| 596 - (void)animationDidEnd:(NSAnimation*)animation { | 595 - (void)animationDidEnd:(NSAnimation*)animation { |
| 597 content::BrowserThread::PostTask( | 596 content::BrowserThread::PostTask( |
| 598 content::BrowserThread::UI, | 597 content::BrowserThread::UI, |
| 599 FROM_HERE, | 598 FROM_HERE, |
| 600 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, | 599 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, |
| 601 base::Unretained(AppListServiceMac::GetInstance()))); | 600 base::Unretained(AppListServiceMac::GetInstance()))); |
| 602 } | 601 } |
| 603 | 602 |
| 604 @end | 603 @end |
| OLD | NEW |