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

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

Issue 1631373003: Refactor ProfileInfoCache in c/b/ui/app_list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments, add sorting of ProfileAttributesEntry Created 4 years, 10 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 #include <stddef.h> 9 #include <stddef.h>
10 10
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
17 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/prefs/pref_service.h" 19 #include "base/prefs/pref_service.h"
20 #import "chrome/browser/app_controller_mac.h" 20 #import "chrome/browser/app_controller_mac.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/extensions/extension_service.h" 22 #include "chrome/browser/extensions/extension_service.h"
23 #include "chrome/browser/profiles/profile_info_cache.h" 23 #include "chrome/browser/profiles/profile_attributes_entry.h"
24 #include "chrome/browser/profiles/profile_attributes_storage.h"
24 #include "chrome/browser/profiles/profile_manager.h" 25 #include "chrome/browser/profiles/profile_manager.h"
25 #include "chrome/browser/ui/app_list/app_list_positioner.h" 26 #include "chrome/browser/ui/app_list/app_list_positioner.h"
26 #include "chrome/browser/ui/app_list/app_list_service.h" 27 #include "chrome/browser/ui/app_list/app_list_service.h"
27 #include "chrome/browser/ui/app_list/app_list_service_cocoa_mac.h" 28 #include "chrome/browser/ui/app_list/app_list_service_cocoa_mac.h"
28 #include "chrome/browser/ui/app_list/app_list_service_impl.h" 29 #include "chrome/browser/ui/app_list/app_list_service_impl.h"
29 #include "chrome/browser/ui/app_list/app_list_util.h" 30 #include "chrome/browser/ui/app_list/app_list_util.h"
30 #include "chrome/browser/ui/browser_commands.h" 31 #include "chrome/browser/ui/browser_commands.h"
31 #include "chrome/browser/ui/extensions/application_launch.h" 32 #include "chrome/browser/ui/extensions/application_launch.h"
32 #include "chrome/browser/web_applications/web_app.h" 33 #include "chrome/browser/web_applications/web_app.h"
33 #include "chrome/browser/web_applications/web_app_mac.h" 34 #include "chrome/browser/web_applications/web_app_mac.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // launcher shim. The profile has not yet been loaded. To improve response 382 // launcher shim. The profile has not yet been loaded. To improve response
382 // times, start animating an empty window which will be populated via 383 // times, start animating an empty window which will be populated via
383 // OnShimLaunch(). Note that if --silent-launch is not also passed, the window 384 // OnShimLaunch(). Note that if --silent-launch is not also passed, the window
384 // will instead populate via StartupBrowserCreator::Launch(). Shim-initiated 385 // will instead populate via StartupBrowserCreator::Launch(). Shim-initiated
385 // launches will always have --silent-launch. 386 // launches will always have --silent-launch.
386 if (base::CommandLine::ForCurrentProcess()-> 387 if (base::CommandLine::ForCurrentProcess()->
387 HasSwitch(switches::kShowAppList)) { 388 HasSwitch(switches::kShowAppList)) {
388 // Do not show the launcher window when the profile is locked, or if it 389 // Do not show the launcher window when the profile is locked, or if it
389 // can't be displayed unpopulated. In the latter case, the Show will occur 390 // can't be displayed unpopulated. In the latter case, the Show will occur
390 // in OnShimLaunch() or AppListService::HandleLaunchCommandLine(). 391 // in OnShimLaunch() or AppListService::HandleLaunchCommandLine().
391 const ProfileInfoCache& profile_info_cache = 392 ProfileAttributesEntry* entry = nullptr;
392 g_browser_process->profile_manager()->GetProfileInfoCache(); 393 bool has_entry = g_browser_process->profile_manager()->
393 size_t profile_index = profile_info_cache. 394 GetProfileAttributesStorage().
394 GetIndexOfProfileWithPath(profile_path); 395 GetProfileAttributesWithPath(profile_path, &entry);
395 if (profile_index != std::string::npos && 396 if (has_entry && entry->IsSigninRequired() && ReadyToShow())
tapted 2016/01/31 23:04:37 drive-by: I think you're missing a `!` before entr
lwchkg 2016/02/01 06:31:20 Thanks for spotting! I don't have a Mac myself, so
tapted 2016/02/02 00:20:55 Not sure - this path is used to improve response t
396 !profile_info_cache.ProfileIsSigninRequiredAtIndex(profile_index) &&
397 ReadyToShow())
398 ShowWindowNearDock(); 397 ShowWindowNearDock();
399 } 398 }
400 } 399 }
401 400
402 void AppListServiceMac::DismissAppList() { 401 void AppListServiceMac::DismissAppList() {
403 if (!IsAppListVisible()) 402 if (!IsAppListVisible())
404 return; 403 return;
405 404
406 NSWindow* app_list_window = GetNativeWindow(); 405 NSWindow* app_list_window = GetNativeWindow();
407 // If the app list is currently the main window, it will activate the next 406 // If the app list is currently the main window, it will activate the next
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 580
582 - (void)animationDidEnd:(NSAnimation*)animation { 581 - (void)animationDidEnd:(NSAnimation*)animation {
583 content::BrowserThread::PostTask( 582 content::BrowserThread::PostTask(
584 content::BrowserThread::UI, 583 content::BrowserThread::UI,
585 FROM_HERE, 584 FROM_HERE,
586 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, 585 base::Bind(&AppListServiceMac::WindowAnimationDidEnd,
587 base::Unretained(GetActiveInstance()))); 586 base::Unretained(GetActiveInstance())));
588 } 587 }
589 588
590 @end 589 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698