Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_notification_controller.mm

Issue 23546007: [rAC, OSX] Namespaced constants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix namespace comment. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 23 matching lines...) Expand all
34 [super drawRect:dirtyRect]; 34 [super drawRect:dirtyRect];
35 35
36 NSRect backgroundRect = [self bounds]; 36 NSRect backgroundRect = [self bounds];
37 if (hasArrow_) { 37 if (hasArrow_) {
38 NSPoint anchorPoint = NSMakePoint(NSMidX([arrowAnchorView_ bounds]), 0); 38 NSPoint anchorPoint = NSMakePoint(NSMidX([arrowAnchorView_ bounds]), 0);
39 anchorPoint = [self convertPoint:anchorPoint fromView:arrowAnchorView_]; 39 anchorPoint = [self convertPoint:anchorPoint fromView:arrowAnchorView_];
40 anchorPoint.y = NSMaxY([self bounds]); 40 anchorPoint.y = NSMaxY([self bounds]);
41 41
42 NSBezierPath* arrow = [NSBezierPath bezierPath]; 42 NSBezierPath* arrow = [NSBezierPath bezierPath];
43 [arrow moveToPoint:anchorPoint]; 43 [arrow moveToPoint:anchorPoint];
44 [arrow relativeLineToPoint:NSMakePoint(-kArrowWidth / 2.0, -kArrowHeight)]; 44 [arrow relativeLineToPoint:
45 [arrow relativeLineToPoint:NSMakePoint(kArrowWidth, 0)]; 45 NSMakePoint(-autofill::kArrowWidth / 2.0, -autofill::kArrowHeight)];
46 [arrow relativeLineToPoint:NSMakePoint(autofill::kArrowWidth, 0)];
46 [arrow closePath]; 47 [arrow closePath];
47 [backgroundColor_ setFill]; 48 [backgroundColor_ setFill];
48 [arrow fill]; 49 [arrow fill];
49 backgroundRect.size.height -= kArrowHeight; 50 backgroundRect.size.height -= autofill::kArrowHeight;
50 } 51 }
51 52
52 dirtyRect = NSIntersectionRect(backgroundRect, dirtyRect); 53 dirtyRect = NSIntersectionRect(backgroundRect, dirtyRect);
53 [backgroundColor_ setFill]; 54 [backgroundColor_ setFill];
54 NSRectFill(dirtyRect); 55 NSRectFill(dirtyRect);
55 } 56 }
56 57
57 - (NSColor*)backgroundColor { 58 - (NSColor*)backgroundColor {
58 return backgroundColor_; 59 return backgroundColor_;
59 } 60 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 if (![checkbox_ isHidden]) 143 if (![checkbox_ isHidden])
143 textRect.size.width -= checkboxSizeWithoutTitle_.width; 144 textRect.size.width -= checkboxSizeWithoutTitle_.width;
144 145
145 NSSize preferredSize = [[textfield_ cell] cellSizeForBounds:textRect]; 146 NSSize preferredSize = [[textfield_ cell] cellSizeForBounds:textRect];
146 if (![checkbox_ isHidden]) { 147 if (![checkbox_ isHidden]) {
147 preferredSize.height = std::max(preferredSize.height, 148 preferredSize.height = std::max(preferredSize.height,
148 checkboxSizeWithoutTitle_.height); 149 checkboxSizeWithoutTitle_.height);
149 } 150 }
150 151
151 if ([[self notificationView] hasArrow]) 152 if ([[self notificationView] hasArrow])
152 preferredSize.height += kArrowHeight; 153 preferredSize.height += autofill::kArrowHeight;
153 154
154 preferredSize.height += 2 * kNotificationPadding; 155 preferredSize.height += 2 * autofill::kNotificationPadding;
155 return preferredSize; 156 return preferredSize;
156 } 157 }
157 158
158 - (NSSize)preferredSize { 159 - (NSSize)preferredSize {
159 NOTREACHED(); 160 NOTREACHED();
160 return NSZeroSize; 161 return NSZeroSize;
161 } 162 }
162 163
163 - (void)performLayout { 164 - (void)performLayout {
164 NSRect bounds = [[self view] bounds]; 165 NSRect bounds = [[self view] bounds];
165 if ([[self notificationView] hasArrow]) 166 if ([[self notificationView] hasArrow])
166 bounds.size.height -= kArrowHeight; 167 bounds.size.height -= autofill::kArrowHeight;
167 168
168 NSRect textFrame = NSInsetRect(bounds, 0, kNotificationPadding); 169 NSRect textFrame = NSInsetRect(bounds, 0, autofill::kNotificationPadding);
169 if (![checkbox_ isHidden]) { 170 if (![checkbox_ isHidden]) {
170 // Temporarily resize checkbox to just the box, no extra clickable area. 171 // Temporarily resize checkbox to just the box, no extra clickable area.
171 textFrame.origin.x += checkboxSizeWithoutTitle_.width; 172 textFrame.origin.x += checkboxSizeWithoutTitle_.width;
172 textFrame.size.width -= checkboxSizeWithoutTitle_.width; 173 textFrame.size.width -= checkboxSizeWithoutTitle_.width;
173 textFrame.size = [[textfield_ cell] cellSizeForBounds:textFrame]; 174 textFrame.size = [[textfield_ cell] cellSizeForBounds:textFrame];
174 175
175 NSRect checkboxFrame = 176 NSRect checkboxFrame =
176 NSMakeRect(0, 0, NSMaxX(textFrame), NSHeight(textFrame)); 177 NSMakeRect(0, 0, NSMaxX(textFrame), NSHeight(textFrame));
177 [checkbox_ setFrame:checkboxFrame]; 178 [checkbox_ setFrame:checkboxFrame];
178 } 179 }
179 [textfield_ setFrame:textFrame]; 180 [textfield_ setFrame:textFrame];
180 } 181 }
181 182
182 @end 183 @end
183 184
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698