| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 385 |
| 386 void AppListServiceMac::CreateForProfile(Profile* requested_profile) { | 386 void AppListServiceMac::CreateForProfile(Profile* requested_profile) { |
| 387 if (profile_ == requested_profile) | 387 if (profile_ == requested_profile) |
| 388 return; | 388 return; |
| 389 | 389 |
| 390 profile_ = requested_profile; | 390 profile_ = requested_profile; |
| 391 | 391 |
| 392 if (!window_controller_) | 392 if (!window_controller_) |
| 393 window_controller_.reset([[AppListWindowController alloc] init]); | 393 window_controller_.reset([[AppListWindowController alloc] init]); |
| 394 | 394 |
| 395 scoped_ptr<app_list::AppListViewDelegate> delegate( | 395 [[window_controller_ appListViewController] |
| 396 new AppListViewDelegate(profile_, GetControllerDelegate())); | 396 setDelegate:GetViewDelegate(profile_)]; |
| 397 [[window_controller_ appListViewController] setDelegate:delegate.Pass()]; | |
| 398 } | 397 } |
| 399 | 398 |
| 400 void AppListServiceMac::ShowForProfile(Profile* requested_profile) { | 399 void AppListServiceMac::ShowForProfile(Profile* requested_profile) { |
| 401 InvalidatePendingProfileLoads(); | 400 InvalidatePendingProfileLoads(); |
| 402 | 401 |
| 403 if (requested_profile == profile_) { | 402 if (requested_profile == profile_) { |
| 404 ShowWindowNearDock(); | 403 ShowWindowNearDock(); |
| 405 return; | 404 return; |
| 406 } | 405 } |
| 407 | 406 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 void AppListServiceMac::CreateShortcut() { | 449 void AppListServiceMac::CreateShortcut() { |
| 451 CreateAppListShim(GetProfilePath( | 450 CreateAppListShim(GetProfilePath( |
| 452 g_browser_process->profile_manager()->user_data_dir())); | 451 g_browser_process->profile_manager()->user_data_dir())); |
| 453 } | 452 } |
| 454 | 453 |
| 455 void AppListServiceMac::DestroyAppList() { | 454 void AppListServiceMac::DestroyAppList() { |
| 456 // Due to reference counting, Mac can't guarantee that the widget is deleted, | 455 // Due to reference counting, Mac can't guarantee that the widget is deleted, |
| 457 // but mac supports a visible app list with a NULL profile, so there's also no | 456 // but mac supports a visible app list with a NULL profile, so there's also no |
| 458 // need to tear it down completely. | 457 // need to tear it down completely. |
| 459 DismissAppList(); | 458 DismissAppList(); |
| 460 [[window_controller_ appListViewController] | 459 [[window_controller_ appListViewController] setDelegate:NULL]; |
| 461 setDelegate:scoped_ptr<app_list::AppListViewDelegate>()]; | |
| 462 | 460 |
| 463 profile_ = NULL; | 461 profile_ = NULL; |
| 464 } | 462 } |
| 465 | 463 |
| 466 NSWindow* AppListServiceMac::GetAppListWindow() { | 464 NSWindow* AppListServiceMac::GetAppListWindow() { |
| 467 return [window_controller_ window]; | 465 return [window_controller_ window]; |
| 468 } | 466 } |
| 469 | 467 |
| 470 AppListControllerDelegate* AppListServiceMac::GetControllerDelegate() { | 468 AppListControllerDelegate* AppListServiceMac::GetControllerDelegate() { |
| 471 return controller_delegate_.get(); | 469 return controller_delegate_.get(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 602 |
| 605 - (void)animationDidEnd:(NSAnimation*)animation { | 603 - (void)animationDidEnd:(NSAnimation*)animation { |
| 606 content::BrowserThread::PostTask( | 604 content::BrowserThread::PostTask( |
| 607 content::BrowserThread::UI, | 605 content::BrowserThread::UI, |
| 608 FROM_HERE, | 606 FROM_HERE, |
| 609 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, | 607 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, |
| 610 base::Unretained(AppListServiceMac::GetInstance()))); | 608 base::Unretained(AppListServiceMac::GetInstance()))); |
| 611 } | 609 } |
| 612 | 610 |
| 613 @end | 611 @end |
| OLD | NEW |