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

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

Issue 856733004: Loading the Launcher with a Locked Profile launched UserManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: UserManager goes to AppLauncher after startup if flag present Created 5 years, 11 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 #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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
17 #import "chrome/browser/app_controller_mac.h" 17 #import "chrome/browser/app_controller_mac.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/profiles/profile_info_cache.h"
20 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/browser/ui/app_list/app_list_controller_delegate_impl.h" 22 #include "chrome/browser/ui/app_list/app_list_controller_delegate_impl.h"
22 #include "chrome/browser/ui/app_list/app_list_positioner.h" 23 #include "chrome/browser/ui/app_list/app_list_positioner.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_util.h" 26 #include "chrome/browser/ui/app_list/app_list_util.h"
26 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" 27 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
27 #include "chrome/browser/ui/browser_commands.h" 28 #include "chrome/browser/ui/browser_commands.h"
28 #include "chrome/browser/ui/extensions/application_launch.h" 29 #include "chrome/browser/ui/extensions/application_launch.h"
29 #include "chrome/browser/web_applications/web_app.h" 30 #include "chrome/browser/web_applications/web_app.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 case AppListPositioner::SCREEN_EDGE_TOP: 331 case AppListPositioner::SCREEN_EDGE_TOP:
331 NOTREACHED(); 332 NOTREACHED();
332 break; 333 break;
333 case AppListPositioner::SCREEN_EDGE_BOTTOM: 334 case AppListPositioner::SCREEN_EDGE_BOTTOM:
334 start_origin->y -= kDistanceMovedOnShow; 335 start_origin->y -= kDistanceMovedOnShow;
335 break; 336 break;
336 } 337 }
337 } 338 }
338 339
339 void AppListServiceMac::Init(Profile* initial_profile) { 340 void AppListServiceMac::Init(Profile* initial_profile) {
341 InitWithProfilePath(initial_profile, initial_profile->GetPath());
342 }
343
344 void AppListServiceMac::InitWithProfilePath(
345 Profile* initial_profile,
346 const base::FilePath& profile_path) {
340 // On Mac, Init() is called multiple times for a process: any time there is no 347 // On Mac, Init() is called multiple times for a process: any time there is no
341 // browser window open and a new window is opened, and during process startup 348 // browser window open and a new window is opened, and during process startup
342 // to handle the silent launch case (e.g. for app shims). In the startup case, 349 // to handle the silent launch case (e.g. for app shims). In the startup case,
343 // a profile has not yet been determined so |initial_profile| will be NULL. 350 // a profile has not yet been determined so |initial_profile| will be NULL.
344 static bool init_called_with_profile = false; 351 static bool init_called_with_profile = false;
345 if (initial_profile && !init_called_with_profile) { 352 if (initial_profile && !init_called_with_profile) {
346 init_called_with_profile = true; 353 init_called_with_profile = true;
347 PerformStartupChecks(initial_profile); 354 PerformStartupChecks(initial_profile);
348 PrefService* local_state = g_browser_process->local_state(); 355 PrefService* local_state = g_browser_process->local_state();
349 if (!IsAppLauncherEnabled()) { 356 if (!IsAppLauncherEnabled()) {
(...skipping 14 matching lines...) Expand all
364 init_called = true; 371 init_called = true;
365 apps::AppShimHandler::RegisterHandler(app_mode::kAppListModeId, 372 apps::AppShimHandler::RegisterHandler(app_mode::kAppListModeId,
366 AppListServiceMac::GetInstance()); 373 AppListServiceMac::GetInstance());
367 374
368 // Handle the case where Chrome was not running and was started with the app 375 // Handle the case where Chrome was not running and was started with the app
369 // launcher shim. The profile has not yet been loaded. To improve response 376 // launcher shim. The profile has not yet been loaded. To improve response
370 // times, start animating an empty window which will be populated via 377 // times, start animating an empty window which will be populated via
371 // OnShimLaunch(). Note that if --silent-launch is not also passed, the window 378 // OnShimLaunch(). Note that if --silent-launch is not also passed, the window
372 // will instead populate via StartupBrowserCreator::Launch(). Shim-initiated 379 // will instead populate via StartupBrowserCreator::Launch(). Shim-initiated
373 // launches will always have --silent-launch. 380 // launches will always have --silent-launch.
374 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowAppList)) 381 if (base::CommandLine::ForCurrentProcess()->
375 ShowWindowNearDock(); 382 HasSwitch(switches::kShowAppList)) {
383 // Do not show the launcher window when the profile is locked.
384 const ProfileInfoCache& profile_info_cache =
385 g_browser_process->profile_manager()->GetProfileInfoCache();
386 int profile_index = profile_info_cache.
387 GetIndexOfProfileWithPath(profile_path);
388 if (!profile_info_cache.ProfileIsSigninRequiredAtIndex(profile_index))
xiyuan 2015/01/16 20:31:52 Can we use IsProfileLocked() here?
Mike Lerman 2015/01/19 21:08:56 I could I suppose, if I had a ProfileStore. I don'
389 ShowWindowNearDock();
390 }
376 } 391 }
377 392
378 Profile* AppListServiceMac::GetCurrentAppListProfile() { 393 Profile* AppListServiceMac::GetCurrentAppListProfile() {
379 return profile_; 394 return profile_;
380 } 395 }
381 396
382 void AppListServiceMac::ShowForProfile(Profile* requested_profile) { 397 void AppListServiceMac::ShowForProfile(Profile* requested_profile) {
383 CreateForProfile(requested_profile); 398 CreateForProfile(requested_profile);
384 ShowWindowNearDock(); 399 ShowWindowNearDock();
385 } 400 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 void AppListServiceMac::WindowAnimationDidEnd() { 538 void AppListServiceMac::WindowAnimationDidEnd() {
524 [animation_controller_ cleanupOnUIThread]; 539 [animation_controller_ cleanupOnUIThread];
525 } 540 }
526 541
527 // static 542 // static
528 AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) { 543 AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) {
529 return AppListServiceMac::GetInstance(); 544 return AppListServiceMac::GetInstance();
530 } 545 }
531 546
532 // static 547 // static
533 void AppListService::InitAll(Profile* initial_profile) { 548 void AppListService::InitAll(Profile* initial_profile,
534 AppListServiceMac::GetInstance()->Init(initial_profile); 549 const base::FilePath& profile_path) {
550 AppListServiceMac::GetInstance()->InitWithProfilePath(initial_profile,
551 profile_path);
535 } 552 }
536 553
537 @implementation AppListAnimationController 554 @implementation AppListAnimationController
538 555
539 - (BOOL)isClosing { 556 - (BOOL)isClosing {
540 return !!window_; 557 return !!window_;
541 } 558 }
542 559
543 - (void)animateWindow:(NSWindow*)window 560 - (void)animateWindow:(NSWindow*)window
544 targetOrigin:(NSPoint)targetOrigin 561 targetOrigin:(NSPoint)targetOrigin
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 613
597 - (void)animationDidEnd:(NSAnimation*)animation { 614 - (void)animationDidEnd:(NSAnimation*)animation {
598 content::BrowserThread::PostTask( 615 content::BrowserThread::PostTask(
599 content::BrowserThread::UI, 616 content::BrowserThread::UI,
600 FROM_HERE, 617 FROM_HERE,
601 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, 618 base::Bind(&AppListServiceMac::WindowAnimationDidEnd,
602 base::Unretained(AppListServiceMac::GetInstance()))); 619 base::Unretained(AppListServiceMac::GetInstance())));
603 } 620 }
604 621
605 @end 622 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698