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

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

Issue 2955963002: Update Chrome Upstream flow to reflect new UI mocks (Closed)
Patch Set: Code review changes Created 3 years, 5 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 #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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 *rb->GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); 125 *rb->GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia());
126 } 126 }
127 close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); 127 close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE));
128 close_button->SizeToPreferredSize(); 128 close_button->SizeToPreferredSize();
129 return close_button; 129 return close_button;
130 } 130 }
131 131
132 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { 132 gfx::Rect BubbleFrameView::GetBoundsForClientView() const {
133 gfx::Rect client_bounds = GetContentsBounds(); 133 gfx::Rect client_bounds = GetContentsBounds();
134 client_bounds.Inset(GetInsets()); 134 client_bounds.Inset(GetInsets());
135 if (footnote_container_) { 135 if (footnote_container_ && footnote_container_->visible()) {
136 client_bounds.set_height(client_bounds.height() - 136 client_bounds.set_height(client_bounds.height() -
137 footnote_container_->height()); 137 footnote_container_->height());
138 } 138 }
139 return client_bounds; 139 return client_bounds;
140 } 140 }
141 141
142 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( 142 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds(
143 const gfx::Rect& client_bounds) const { 143 const gfx::Rect& client_bounds) const {
144 gfx::Size size(GetSizeForClientSize(client_bounds.size())); 144 gfx::Size size(GetSizeForClientSize(client_bounds.size()));
145 return bubble_border_->GetBounds(gfx::Rect(), size); 145 return bubble_border_->GetBounds(gfx::Rect(), size);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 title_height = std::max(title_height, title_->height()); 333 title_height = std::max(title_height, title_->height());
334 title_->SetPosition(gfx::Point( 334 title_->SetPosition(gfx::Point(
335 title_label_x, bounds.y() + (title_height - title_->height()) / 2)); 335 title_label_x, bounds.y() + (title_height - title_->height()) / 2));
336 } 336 }
337 337
338 title_icon_->SetBounds(bounds.x(), bounds.y(), title_icon_pref_size.width(), 338 title_icon_->SetBounds(bounds.x(), bounds.y(), title_icon_pref_size.width(),
339 title_height); 339 title_height);
340 bounds.set_width(title_->bounds().right() - bounds.x()); 340 bounds.set_width(title_->bounds().right() - bounds.x());
341 bounds.set_height(title_height); 341 bounds.set_height(title_height);
342 342
343 if (footnote_container_) { 343 if (footnote_container_ && footnote_container_->visible()) {
344 const int width = contents_bounds.width(); 344 const int width = contents_bounds.width();
345 const int height = footnote_container_->GetHeightForWidth(width); 345 const int height = footnote_container_->GetHeightForWidth(width);
346 footnote_container_->SetBounds( 346 footnote_container_->SetBounds(
347 contents_bounds.x(), contents_bounds.bottom() - height, width, height); 347 contents_bounds.x(), contents_bounds.bottom() - height, width, height);
348 } 348 }
349 } 349 }
350 350
351 void BubbleFrameView::OnThemeChanged() { 351 void BubbleFrameView::OnThemeChanged() {
352 UpdateWindowTitle(); 352 UpdateWindowTitle();
353 ResetWindowControls(); 353 ResetWindowControls();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 DCHECK(!footnote_container_); 410 DCHECK(!footnote_container_);
411 footnote_container_ = new views::View(); 411 footnote_container_ = new views::View();
412 footnote_container_->SetLayoutManager( 412 footnote_container_->SetLayoutManager(
413 new BoxLayout(BoxLayout::kVertical, content_margins_, 0)); 413 new BoxLayout(BoxLayout::kVertical, content_margins_, 0));
414 footnote_container_->SetBackground( 414 footnote_container_->SetBackground(
415 CreateSolidBackground(kFootnoteBackgroundColor)); 415 CreateSolidBackground(kFootnoteBackgroundColor));
416 footnote_container_->SetBorder( 416 footnote_container_->SetBorder(
417 CreateSolidSidedBorder(1, 0, 0, 0, kFootnoteBorderColor)); 417 CreateSolidSidedBorder(1, 0, 0, 0, kFootnoteBorderColor));
418 footnote_container_->AddChildView(view); 418 footnote_container_->AddChildView(view);
419 footnote_container_->SetVisible(view->visible());
419 AddChildView(footnote_container_); 420 AddChildView(footnote_container_);
420 } 421 }
421 422
422 gfx::Rect BubbleFrameView::GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, 423 gfx::Rect BubbleFrameView::GetUpdatedWindowBounds(const gfx::Rect& anchor_rect,
423 const gfx::Size& client_size, 424 const gfx::Size& client_size,
424 bool adjust_if_offscreen) { 425 bool adjust_if_offscreen) {
425 gfx::Size size(GetSizeForClientSize(client_size)); 426 gfx::Size size(GetSizeForClientSize(client_size));
426 427
427 const BubbleBorder::Arrow arrow = bubble_border_->arrow(); 428 const BubbleBorder::Arrow arrow = bubble_border_->arrow();
428 if (adjust_if_offscreen && BubbleBorder::has_arrow(arrow)) { 429 if (adjust_if_offscreen && BubbleBorder::has_arrow(arrow)) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 title_bar_width += title_margins_.left(); 535 title_bar_width += title_margins_.left();
535 title_bar_width += title_icon_size.width(); 536 title_bar_width += title_icon_size.width();
536 if (close_->visible()) 537 if (close_->visible())
537 title_bar_width += close_->width() + 1; 538 title_bar_width += close_->width() + 1;
538 539
539 gfx::Size size(client_size); 540 gfx::Size size(client_size);
540 gfx::Insets client_insets = GetInsets(); 541 gfx::Insets client_insets = GetInsets();
541 size.Enlarge(client_insets.width(), client_insets.height()); 542 size.Enlarge(client_insets.width(), client_insets.height());
542 size.SetToMax(gfx::Size(title_bar_width, 0)); 543 size.SetToMax(gfx::Size(title_bar_width, 0));
543 544
544 if (footnote_container_) 545 if (footnote_container_ && footnote_container_->child_count() >= 1)
Mathieu 2017/06/27 21:12:06 {}
Jared Saul 2017/06/27 21:45:55 Factored out the footnote_container_ check and add
546 footnote_container_->SetVisible(
547 footnote_container_->child_at(0)->visible());
548 if (footnote_container_ && footnote_container_->visible())
545 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); 549 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width()));
546 550
547 DialogDelegate* dialog_delegate = 551 DialogDelegate* dialog_delegate =
548 GetWidget()->widget_delegate()->AsDialogDelegate(); 552 GetWidget()->widget_delegate()->AsDialogDelegate();
549 if (dialog_delegate && dialog_delegate->ShouldSnapFrameWidth()) 553 if (dialog_delegate && dialog_delegate->ShouldSnapFrameWidth())
550 size.set_width(LayoutProvider::Get()->GetSnappedDialogWidth(size.width())); 554 size.set_width(LayoutProvider::Get()->GetSnappedDialogWidth(size.width()));
551 555
552 return size; 556 return size;
553 } 557 }
554 558
555 } // namespace views 559 } // namespace views
OLDNEW
« components/autofill_strings.grdp ('K') | « components/autofill_strings.grdp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698