OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill/autofill_notification_controller.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_notification_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 [checkbox_ setState:(notification->checked() ? NSOnState : NSOffState)]; | 135 [checkbox_ setState:(notification->checked() ? NSOnState : NSOffState)]; |
136 [checkbox_ setAttributedTitle:[textview_ textStorage]]; | 136 [checkbox_ setAttributedTitle:[textview_ textStorage]]; |
137 [checkbox_ setTarget:self]; | 137 [checkbox_ setTarget:self]; |
138 [checkbox_ setAction:@selector(checkboxClicked:)]; | 138 [checkbox_ setAction:@selector(checkboxClicked:)]; |
139 // Set the size that preferredSizeForWidth will use. Do this here because | 139 // Set the size that preferredSizeForWidth will use. Do this here because |
140 // (1) preferredSizeForWidth is logically const, and so shouldn't have a | 140 // (1) preferredSizeForWidth is logically const, and so shouldn't have a |
141 // side-effect of updating the checkbox's frame, and | 141 // side-effect of updating the checkbox's frame, and |
142 // (2) this way, the sizing computation can be cached. | 142 // (2) this way, the sizing computation can be cached. |
143 [checkbox_ sizeToFit]; | 143 [checkbox_ sizeToFit]; |
144 | 144 |
145 tooltipController_.reset([[AutofillTooltipController alloc] | 145 tooltipController_.reset([[AutofillTooltipController alloc] init]); |
146 initWithArrowLocation:info_bubble::kTopRight]); | |
147 [tooltipController_ setImage: | 146 [tooltipController_ setImage: |
148 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 147 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
149 IDR_AUTOFILL_TOOLTIP_ICON).ToNSImage()]; | 148 IDR_AUTOFILL_TOOLTIP_ICON).ToNSImage()]; |
150 [tooltipController_ setMessage: | 149 [tooltipController_ setMessage: |
151 base::SysUTF16ToNSString(notification->tooltip_text())]; | 150 base::SysUTF16ToNSString(notification->tooltip_text())]; |
152 [[tooltipController_ view] setHidden: | 151 [[tooltipController_ view] setHidden: |
153 [[tooltipController_ message] length] == 0]; | 152 [[tooltipController_ message] length] == 0]; |
154 | 153 |
155 [view setSubviews:@[ textview_, checkbox_, [tooltipController_ view] ]]; | 154 [view setSubviews:@[ textview_, checkbox_, [tooltipController_ view] ]]; |
156 } | 155 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 263 } |
265 | 264 |
266 - (BOOL)textView:(NSTextView *)textView | 265 - (BOOL)textView:(NSTextView *)textView |
267 clickedOnLink:(id)link | 266 clickedOnLink:(id)link |
268 atIndex:(NSUInteger)charIndex { | 267 atIndex:(NSUInteger)charIndex { |
269 delegate_->LinkClicked(linkURL_); | 268 delegate_->LinkClicked(linkURL_); |
270 return YES; | 269 return YES; |
271 } | 270 } |
272 | 271 |
273 @end | 272 @end |
OLD | NEW |