OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_details_container.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // window width, align the right edge of bubble and view. In all other | 199 // window width, align the right edge of bubble and view. In all other |
200 // cases, align the left edge of the bubble and the view. | 200 // cases, align the left edge of the bubble and the view. |
201 // Alignment is based on maximum width to avoid the arrow changing positions | 201 // Alignment is based on maximum width to avoid the arrow changing positions |
202 // if the validation bubble stays on the same field but gets a message of | 202 // if the validation bubble stays on the same field but gets a message of |
203 // differing length. (E.g. "Field is required"/"Invalid Zip Code. Please | 203 // differing length. (E.g. "Field is required"/"Invalid Zip Code. Please |
204 // check and try again" if an empty zip field gets changed to a bad zip). | 204 // check and try again" if an empty zip field gets changed to a bad zip). |
205 NSPoint anchorPoint; | 205 NSPoint anchorPoint; |
206 if ((NSMinX(viewRect) + [errorBubbleController_ maxWidth]) > | 206 if ((NSMinX(viewRect) + [errorBubbleController_ maxWidth]) > |
207 NSWidth([parentWindow frame])) { | 207 NSWidth([parentWindow frame])) { |
208 anchorPoint = NSMakePoint(NSMaxX(viewRect), NSMinY(viewRect)); | 208 anchorPoint = NSMakePoint(NSMaxX(viewRect), NSMinY(viewRect)); |
209 [[errorBubbleController_ bubble] setArrowLocation:info_bubble::kTopRight]; | 209 [[errorBubbleController_ bubble] |
| 210 setArrowLocation:views::BubbleBorder::TOP_RIGHT]; |
210 [[errorBubbleController_ bubble] setAlignment: | 211 [[errorBubbleController_ bubble] setAlignment: |
211 info_bubble::kAlignRightEdgeToAnchorEdge]; | 212 info_bubble::kAlignRightEdgeToAnchorEdge]; |
212 | 213 |
213 } else { | 214 } else { |
214 anchorPoint = NSMakePoint(NSMinX(viewRect), NSMinY(viewRect)); | 215 anchorPoint = NSMakePoint(NSMinX(viewRect), NSMinY(viewRect)); |
215 [[errorBubbleController_ bubble] setArrowLocation:info_bubble::kTopLeft]; | 216 [[errorBubbleController_ bubble] |
| 217 setArrowLocation:views::BubbleBorder::TOP_LEFT]; |
216 [[errorBubbleController_ bubble] setAlignment: | 218 [[errorBubbleController_ bubble] setAlignment: |
217 info_bubble::kAlignLeftEdgeToAnchorEdge]; | 219 info_bubble::kAlignLeftEdgeToAnchorEdge]; |
218 } | 220 } |
219 [errorBubbleController_ setAnchorPoint: | 221 [errorBubbleController_ setAnchorPoint: |
220 [parentWindow convertBaseToScreen:anchorPoint]]; | 222 [parentWindow convertBaseToScreen:anchorPoint]]; |
221 | 223 |
222 errorBubbleAnchorView_ = field; | 224 errorBubbleAnchorView_ = field; |
223 [errorBubbleController_ showWindow:self]; | 225 [errorBubbleController_ showWindow:self]; |
224 } | 226 } |
225 | 227 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } | 282 } |
281 | 283 |
282 selectedField = field; | 284 selectedField = field; |
283 selectedFieldOrigin = fieldOrigin; | 285 selectedFieldOrigin = fieldOrigin; |
284 } | 286 } |
285 | 287 |
286 return selectedField; | 288 return selectedField; |
287 } | 289 } |
288 | 290 |
289 @end | 291 @end |
OLD | NEW |