Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/sad_tab/sad_tab_view.h" | 5 #import "ios/chrome/browser/ui/sad_tab/sad_tab_view.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | |
| 7 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 8 #include "components/grit/components_scaled_resources.h" | 9 #include "components/grit/components_scaled_resources.h" |
| 9 #include "components/strings/grit/components_strings.h" | 10 #include "components/strings/grit/components_strings.h" |
| 10 #include "ios/chrome/browser/chrome_url_constants.h" | 11 #include "ios/chrome/browser/chrome_url_constants.h" |
| 11 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" | 12 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" |
| 12 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 13 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 13 #import "ios/chrome/browser/ui/commands/ios_command_ids.h" | 14 #import "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 14 #import "ios/chrome/browser/ui/commands/open_url_command.h" | 15 #import "ios/chrome/browser/ui/commands/open_url_command.h" |
| 15 #include "ios/chrome/browser/ui/rtl_geometry.h" | 16 #include "ios/chrome/browser/ui/rtl_geometry.h" |
| 16 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 17 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 forLinkText:(nonnull NSString*)linkText; | 111 forLinkText:(nonnull NSString*)linkText; |
| 111 | 112 |
| 112 // The action selector for |_actionButton|. | 113 // The action selector for |_actionButton|. |
| 113 - (void)handleActionButtonTapped:(id)sender; | 114 - (void)handleActionButtonTapped:(id)sender; |
| 114 | 115 |
| 115 // Returns the desired background color. | 116 // Returns the desired background color. |
| 116 + (UIColor*)sadTabBackgroundColor; | 117 + (UIColor*)sadTabBackgroundColor; |
| 117 | 118 |
| 118 @end | 119 @end |
| 119 | 120 |
| 121 // An enum for reporting interaction events to a UMA histogram. This | |
| 122 // enumeration mimics that at sad_tab.cc | |
| 123 typedef NS_ENUM(NSInteger, SadTabViewEvent) { | |
|
PL
2017/05/09 22:38:23
This enumeration copies one reporting this metric
Eugene But (OOO till 7-30)
2017/05/09 22:45:58
I think it is C :). We should find a common place
PL
2017/05/09 22:57:20
Thanks! Reached out to isherman@ and sdy@ for disc
| |
| 124 SadTabViewEventDisplayed = 0, | |
| 125 SadTabViewEventButtonClicked, | |
| 126 SadTabViewEventHelpLinkClicked, | |
| 127 SadTabViewEventMaxSadTabEvent, | |
| 128 }; | |
| 129 | |
| 120 #pragma mark - SadTabView | 130 #pragma mark - SadTabView |
| 121 | 131 |
| 122 @implementation SadTabView | 132 @implementation SadTabView |
| 123 | 133 |
| 124 @synthesize imageView = _imageView; | 134 @synthesize imageView = _imageView; |
| 125 @synthesize containerView = _containerView; | 135 @synthesize containerView = _containerView; |
| 126 @synthesize titleLabel = _titleLabel; | 136 @synthesize titleLabel = _titleLabel; |
| 127 @synthesize messageLabel = _messageLabel; | 137 @synthesize messageLabel = _messageLabel; |
| 128 @synthesize footerLabel = _footerLabel; | 138 @synthesize footerLabel = _footerLabel; |
| 129 @synthesize footerLabelLinkController = _footerLabelLinkController; | 139 @synthesize footerLabelLinkController = _footerLabelLinkController; |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 516 self.containerView.frame = AlignRectOriginAndSizeToPixels( | 526 self.containerView.frame = AlignRectOriginAndSizeToPixels( |
| 517 CGRectMake(containerOriginX, containerOriginY, containerSize.width, | 527 CGRectMake(containerOriginX, containerOriginY, containerSize.width, |
| 518 containerSize.height)); | 528 containerSize.height)); |
| 519 } | 529 } |
| 520 | 530 |
| 521 #pragma mark Util | 531 #pragma mark Util |
| 522 | 532 |
| 523 - (void)handleActionButtonTapped:(id)sender { | 533 - (void)handleActionButtonTapped:(id)sender { |
| 524 switch (self.mode) { | 534 switch (self.mode) { |
| 525 case SadTabViewMode::RELOAD: | 535 case SadTabViewMode::RELOAD: |
| 536 UMA_HISTOGRAM_ENUMERATION("Tabs.SadTab.Reload.Event", | |
| 537 SadTabViewEventButtonClicked, | |
| 538 SadTabViewEventMaxSadTabEvent); | |
| 526 self.navigationManager->Reload(web::ReloadType::NORMAL, true); | 539 self.navigationManager->Reload(web::ReloadType::NORMAL, true); |
| 527 break; | 540 break; |
| 528 case SadTabViewMode::FEEDBACK: { | 541 case SadTabViewMode::FEEDBACK: { |
| 542 UMA_HISTOGRAM_ENUMERATION("Tabs.SadTab.Feedback.Event", | |
| 543 SadTabViewEventButtonClicked, | |
| 544 SadTabViewEventMaxSadTabEvent); | |
| 529 GenericChromeCommand* command = | 545 GenericChromeCommand* command = |
| 530 [[GenericChromeCommand alloc] initWithTag:IDC_REPORT_AN_ISSUE]; | 546 [[GenericChromeCommand alloc] initWithTag:IDC_REPORT_AN_ISSUE]; |
| 531 [self chromeExecuteCommand:command]; | 547 [self chromeExecuteCommand:command]; |
| 532 break; | 548 break; |
| 533 } | 549 } |
| 534 }; | 550 }; |
| 535 } | 551 } |
| 536 | 552 |
| 537 + (UIColor*)sadTabBackgroundColor { | 553 + (UIColor*)sadTabBackgroundColor { |
| 538 return [UIColor colorWithWhite:kBackgroundColorBrightness alpha:1.0]; | 554 return [UIColor colorWithWhite:kBackgroundColorBrightness alpha:1.0]; |
| 539 } | 555 } |
| 540 | 556 |
| 541 @end | 557 @end |
| OLD | NEW |