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

Unified Diff: chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm

Issue 856253002: Bug fix for the pointer lock string problem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm b/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm
index d6c0de1689d19206affeb70769be10d861a2380a..79793145747f9e3ba7e4568d44649a3365c75e9e 100644
--- a/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm
+++ b/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm
@@ -44,8 +44,9 @@ const float kHideDuration = 0.7;
@interface ExclusiveAccessBubbleWindowController (PrivateMethods)
// Sets |exitLabel_| based on |exitLabelPlaceholder_|,
-// sets |exitLabelPlaceholder_| to nil.
-- (void)initializeLabel;
+// sets |exitLabelPlaceholder_| to nil,
+// sets |denyButton_| text based on |bubbleType_|.
+- (void)initializeLabelAndButton;
- (NSString*)getLabelText;
@@ -121,7 +122,6 @@ const float kHideDuration = 0.7;
InfoBubbleWindow* info_bubble = static_cast<InfoBubbleWindow*>([self window]);
[info_bubble setCanBecomeKeyWindow:NO];
if (!exclusive_access_bubble::ShowButtonsForType(bubbleType_)) {
- [self showButtons:NO];
[self hideSoon];
}
[tweaker_ tweakUI:info_bubble];
@@ -134,7 +134,7 @@ const float kHideDuration = 0.7;
- (void)awakeFromNib {
DCHECK([[self window] isKindOfClass:[InfoBubbleWindow class]]);
[messageLabel_ setStringValue:[self getLabelText]];
- [self initializeLabel];
+ [self initializeLabelAndButton];
}
- (void)positionInWindowAtTop:(CGFloat)maxY width:(CGFloat)maxWidth {
@@ -197,7 +197,7 @@ const float kHideDuration = 0.7;
@implementation ExclusiveAccessBubbleWindowController (PrivateMethods)
-- (void)initializeLabel {
+- (void)initializeLabelAndButton {
// Replace the label placeholder NSTextField with the real label NSTextView.
// The former doesn't show links in a nice way, but the latter can't be added
// in IB without a containing scroll view, so create the NSTextView
@@ -258,6 +258,17 @@ const float kHideDuration = 0.7;
labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame);
labelFrame.size = textFrame.size;
[exitLabel_ setFrame:labelFrame];
+
+ // Update the title of denyButton_ according to the current bubbleType_,
+ // or show no button at all.
+ if (exclusive_access_bubble::ShowButtonsForType(bubbleType_)) {
+ NSString* denyButtonText =
+ SysUTF16ToNSString(
+ exclusive_access_bubble::GetDenyButtonTextForType(bubbleType_));
+ [denyButton_ setTitle:denyButtonText];
+ } else {
+ [self showButtons:NO];
+ }
}
- (NSString*)getLabelText {

Powered by Google App Engine
This is Rietveld 408576698