Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: chrome/browser/ui/app_list/app_list_service_mac.mm

Issue 20656002: Add profile selector menu to app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rework Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/mac/scoped_nsobject.h" 14 #include "base/mac/scoped_nsobject.h"
15 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_system.h" 20 #include "chrome/browser/extensions/extension_system.h"
21 #include "chrome/browser/profiles/avatar_menu_model.h"
21 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" 23 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
23 #include "chrome/browser/ui/app_list/app_list_service.h" 24 #include "chrome/browser/ui/app_list/app_list_service.h"
24 #include "chrome/browser/ui/app_list/app_list_service_impl.h" 25 #include "chrome/browser/ui/app_list/app_list_service_impl.h"
25 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" 26 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
26 #include "chrome/browser/ui/extensions/application_launch.h" 27 #include "chrome/browser/ui/extensions/application_launch.h"
27 #include "chrome/browser/ui/web_applications/web_app_ui.h" 28 #include "chrome/browser/ui/web_applications/web_app_ui.h"
28 #include "chrome/browser/web_applications/web_app.h" 29 #include "chrome/browser/web_applications/web_app.h"
29 #include "chrome/browser/web_applications/web_app_mac.h" 30 #include "chrome/browser/web_applications/web_app_mac.h"
30 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (profile() == requested_profile) 273 if (profile() == requested_profile)
273 return; 274 return;
274 275
275 // The Objective C objects might be released at some unknown point in the 276 // The Objective C objects might be released at some unknown point in the
276 // future, so explicitly clear references to C++ objects. 277 // future, so explicitly clear references to C++ objects.
277 [[window_controller_ appListViewController] 278 [[window_controller_ appListViewController]
278 setDelegate:scoped_ptr<app_list::AppListViewDelegate>()]; 279 setDelegate:scoped_ptr<app_list::AppListViewDelegate>()];
279 280
280 SetProfile(requested_profile); 281 SetProfile(requested_profile);
281 scoped_ptr<app_list::AppListViewDelegate> delegate( 282 scoped_ptr<app_list::AppListViewDelegate> delegate(
282 new AppListViewDelegate(new AppListControllerDelegateCocoa(), profile())); 283 new AppListViewDelegate(
284 new AppListControllerDelegateCocoa(),
285 profile(),
286 new AvatarMenuModel(
287 &g_browser_process->profile_manager()->GetProfileInfoCache(),
288 NULL,
289 NULL)));
283 window_controller_.reset([[AppListWindowController alloc] init]); 290 window_controller_.reset([[AppListWindowController alloc] init]);
284 [[window_controller_ appListViewController] setDelegate:delegate.Pass()]; 291 [[window_controller_ appListViewController] setDelegate:delegate.Pass()];
285 } 292 }
286 293
287 void AppListServiceMac::Init(Profile* initial_profile) { 294 void AppListServiceMac::Init(Profile* initial_profile) {
288 // On Mac, Init() is called multiple times for a process: any time there is no 295 // On Mac, Init() is called multiple times for a process: any time there is no
289 // browser window open and a new window is opened, and during process startup 296 // browser window open and a new window is opened, and during process startup
290 // to handle the silent launch case (e.g. for app shims). In the startup case, 297 // to handle the silent launch case (e.g. for app shims). In the startup case,
291 // a profile has not yet been determined so |initial_profile| will be NULL. 298 // a profile has not yet been determined so |initial_profile| will be NULL.
292 static bool init_called_with_profile = false; 299 static bool init_called_with_profile = false;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 515
509 // static 516 // static
510 AppListService* AppListService::Get() { 517 AppListService* AppListService::Get() {
511 return AppListServiceMac::GetInstance(); 518 return AppListServiceMac::GetInstance();
512 } 519 }
513 520
514 // static 521 // static
515 void AppListService::InitAll(Profile* initial_profile) { 522 void AppListService::InitAll(Profile* initial_profile) {
516 Get()->Init(initial_profile); 523 Get()->Init(initial_profile);
517 } 524 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698