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

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

Issue 585473004: Checkbox alignment & bigger height for Uma opt-in view. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/session_crashed_bubble_view.h" 5 #include "chrome/browser/ui/views/session_crashed_bubble_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 using views::GridLayout; 48 using views::GridLayout;
49 49
50 namespace { 50 namespace {
51 51
52 // Fixed width of the column holding the description label of the bubble. 52 // Fixed width of the column holding the description label of the bubble.
53 const int kWidthOfDescriptionText = 320; 53 const int kWidthOfDescriptionText = 320;
54 54
55 // Distance between checkbox and the text to the right of it. 55 // Distance between checkbox and the text to the right of it.
56 const int kCheckboxTextDistance = 4; 56 const int kCheckboxTextDistance = 4;
57 57
58 // Bottom inset for UMA opt-in view in pixels.
59 const int kUMAOptinViewBottomInset = 10;
msw 2014/09/18 23:14:48 Move this down to where it's used and change the c
yao 2014/09/19 15:12:27 There is no particular reason, originally value 8
60
58 // The color of the text and background of the sub panel to offer UMA optin. 61 // The color of the text and background of the sub panel to offer UMA optin.
59 // These values match the BookmarkSyncPromoView colors. 62 // These values match the BookmarkSyncPromoView colors.
60 const SkColor kBackgroundColor = SkColorSetRGB(245, 245, 245); 63 const SkColor kBackgroundColor = SkColorSetRGB(245, 245, 245);
61 const SkColor kTextColor = SkColorSetRGB(102, 102, 102); 64 const SkColor kTextColor = SkColorSetRGB(102, 102, 102);
62 65
63 // The Finch study name and group name that enables session crashed bubble UI. 66 // The Finch study name and group name that enables session crashed bubble UI.
64 const char kEnableBubbleUIFinchName[] = "EnableSessionCrashedBubbleUI"; 67 const char kEnableBubbleUIFinchName[] = "EnableSessionCrashedBubbleUI";
65 const char kEnableBubbleUIGroupEnabled[] = "Enabled"; 68 const char kEnableBubbleUIGroupEnabled[] = "Enabled";
66 69
67 enum SessionCrashedBubbleHistogramValue { 70 enum SessionCrashedBubbleHistogramValue {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 views::View* anchor_view, 198 views::View* anchor_view,
196 Browser* browser, 199 Browser* browser,
197 content::WebContents* web_contents, 200 content::WebContents* web_contents,
198 bool offer_uma_optin) 201 bool offer_uma_optin)
199 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), 202 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT),
200 content::WebContentsObserver(web_contents), 203 content::WebContentsObserver(web_contents),
201 browser_(browser), 204 browser_(browser),
202 web_contents_(web_contents), 205 web_contents_(web_contents),
203 restore_button_(NULL), 206 restore_button_(NULL),
204 uma_option_(NULL), 207 uma_option_(NULL),
205 offer_uma_optin_(offer_uma_optin), 208 offer_uma_optin_(true),
msw 2014/09/18 23:14:48 Why are you changing this? Was this intentional?
yao 2014/09/19 15:12:27 Done.
206 started_navigation_(false), 209 started_navigation_(false),
207 restored_(false) { 210 restored_(false) {
208 set_close_on_deactivate(false); 211 set_close_on_deactivate(false);
209 registrar_.Add( 212 registrar_.Add(
210 this, 213 this,
211 chrome::NOTIFICATION_TAB_CLOSING, 214 chrome::NOTIFICATION_TAB_CLOSING,
212 content::Source<content::NavigationController>(&( 215 content::Source<content::NavigationController>(&(
213 web_contents->GetController()))); 216 web_contents->GetController())));
214 browser->tab_strip_model()->AddObserver(this); 217 browser->tab_strip_model()->AddObserver(this);
215 } 218 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 uma_label->AddStyleRange(gfx::Range(offset, offset + link_text.length()), 332 uma_label->AddStyleRange(gfx::Range(offset, offset + link_text.length()),
330 link_style); 333 link_style);
331 views::StyledLabel::RangeStyleInfo uma_style; 334 views::StyledLabel::RangeStyleInfo uma_style;
332 uma_style.color = kTextColor; 335 uma_style.color = kTextColor;
333 gfx::Range before_link_range(0, offset); 336 gfx::Range before_link_range(0, offset);
334 if (!before_link_range.is_empty()) 337 if (!before_link_range.is_empty())
335 uma_label->AddStyleRange(before_link_range, uma_style); 338 uma_label->AddStyleRange(before_link_range, uma_style);
336 gfx::Range after_link_range(offset + link_text.length(), uma_text.length()); 339 gfx::Range after_link_range(offset + link_text.length(), uma_text.length());
337 if (!after_link_range.is_empty()) 340 if (!after_link_range.is_empty())
338 uma_label->AddStyleRange(after_link_range, uma_style); 341 uma_label->AddStyleRange(after_link_range, uma_style);
342 // Since the checkbox has a bigger height than text, moves it down by 1px to
343 // make them look aligned.
344 uma_label->SetBorder(views::Border::CreateEmptyBorder(1, 0, 0, 0));
msw 2014/09/18 23:14:48 Why is this and the uma_layout inset change needed
yao 2014/09/19 15:12:26 They are separate things. Changed the issue title
339 345
340 // Create a view to hold the checkbox and the text. 346 // Create a view to hold the checkbox and the text.
341 views::View* uma_view = new views::View(); 347 views::View* uma_view = new views::View();
342 GridLayout* uma_layout = new GridLayout(uma_view); 348 GridLayout* uma_layout = new GridLayout(uma_view);
343 uma_view->SetLayoutManager(uma_layout); 349 uma_view->SetLayoutManager(uma_layout);
344 350
345 uma_view->set_background( 351 uma_view->set_background(
346 views::Background::CreateSolidBackground(kBackgroundColor)); 352 views::Background::CreateSolidBackground(kBackgroundColor));
347 int inset_left = GetBubbleFrameView()->GetTitleInsets().left(); 353 int inset_left = GetBubbleFrameView()->GetTitleInsets().left();
348 uma_layout->SetInsets(views::kRelatedControlVerticalSpacing, inset_left, 354 uma_layout->SetInsets(views::kRelatedControlVerticalSpacing, inset_left,
349 views::kRelatedControlVerticalSpacing, inset_left); 355 kUMAOptinViewBottomInset, inset_left);
350 356
351 const int kReportColumnSetId = 0; 357 const int kReportColumnSetId = 0;
352 views::ColumnSet* cs = uma_layout->AddColumnSet(kReportColumnSetId); 358 views::ColumnSet* cs = uma_layout->AddColumnSet(kReportColumnSetId);
353 cs->AddColumn(GridLayout::CENTER, GridLayout::LEADING, 0, 359 cs->AddColumn(GridLayout::CENTER, GridLayout::LEADING, 0,
354 GridLayout::USE_PREF, 0, 0); 360 GridLayout::USE_PREF, 0, 0);
355 cs->AddPaddingColumn(0, kCheckboxTextDistance); 361 cs->AddPaddingColumn(0, kCheckboxTextDistance);
356 cs->AddColumn(GridLayout::FILL, GridLayout::FILL, 0, 362 cs->AddColumn(GridLayout::FILL, GridLayout::FILL, 0,
357 GridLayout::FIXED, kWidthOfDescriptionText, 0); 363 GridLayout::FIXED, kWidthOfDescriptionText, 0);
358 364
359 uma_layout->StartRow(0, kReportColumnSetId); 365 uma_layout->StartRow(0, kReportColumnSetId);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 GetWidget()->Close(); 439 GetWidget()->Close();
434 } 440 }
435 441
436 bool ShowSessionCrashedBubble(Browser* browser) { 442 bool ShowSessionCrashedBubble(Browser* browser) {
437 if (IsBubbleUIEnabled()) { 443 if (IsBubbleUIEnabled()) {
438 SessionCrashedBubbleView::Show(browser); 444 SessionCrashedBubbleView::Show(browser);
439 return true; 445 return true;
440 } 446 }
441 return false; 447 return false;
442 } 448 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698