OLD | NEW |
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 "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 - (IBAction)showWindow:(id)sender { | 99 - (IBAction)showWindow:(id)sender { |
100 delegate_->OnBubbleShown(); | 100 delegate_->OnBubbleShown(); |
101 [super showWindow:sender]; | 101 [super showWindow:sender]; |
102 } | 102 } |
103 | 103 |
104 // Private ///////////////////////////////////////////////////////////////////// | 104 // Private ///////////////////////////////////////////////////////////////////// |
105 | 105 |
106 - (void)windowWillClose:(NSNotification*)notification { | 106 - (void)windowWillClose:(NSNotification*)notification { |
107 if (!acknowledged_) { | 107 if (!acknowledged_) { |
108 delegate_->OnBubbleClosed( | 108 delegate_->OnBubbleClosed( |
109 ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION); | 109 ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS); |
110 acknowledged_ = YES; | 110 acknowledged_ = YES; |
111 } | 111 } |
112 [super windowWillClose:notification]; | 112 [super windowWillClose:notification]; |
113 } | 113 } |
114 | 114 |
115 - (NSAttributedString*)attributedStringWithString:(const base::string16&)string | 115 - (NSAttributedString*)attributedStringWithString:(const base::string16&)string |
116 fontSize:(CGFloat)fontSize | 116 fontSize:(CGFloat)fontSize |
117 alignment:(NSTextAlignment)alignment { | 117 alignment:(NSTextAlignment)alignment { |
118 NSString* cocoaString = base::SysUTF16ToNSString(string); | 118 NSString* cocoaString = base::SysUTF16ToNSString(string); |
119 base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( | 119 base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 } | 320 } |
321 | 321 |
322 - (void)onButtonClicked:(id)sender { | 322 - (void)onButtonClicked:(id)sender { |
323 if (acknowledged_) | 323 if (acknowledged_) |
324 return; | 324 return; |
325 ToolbarActionsBarBubbleDelegate::CloseAction action = | 325 ToolbarActionsBarBubbleDelegate::CloseAction action = |
326 ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE; | 326 ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE; |
327 if (learnMoreButton_ && sender == learnMoreButton_) { | 327 if (learnMoreButton_ && sender == learnMoreButton_) { |
328 action = ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE; | 328 action = ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE; |
329 } else if (dismissButton_ && sender == dismissButton_) { | 329 } else if (dismissButton_ && sender == dismissButton_) { |
330 action = ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_USER_ACTION; | 330 action = ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS; |
331 } else { | 331 } else { |
332 DCHECK_EQ(sender, actionButton_); | 332 DCHECK_EQ(sender, actionButton_); |
333 action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE; | 333 action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE; |
334 } | 334 } |
335 acknowledged_ = YES; | 335 acknowledged_ = YES; |
336 delegate_->OnBubbleClosed(action); | 336 delegate_->OnBubbleClosed(action); |
337 [self close]; | 337 [self close]; |
338 } | 338 } |
339 | 339 |
340 @end | 340 @end |
OLD | NEW |