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

Unified Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm

Issue 497783002: Disable lock if no credentials are present (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Return [false] if profile_index = ::npos Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
index 7198d96d9d1d6146d5026bdfd79803edcfec0e48..e48aff88d7d75b507fad6b044983350f22d2d5bf 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
@@ -22,6 +22,7 @@
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/profiles/profiles_state.h"
+#include "chrome/browser/signin/local_auth.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_header_helper.h"
#include "chrome/browser/signin/signin_manager_factory.h"
@@ -826,7 +827,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
// Creates the "Not you" and Lock option buttons.
- (NSView*)createOptionsViewWithRect:(NSRect)rect
- enableLock:(BOOL)enableLock;
+ displayLock:(BOOL)displayLock;
// Creates the account management view for the active profile.
- (NSView*)createCurrentProfileAccountsView:(NSRect)rect;
@@ -1140,7 +1141,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
base::scoped_nsobject<NSMutableArray> otherProfiles(
[[NSMutableArray alloc] init]);
// Local and guest profiles cannot lock their profile.
- bool enableLock = false;
+ bool displayLock = false;
// Loop over the profiles in reverse, so that they are sorted by their
// y-coordinate, and separate them into active and "other" profiles.
@@ -1162,7 +1163,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
}
}
currentProfileView = [self createCurrentProfileView:item];
- enableLock = switches::IsNewProfileManagement() && item.signed_in;
+ displayLock = switches::IsNewProfileManagement() && item.signed_in;
} else {
[otherProfiles addObject:[self createOtherProfileView:i]];
}
@@ -1178,7 +1179,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
// Option buttons.
NSRect rect = NSMakeRect(0, yOffset, kFixedMenuWidth, 0);
NSView* optionsView = [self createOptionsViewWithRect:rect
- enableLock:enableLock];
+ displayLock:displayLock];
[container addSubview:optionsView];
rect.origin.y = NSMaxY([optionsView frame]);
@@ -1690,19 +1691,21 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
}
- (NSView*)createOptionsViewWithRect:(NSRect)rect
- enableLock:(BOOL)enableLock {
+ displayLock:(BOOL)displayLock {
NSRect viewRect = NSMakeRect(0, 0,
rect.size.width,
kBlueButtonHeight + kSmallVerticalSpacing);
base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]);
- if (enableLock) {
+ if (displayLock) {
NSButton* lockButton =
[self hoverButtonWithRect:viewRect
text:l10n_util::GetNSString(
IDS_PROFILES_PROFILE_SIGNOUT_BUTTON)
imageResourceId:IDR_ICON_PROFILES_MENU_LOCK
action:@selector(lockProfile:)];
+ if (!chrome::LocalAuthCredentialsExist(browser_->profile()))
+ [lockButton setEnabled:NO];
[container addSubview:lockButton];
viewRect.origin.y = NSMaxY([lockButton frame]);
« no previous file with comments | « chrome/browser/signin/local_auth_unittest.cc ('k') | chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698