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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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] |
146 initWithArrowLocation:info_bubble::kTopRight]); | 146 initWithArrowLocation:views::BubbleBorder::TOP_RIGHT]); |
147 [tooltipController_ setImage: | 147 [tooltipController_ setImage: |
148 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 148 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
149 IDR_AUTOFILL_TOOLTIP_ICON).ToNSImage()]; | 149 IDR_AUTOFILL_TOOLTIP_ICON).ToNSImage()]; |
150 [tooltipController_ setMessage: | 150 [tooltipController_ setMessage: |
151 base::SysUTF16ToNSString(notification->tooltip_text())]; | 151 base::SysUTF16ToNSString(notification->tooltip_text())]; |
152 [[tooltipController_ view] setHidden: | 152 [[tooltipController_ view] setHidden: |
153 [[tooltipController_ message] length] == 0]; | 153 [[tooltipController_ message] length] == 0]; |
154 | 154 |
155 [view setSubviews:@[ textview_, checkbox_, [tooltipController_ view] ]]; | 155 [view setSubviews:@[ textview_, checkbox_, [tooltipController_ view] ]]; |
156 } | 156 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 264 } |
265 | 265 |
266 - (BOOL)textView:(NSTextView *)textView | 266 - (BOOL)textView:(NSTextView *)textView |
267 clickedOnLink:(id)link | 267 clickedOnLink:(id)link |
268 atIndex:(NSUInteger)charIndex { | 268 atIndex:(NSUInteger)charIndex { |
269 delegate_->LinkClicked(linkURL_); | 269 delegate_->LinkClicked(linkURL_); |
270 return YES; | 270 return YES; |
271 } | 271 } |
272 | 272 |
273 @end | 273 @end |
OLD | NEW |