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

Side by Side Diff: chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc

Issue 2785683003: views: implement width snapping for DialogDelegateViews (Closed)
Patch Set: Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/views/autofill/card_unmask_prompt_views.h" 5 #include "chrome/browser/ui/views/autofill/card_unmask_prompt_views.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 views::TooltipIcon* icon = new views::TooltipIcon(l10n_util::GetStringUTF16( 238 views::TooltipIcon* icon = new views::TooltipIcon(l10n_util::GetStringUTF16(
239 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP)); 239 IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP));
240 const int kTooltipWidth = 233; 240 const int kTooltipWidth = 233;
241 icon->set_bubble_width(kTooltipWidth); 241 icon->set_bubble_width(kTooltipWidth);
242 storage_row_->AddChildView(icon); 242 storage_row_->AddChildView(icon);
243 243
244 return storage_row_; 244 return storage_row_;
245 } 245 }
246 246
247 gfx::Size CardUnmaskPromptViews::GetPreferredSize() const { 247 gfx::Size CardUnmaskPromptViews::GetUnsnappedPreferredSize() const {
248 // Must hardcode a width so the label knows where to wrap. 248 // Must hardcode a width so the label knows where to wrap.
Peter Kasting 2017/03/30 00:35:34 Nit: I suggest filing a followup bug on computing
249 const int kWidth = 375; 249 const int kWidth = 375;
250 return gfx::Size(kWidth, GetHeightForWidth(kWidth)); 250 return gfx::Size(kWidth, GetHeightForWidth(kWidth));
Peter Kasting 2017/03/30 00:35:34 This line exposes a problem I didn't fully think t
251 } 251 }
252 252
253 void CardUnmaskPromptViews::Layout() { 253 void CardUnmaskPromptViews::Layout() {
254 gfx::Rect contents_bounds = GetContentsBounds(); 254 gfx::Rect contents_bounds = GetContentsBounds();
255 main_contents_->SetBoundsRect(contents_bounds); 255 main_contents_->SetBoundsRect(contents_bounds);
256 256
257 // The progress overlay extends from the top of the input row 257 // The progress overlay extends from the top of the input row
258 // to the bottom of the content area. 258 // to the bottom of the content area.
259 gfx::RectF input_rect = gfx::RectF(input_row_->GetContentsBounds()); 259 gfx::RectF input_rect = gfx::RectF(input_row_->GetContentsBounds());
260 View::ConvertRectToTarget(input_row_, this, &input_rect); 260 View::ConvertRectToTarget(input_row_, this, &input_rect);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 views::View::OnPaint(canvas); 526 views::View::OnPaint(canvas);
527 canvas->Restore(); 527 canvas->Restore();
528 } 528 }
529 529
530 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { 530 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) {
531 alpha_ = alpha; 531 alpha_ = alpha;
532 SchedulePaint(); 532 SchedulePaint();
533 } 533 }
534 534
535 } // namespace autofill 535 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698