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

Side by Side Diff: ui/views/bubble/bubble_frame_view.cc

Issue 2696263002: Refactor ViewsDelegate and MD-ify the icon-to-text spacing for checkbox and radiobutton (Closed)
Patch Set: Used ifdef instead of duplicated code for delegate initialization Created 3 years, 9 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
« no previous file with comments | « ui/views/bubble/bubble_dialog_delegate.cc ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/views/bubble/bubble_frame_view.h" 5 #include "ui/views/bubble/bubble_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // there's no title. 307 // there's no title.
308 DCHECK(!title_margins_.IsEmpty() || !title_->visible()); 308 DCHECK(!title_margins_.IsEmpty() || !title_->visible());
309 309
310 const gfx::Rect contents_bounds = GetContentsBounds(); 310 const gfx::Rect contents_bounds = GetContentsBounds();
311 gfx::Rect bounds = contents_bounds; 311 gfx::Rect bounds = contents_bounds;
312 bounds.Inset(title_margins_); 312 bounds.Inset(title_margins_);
313 if (bounds.IsEmpty()) 313 if (bounds.IsEmpty())
314 return; 314 return;
315 315
316 // The close button is positioned somewhat closer to the edge of the bubble. 316 // The close button is positioned somewhat closer to the edge of the bubble.
317 const int close_margin = 317 const int close_margin = ViewsDelegate::GetInstance()->GetDistanceMetric(
318 ViewsDelegate::GetInstance()->GetDialogCloseButtonMargin(); 318 DistanceMetric::CLOSE_BUTTON_MARGIN);
319 close_->SetPosition( 319 close_->SetPosition(
320 gfx::Point(contents_bounds.right() - close_margin - close_->width(), 320 gfx::Point(contents_bounds.right() - close_margin - close_->width(),
321 contents_bounds.y() + close_margin)); 321 contents_bounds.y() + close_margin));
322 322
323 gfx::Size title_icon_pref_size(title_icon_->GetPreferredSize()); 323 gfx::Size title_icon_pref_size(title_icon_->GetPreferredSize());
324 int padding = 0; 324 int padding = 0;
325 int title_height = title_icon_pref_size.height(); 325 int title_height = title_icon_pref_size.height();
326 326
327 if (title_->visible() && !title_->text().empty()) { 327 if (title_->visible() && !title_->text().empty()) {
328 if (title_icon_pref_size.width() > 0) 328 if (title_icon_pref_size.width() > 0)
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 size.Enlarge(client_insets.width(), client_insets.height()); 530 size.Enlarge(client_insets.width(), client_insets.height());
531 size.SetToMax(gfx::Size(title_bar_width, 0)); 531 size.SetToMax(gfx::Size(title_bar_width, 0));
532 532
533 if (footnote_container_) 533 if (footnote_container_)
534 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); 534 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width()));
535 535
536 return size; 536 return size;
537 } 537 }
538 538
539 } // namespace views 539 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_dialog_delegate.cc ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698