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 "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 // launches will always have --silent-launch. | 377 // launches will always have --silent-launch. |
378 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList)) | 378 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList)) |
379 ShowWindowNearDock(); | 379 ShowWindowNearDock(); |
380 } | 380 } |
381 | 381 |
382 Profile* AppListServiceMac::GetCurrentAppListProfile() { | 382 Profile* AppListServiceMac::GetCurrentAppListProfile() { |
383 return profile_; | 383 return profile_; |
384 } | 384 } |
385 | 385 |
386 void AppListServiceMac::ShowForProfile(Profile* requested_profile) { | 386 void AppListServiceMac::ShowForProfile(Profile* requested_profile) { |
387 InvalidatePendingProfileLoads(); | |
388 | |
389 if (requested_profile == profile_) { | |
390 ShowWindowNearDock(); | |
391 return; | |
392 } | |
393 | |
394 SetProfilePath(requested_profile->GetPath()); | |
395 CreateForProfile(requested_profile); | 387 CreateForProfile(requested_profile); |
396 ShowWindowNearDock(); | 388 ShowWindowNearDock(); |
397 } | 389 } |
398 | 390 |
399 void AppListServiceMac::DismissAppList() { | 391 void AppListServiceMac::DismissAppList() { |
400 if (!IsAppListVisible()) | 392 if (!IsAppListVisible()) |
401 return; | 393 return; |
402 | 394 |
403 // If the app list is currently the main window, it will activate the next | 395 // If the app list is currently the main window, it will activate the next |
404 // Chrome window when dismissed. But if a different application was active | 396 // Chrome window when dismissed. But if a different application was active |
(...skipping 27 matching lines...) Expand all Loading... |
432 AppController* controller = [NSApp delegate]; | 424 AppController* controller = [NSApp delegate]; |
433 [controller initAppShimMenuController]; | 425 [controller initAppShimMenuController]; |
434 } | 426 } |
435 | 427 |
436 void AppListServiceMac::CreateShortcut() { | 428 void AppListServiceMac::CreateShortcut() { |
437 CreateAppListShim(GetProfilePath( | 429 CreateAppListShim(GetProfilePath( |
438 g_browser_process->profile_manager()->user_data_dir())); | 430 g_browser_process->profile_manager()->user_data_dir())); |
439 } | 431 } |
440 | 432 |
441 void AppListServiceMac::CreateForProfile(Profile* requested_profile) { | 433 void AppListServiceMac::CreateForProfile(Profile* requested_profile) { |
442 if (profile_ == requested_profile) | 434 DCHECK(requested_profile); |
| 435 InvalidatePendingProfileLoads(); |
| 436 if (profile_ && requested_profile->IsSameProfile(profile_)) |
443 return; | 437 return; |
444 | 438 |
445 profile_ = requested_profile; | 439 profile_ = requested_profile->GetOriginalProfile(); |
| 440 SetProfilePath(profile_->GetPath()); |
446 | 441 |
447 if (!window_controller_) | 442 if (!window_controller_) |
448 window_controller_.reset([[AppListWindowController alloc] init]); | 443 window_controller_.reset([[AppListWindowController alloc] init]); |
449 | 444 |
450 [[window_controller_ appListViewController] setDelegate:nil]; | 445 [[window_controller_ appListViewController] setDelegate:nil]; |
451 [[window_controller_ appListViewController] | 446 [[window_controller_ appListViewController] |
452 setDelegate:GetViewDelegate(profile_)]; | 447 setDelegate:GetViewDelegate(profile_)]; |
453 } | 448 } |
454 | 449 |
455 void AppListServiceMac::DestroyAppList() { | 450 void AppListServiceMac::DestroyAppList() { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 | 596 |
602 - (void)animationDidEnd:(NSAnimation*)animation { | 597 - (void)animationDidEnd:(NSAnimation*)animation { |
603 content::BrowserThread::PostTask( | 598 content::BrowserThread::PostTask( |
604 content::BrowserThread::UI, | 599 content::BrowserThread::UI, |
605 FROM_HERE, | 600 FROM_HERE, |
606 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, | 601 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, |
607 base::Unretained(AppListServiceMac::GetInstance()))); | 602 base::Unretained(AppListServiceMac::GetInstance()))); |
608 } | 603 } |
609 | 604 |
610 @end | 605 @end |
OLD | NEW |