Chromium Code Reviews| 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] init]); | 145 tooltipController_.reset([[AutofillTooltipController alloc] |
| 146 initWithArrowLocation:info_bubble::kTopRight]); | |
|
groby-ooo-7-16
2013/12/13 01:35:49
That's a lot of code for a single kTopCenter... Wh
Ilya Sherman
2013/12/13 02:17:07
Well, because the tooltip controller doesn't alway
| |
| 146 [tooltipController_ setImage: | 147 [tooltipController_ setImage: |
| 147 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 148 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 148 IDR_AUTOFILL_TOOLTIP_ICON).ToNSImage()]; | 149 IDR_AUTOFILL_TOOLTIP_ICON).ToNSImage()]; |
| 149 [tooltipController_ setMessage: | 150 [tooltipController_ setMessage: |
| 150 base::SysUTF16ToNSString(notification->tooltip_text())]; | 151 base::SysUTF16ToNSString(notification->tooltip_text())]; |
| 151 [[tooltipController_ view] setHidden: | 152 [[tooltipController_ view] setHidden: |
| 152 [[tooltipController_ message] length] == 0]; | 153 [[tooltipController_ message] length] == 0]; |
| 153 | 154 |
| 154 [view setSubviews:@[ textview_, checkbox_, [tooltipController_ view] ]]; | 155 [view setSubviews:@[ textview_, checkbox_, [tooltipController_ view] ]]; |
| 155 } | 156 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 } | 264 } |
| 264 | 265 |
| 265 - (BOOL)textView:(NSTextView *)textView | 266 - (BOOL)textView:(NSTextView *)textView |
| 266 clickedOnLink:(id)link | 267 clickedOnLink:(id)link |
| 267 atIndex:(NSUInteger)charIndex { | 268 atIndex:(NSUInteger)charIndex { |
| 268 delegate_->LinkClicked(linkURL_); | 269 delegate_->LinkClicked(linkURL_); |
| 269 return YES; | 270 return YES; |
| 270 } | 271 } |
| 271 | 272 |
| 272 @end | 273 @end |
| OLD | NEW |