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

Side by Side Diff: chrome/browser/ui/cocoa/confirm_bubble_cocoa.mm

Issue 1242383005: Remove unused code in ConfirmBubbleModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/confirm_bubble_cocoa.h" 5 #import "chrome/browser/ui/cocoa/confirm_bubble_cocoa.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "chrome/browser/themes/theme_service.h" 8 #include "chrome/browser/themes/theme_service.h"
9 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h" 9 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h"
10 #include "chrome/browser/ui/confirm_bubble.h" 10 #include "chrome/browser/ui/confirm_bubble.h"
(...skipping 10 matching lines...) Expand all
21 const int kBubbleCornerRadius = 3; 21 const int kBubbleCornerRadius = 3;
22 22
23 // The color for the border of this bubble view. 23 // The color for the border of this bubble view.
24 const float kBubbleWindowEdge = 0.7f; 24 const float kBubbleWindowEdge = 0.7f;
25 25
26 // Constants used for layouting controls. These variables are copied from 26 // Constants used for layouting controls. These variables are copied from
27 // "ui/views/layout/layout_constants.h". 27 // "ui/views/layout/layout_constants.h".
28 // Vertical spacing between a label and some control. 28 // Vertical spacing between a label and some control.
29 const int kLabelToControlVerticalSpacing = 8; 29 const int kLabelToControlVerticalSpacing = 8;
30 30
31 // Horizontal spacing between controls that are logically related.
32 const int kRelatedControlHorizontalSpacing = 8;
33
34 // Vertical spacing between controls that are logically related. 31 // Vertical spacing between controls that are logically related.
35 const int kRelatedControlVerticalSpacing = 8; 32 const int kRelatedControlVerticalSpacing = 8;
36 33
37 // Vertical spacing between the edge of the window and the 34 // Vertical spacing between the edge of the window and the
38 // top or bottom of a button. 35 // top or bottom of a button.
39 const int kButtonVEdgeMargin = 6; 36 const int kButtonVEdgeMargin = 6;
40 37
41 // Horizontal spacing between the edge of the window and the 38 // Horizontal spacing between the edge of the window and the
42 // left or right of a button. 39 // left or right of a button.
43 const int kButtonHEdgeMargin = 7; 40 const int kButtonHEdgeMargin = 7;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 [messageLabel_.get() setDrawsBackground:NO]; 228 [messageLabel_.get() setDrawsBackground:NO];
232 [messageLabel_.get() setDelegate:self]; 229 [messageLabel_.get() setDelegate:self];
233 [messageLabel_.get() sizeToFit]; 230 [messageLabel_.get() sizeToFit];
234 height = NSHeight([messageLabel_.get() frame]); 231 height = NSHeight([messageLabel_.get() frame]);
235 [self addSubview:messageLabel_.get()]; 232 [self addSubview:messageLabel_.get()];
236 233
237 // Add the icon and the title label to the third row. 234 // Add the icon and the title label to the third row.
238 left = kButtonHEdgeMargin; 235 left = kButtonHEdgeMargin;
239 right = NSWidth(frameRect); 236 right = NSWidth(frameRect);
240 bottom += height + kLabelToControlVerticalSpacing; 237 bottom += height + kLabelToControlVerticalSpacing;
241 height = 0;
242 NSImage* iconImage = [controller_ icon];
243 if (iconImage) {
244 icon_.reset([[NSImageView alloc] initWithFrame:NSMakeRect(
245 left, bottom, [iconImage size].width, [iconImage size].height)]);
246 [icon_.get() setImage:iconImage];
247 [self addSubview:icon_.get()];
248 left += NSWidth([icon_.get() frame]) + kRelatedControlHorizontalSpacing;
249 height = std::max(height, NSHeight([icon_.get() frame]));
250 }
251 titleLabel_.reset([[NSTextView alloc] 238 titleLabel_.reset([[NSTextView alloc]
252 initWithFrame:NSMakeRect(left, bottom, right - left, 0)]); 239 initWithFrame:NSMakeRect(left, bottom, right - left, 0)]);
253 [titleLabel_.get() setString:[controller_ title]]; 240 [titleLabel_.get() setString:[controller_ title]];
254 [titleLabel_.get() setHorizontallyResizable:NO]; 241 [titleLabel_.get() setHorizontallyResizable:NO];
255 [titleLabel_.get() setVerticallyResizable:YES]; 242 [titleLabel_.get() setVerticallyResizable:YES];
256 [titleLabel_.get() setEditable:NO]; 243 [titleLabel_.get() setEditable:NO];
257 [titleLabel_.get() setSelectable:NO]; 244 [titleLabel_.get() setSelectable:NO];
258 [titleLabel_.get() setDrawsBackground:NO]; 245 [titleLabel_.get() setDrawsBackground:NO];
259 [titleLabel_.get() sizeToFit]; 246 [titleLabel_.get() sizeToFit];
260 [self addSubview:titleLabel_.get()]; 247 [self addSubview:titleLabel_.get()];
261 height = std::max(height, NSHeight([titleLabel_.get() frame])); 248 height = NSHeight([titleLabel_.get() frame]);
262 249
263 // Adjust the frame rectangle of this bubble so we can show all controls. 250 // Adjust the frame rectangle of this bubble so we can show all controls.
264 NSRect parentRect = [parent_ frame]; 251 NSRect parentRect = [parent_ frame];
265 frameRect.size.height = bottom + height + kButtonVEdgeMargin; 252 frameRect.size.height = bottom + height + kButtonVEdgeMargin;
266 frameRect.origin.x = (NSWidth(parentRect) - NSWidth(frameRect)) / 2; 253 frameRect.origin.x = (NSWidth(parentRect) - NSWidth(frameRect)) / 2;
267 frameRect.origin.y = NSHeight(parentRect) - NSHeight(frameRect); 254 frameRect.origin.y = NSHeight(parentRect) - NSHeight(frameRect);
268 [self setFrame:frameRect]; 255 [self setFrame:frameRect];
269 } 256 }
270 257
271 // Closes this bubble and releases all resources. This function just puts the 258 // Closes this bubble and releases all resources. This function just puts the
(...skipping 16 matching lines...) Expand all
288 275
289 - (void)clickCancel { 276 - (void)clickCancel {
290 [self cancel:self]; 277 [self cancel:self];
291 } 278 }
292 279
293 - (void)clickLink { 280 - (void)clickLink {
294 [self textView:messageLabel_.get() clickedOnLink:nil atIndex:0]; 281 [self textView:messageLabel_.get() clickedOnLink:nil atIndex:0];
295 } 282 }
296 283
297 @end 284 @end
OLDNEW
« no previous file with comments | « chrome/browser/renderer_context_menu/spelling_bubble_model.cc ('k') | chrome/browser/ui/cocoa/confirm_bubble_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698