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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.mm

Issue 2076093004: [Extensions UI] Handle multiple warning bubbles racing to show (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win tests Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/cocoa/extensions/toolbar_actions_bar_bubble_mac.h" 5 #import "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 // Private ///////////////////////////////////////////////////////////////////// 112 // Private /////////////////////////////////////////////////////////////////////
113 113
114 - (void)windowWillClose:(NSNotification*)notification { 114 - (void)windowWillClose:(NSNotification*)notification {
115 if (!acknowledged_) { 115 if (!acknowledged_) {
116 delegate_->OnBubbleClosed( 116 delegate_->OnBubbleClosed(
117 ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION); 117 ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION);
118 acknowledged_ = YES; 118 acknowledged_ = YES;
119 } 119 }
120 // Deallocation happens asynchronously in Cocoa, but that makes testing
121 // difficult. Explicitly destroy |delegate_| here so it can perform any
122 // necessary cleanup.
123 delegate_.reset();
120 [super windowWillClose:notification]; 124 [super windowWillClose:notification];
121 } 125 }
122 126
123 - (NSAttributedString*)attributedStringWithString:(const base::string16&)string 127 - (NSAttributedString*)attributedStringWithString:(const base::string16&)string
124 fontSize:(CGFloat)fontSize 128 fontSize:(CGFloat)fontSize
125 alignment:(NSTextAlignment)alignment { 129 alignment:(NSTextAlignment)alignment {
126 NSString* cocoaString = base::SysUTF16ToNSString(string); 130 NSString* cocoaString = base::SysUTF16ToNSString(string);
127 base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( 131 base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle(
128 [[NSMutableParagraphStyle alloc] init]); 132 [[NSMutableParagraphStyle alloc] init]);
129 [paragraphStyle setAlignment:alignment]; 133 [paragraphStyle setAlignment:alignment];
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } else { 343 } else {
340 DCHECK_EQ(sender, actionButton_); 344 DCHECK_EQ(sender, actionButton_);
341 action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE; 345 action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE;
342 } 346 }
343 acknowledged_ = YES; 347 acknowledged_ = YES;
344 delegate_->OnBubbleClosed(action); 348 delegate_->OnBubbleClosed(action);
345 [self close]; 349 [self close];
346 } 350 }
347 351
348 @end 352 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698