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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // launches will always have --silent-launch. | 376 // launches will always have --silent-launch. |
377 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList)) | 377 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList)) |
378 ShowWindowNearDock(); | 378 ShowWindowNearDock(); |
379 } | 379 } |
380 | 380 |
381 Profile* AppListServiceMac::GetCurrentAppListProfile() { | 381 Profile* AppListServiceMac::GetCurrentAppListProfile() { |
382 return profile_; | 382 return profile_; |
383 } | 383 } |
384 | 384 |
385 void AppListServiceMac::CreateForProfile(Profile* requested_profile) { | 385 void AppListServiceMac::CreateForProfile(Profile* requested_profile) { |
386 if (profile_ == requested_profile) | 386 DCHECK(requested_profile); |
| 387 if (profile_ && requested_profile->IsSameProfile(profile_)) |
387 return; | 388 return; |
388 | 389 |
389 profile_ = requested_profile; | 390 profile_ = requested_profile->GetOriginalProfile(); |
390 | 391 |
391 if (!window_controller_) | 392 if (!window_controller_) |
392 window_controller_.reset([[AppListWindowController alloc] init]); | 393 window_controller_.reset([[AppListWindowController alloc] init]); |
393 | 394 |
394 scoped_ptr<app_list::AppListViewDelegate> delegate( | 395 scoped_ptr<app_list::AppListViewDelegate> delegate( |
395 new AppListViewDelegate(profile_, GetControllerDelegate())); | 396 new AppListViewDelegate(profile_, GetControllerDelegate())); |
396 [[window_controller_ appListViewController] setDelegate:delegate.Pass()]; | 397 [[window_controller_ appListViewController] setDelegate:delegate.Pass()]; |
397 } | 398 } |
398 | 399 |
399 void AppListServiceMac::ShowForProfile(Profile* requested_profile) { | 400 void AppListServiceMac::ShowForProfile(Profile* requested_profile) { |
400 if (requested_profile->IsManaged()) | 401 if (requested_profile->IsManaged()) |
401 return; | 402 return; |
402 | 403 |
403 InvalidatePendingProfileLoads(); | 404 InvalidatePendingProfileLoads(); |
404 | 405 |
405 if (requested_profile == profile_) { | 406 if (profile_ && requested_profile->IsSameProfile(profile_)) { |
406 ShowWindowNearDock(); | 407 ShowWindowNearDock(); |
407 return; | 408 return; |
408 } | 409 } |
409 | 410 |
410 SetProfilePath(requested_profile->GetPath()); | 411 SetProfilePath(requested_profile->GetPath()); |
411 CreateForProfile(requested_profile); | 412 CreateForProfile(requested_profile); |
412 ShowWindowNearDock(); | 413 ShowWindowNearDock(); |
413 } | 414 } |
414 | 415 |
415 void AppListServiceMac::DismissAppList() { | 416 void AppListServiceMac::DismissAppList() { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 596 |
596 - (void)animationDidEnd:(NSAnimation*)animation { | 597 - (void)animationDidEnd:(NSAnimation*)animation { |
597 content::BrowserThread::PostTask( | 598 content::BrowserThread::PostTask( |
598 content::BrowserThread::UI, | 599 content::BrowserThread::UI, |
599 FROM_HERE, | 600 FROM_HERE, |
600 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, | 601 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, |
601 base::Unretained(AppListServiceMac::GetInstance()))); | 602 base::Unretained(AppListServiceMac::GetInstance()))); |
602 } | 603 } |
603 | 604 |
604 @end | 605 @end |
OLD | NEW |