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

Side by Side Diff: chrome/browser/ui/views/global_error_bubble_view.cc

Issue 1849703004: Handle bubble title resizing (growth) by reworking title layout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks Created 4 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 (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 "chrome/browser/ui/views/global_error_bubble_view.h" 5 #include "chrome/browser/ui/views/global_error_bubble_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 enum { 31 enum {
32 TAG_ACCEPT_BUTTON = 1, 32 TAG_ACCEPT_BUTTON = 1,
33 TAG_CANCEL_BUTTON, 33 TAG_CANCEL_BUTTON,
34 }; 34 };
35 35
36 const int kMaxBubbleViewWidth = 262; 36 const int kMaxBubbleViewWidth = 262;
37 37
38 // The vertical inset of the app bubble anchor from the app menu button. 38 // The vertical inset of the app bubble anchor from the app menu button.
39 const int kAnchorVerticalInset = 5; 39 const int kAnchorVerticalInset = 5;
40 40
41 const int kBubblePadding = 19;
42
43 // Spacing between bubble text and buttons. 41 // Spacing between bubble text and buttons.
44 const int kLabelToButtonVerticalSpacing = 14; 42 const int kLabelToButtonVerticalSpacing = 14;
45 43
46 } // namespace 44 } // namespace
47 45
48 // GlobalErrorBubbleViewBase --------------------------------------------------- 46 // GlobalErrorBubbleViewBase ---------------------------------------------------
49 47
50 // static 48 // static
51 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowStandardBubbleView( 49 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowStandardBubbleView(
52 Browser* browser, 50 Browser* browser,
(...skipping 10 matching lines...) Expand all
63 // GlobalErrorBubbleView ------------------------------------------------------- 61 // GlobalErrorBubbleView -------------------------------------------------------
64 62
65 GlobalErrorBubbleView::GlobalErrorBubbleView( 63 GlobalErrorBubbleView::GlobalErrorBubbleView(
66 views::View* anchor_view, 64 views::View* anchor_view,
67 views::BubbleBorder::Arrow arrow, 65 views::BubbleBorder::Arrow arrow,
68 Browser* browser, 66 Browser* browser,
69 const base::WeakPtr<GlobalErrorWithStandardBubble>& error) 67 const base::WeakPtr<GlobalErrorWithStandardBubble>& error)
70 : BubbleDelegateView(anchor_view, arrow), 68 : BubbleDelegateView(anchor_view, arrow),
71 browser_(browser), 69 browser_(browser),
72 error_(error) { 70 error_(error) {
73 // Set content margins to left-align the bubble text with the title.
74 // BubbleFrameView adds enough padding below title, no top padding needed.
75 set_margins(gfx::Insets(0, kBubblePadding, kBubblePadding, kBubblePadding));
msw 2016/03/31 19:18:30 Please add before/after screenshots; maybe split t
Evan Stade 2016/03/31 21:26:13 sure, done
76
77 // Compensate for built-in vertical padding in the anchor view's image. 71 // Compensate for built-in vertical padding in the anchor view's image.
78 set_anchor_view_insets( 72 set_anchor_view_insets(
79 gfx::Insets(kAnchorVerticalInset, 0, kAnchorVerticalInset, 0)); 73 gfx::Insets(kAnchorVerticalInset, 0, kAnchorVerticalInset, 0));
80 74
81 std::vector<base::string16> message_strings(error_->GetBubbleViewMessages()); 75 std::vector<base::string16> message_strings(error_->GetBubbleViewMessages());
82 std::vector<views::Label*> message_labels; 76 std::vector<views::Label*> message_labels;
83 for (size_t i = 0; i < message_strings.size(); ++i) { 77 for (size_t i = 0; i < message_strings.size(); ++i) {
84 views::Label* message_label = new views::Label(message_strings[i]); 78 views::Label* message_label = new views::Label(message_strings[i]);
85 message_label->SetMultiLine(true); 79 message_label->SetMultiLine(true);
86 message_label->SizeToFit(kMaxBubbleViewWidth); 80 message_label->SizeToFit(kMaxBubbleViewWidth);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 error_->BubbleViewDidClose(browser_); 183 error_->BubbleViewDidClose(browser_);
190 } 184 }
191 185
192 bool GlobalErrorBubbleView::ShouldShowCloseButton() const { 186 bool GlobalErrorBubbleView::ShouldShowCloseButton() const {
193 return error_ && error_->ShouldShowCloseButton(); 187 return error_ && error_->ShouldShowCloseButton();
194 } 188 }
195 189
196 void GlobalErrorBubbleView::CloseBubbleView() { 190 void GlobalErrorBubbleView::CloseBubbleView() {
197 GetWidget()->Close(); 191 GetWidget()->Close();
198 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698