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

Side by Side 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: Revert the xib file (switch back "Allow" and "Deny" button position), and fix one style problem 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/logging.h" // for NOTREACHED() 7 #include "base/logging.h" // for NOTREACHED()
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 26 matching lines...) Expand all
37 @interface OneClickHyperlinkTextView : HyperlinkTextView 37 @interface OneClickHyperlinkTextView : HyperlinkTextView
38 @end 38 @end
39 @implementation OneClickHyperlinkTextView 39 @implementation OneClickHyperlinkTextView
40 - (BOOL)acceptsFirstMouse:(NSEvent*)event { 40 - (BOOL)acceptsFirstMouse:(NSEvent*)event {
41 return YES; 41 return YES;
42 } 42 }
43 @end 43 @end
44 44
45 @interface ExclusiveAccessBubbleWindowController (PrivateMethods) 45 @interface ExclusiveAccessBubbleWindowController (PrivateMethods)
46 // Sets |exitLabel_| based on |exitLabelPlaceholder_|, 46 // Sets |exitLabel_| based on |exitLabelPlaceholder_|,
47 // sets |exitLabelPlaceholder_| to nil. 47 // sets |exitLabelPlaceholder_| to nil.
Mark Mentovai 2015/01/27 21:32:16 Revise comment.
Jialiu Lin 2015/01/28 02:47:09 Done.
48 - (void)initializeLabel; 48 - (void)initializeLabel;
49 49
50 - (NSString*)getLabelText; 50 - (NSString*)getLabelText;
51 51
52 - (void)hideSoon; 52 - (void)hideSoon;
53 53
54 // Returns the Accelerator for the Toggle Fullscreen menu item. 54 // Returns the Accelerator for the Toggle Fullscreen menu item.
55 + (scoped_ptr<ui::PlatformAcceleratorCocoa>)acceleratorForToggleFullscreen; 55 + (scoped_ptr<ui::PlatformAcceleratorCocoa>)acceleratorForToggleFullscreen;
56 56
57 // Returns a string representation fit for display of 57 // Returns a string representation fit for display of
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 [exitLabel_ setFrameSize:windowFrame.size]; 251 [exitLabel_ setFrameSize:windowFrame.size];
252 NSLayoutManager* layoutManager = [exitLabel_ layoutManager]; 252 NSLayoutManager* layoutManager = [exitLabel_ layoutManager];
253 NSTextContainer* textContainer = [exitLabel_ textContainer]; 253 NSTextContainer* textContainer = [exitLabel_ textContainer];
254 [layoutManager ensureLayoutForTextContainer:textContainer]; 254 [layoutManager ensureLayoutForTextContainer:textContainer];
255 NSRect textFrame = [layoutManager usedRectForTextContainer:textContainer]; 255 NSRect textFrame = [layoutManager usedRectForTextContainer:textContainer];
256 256
257 textFrame.size.width = ceil(NSWidth(textFrame)); 257 textFrame.size.width = ceil(NSWidth(textFrame));
258 labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame); 258 labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame);
259 labelFrame.size = textFrame.size; 259 labelFrame.size = textFrame.size;
260 [exitLabel_ setFrame:labelFrame]; 260 [exitLabel_ setFrame:labelFrame];
261
262 // Update the title of denyButton_ according to the current bubbleType_
263 if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_BUTTONS ||
Mark Mentovai 2015/01/27 21:32:16 Call exclusive_access_bubble::ShowButtonsForType()
Jialiu Lin 2015/01/28 02:47:09 Done.
264 bubbleType_ ==
265 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS ||
266 bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS) {
267 NSString* denyButtonText =
268 SysUTF16ToNSString(
269 exclusive_access_bubble::GetDenyButtonTextForType(bubbleType_));
Mark Mentovai 2015/01/27 21:32:16 Since you’re now always populating the deny button
Jialiu Lin 2015/01/28 02:47:09 Done.
270 [denyButton_ setTitle:denyButtonText];
271 }
Mark Mentovai 2015/01/27 21:32:16 Perhaps the showButtons:NO call should be here in
Jialiu Lin 2015/01/28 02:47:08 Added the else clause, and changed the function na
261 } 272 }
262 273
263 - (NSString*)getLabelText { 274 - (NSString*)getLabelText {
264 if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE) 275 if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE)
265 return @""; 276 return @"";
266 extensions::ExtensionRegistry* registry = 277 extensions::ExtensionRegistry* registry =
267 extensions::ExtensionRegistry::Get(browser_->profile()); 278 extensions::ExtensionRegistry::Get(browser_->profile());
268 return SysUTF16ToNSString(exclusive_access_bubble::GetLabelTextForType( 279 return SysUTF16ToNSString(exclusive_access_bubble::GetLabelTextForType(
269 bubbleType_, url_, registry)); 280 bubbleType_, url_, registry));
270 } 281 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 - (void)hideSoon { 334 - (void)hideSoon {
324 hideTimer_.reset( 335 hideTimer_.reset(
325 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay 336 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay
326 target:self 337 target:self
327 selector:@selector(hideTimerFired:) 338 selector:@selector(hideTimerFired:)
328 userInfo:nil 339 userInfo:nil
329 repeats:NO] retain]); 340 repeats:NO] retain]);
330 } 341 }
331 342
332 @end 343 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698