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" |
17 #import "ios/chrome/browser/ui/url_loader.h" | 18 #import "ios/chrome/browser/ui/url_loader.h" |
18 #import "ios/chrome/browser/ui/util/label_link_controller.h" | 19 #import "ios/chrome/browser/ui/util/label_link_controller.h" |
19 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate
rialButtons.h" | 20 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate
rialButtons.h" |
20 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 21 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" |
21 #include "ios/web/public/navigation_manager.h" | 22 #include "ios/web/public/navigation_manager.h" |
22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/ui_metrics_types.h" |
23 #include "url/gurl.h" | 25 #include "url/gurl.h" |
24 | 26 |
25 #if !defined(__has_feature) || !__has_feature(objc_arc) | 27 #if !defined(__has_feature) || !__has_feature(objc_arc) |
26 #error "This file requires ARC support." | 28 #error "This file requires ARC support." |
27 #endif | 29 #endif |
28 | 30 |
29 namespace { | 31 namespace { |
30 // Color constants. | 32 // Color constants. |
31 const CGFloat kBackgroundColorBrightness = 247.0f / 255.0f; | 33 const CGFloat kBackgroundColorBrightness = 247.0f / 255.0f; |
32 const CGFloat kTitleLabelTextColorBrightness = 22.0f / 255.0f; | 34 const CGFloat kTitleLabelTextColorBrightness = 22.0f / 255.0f; |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 self.containerView.frame = AlignRectOriginAndSizeToPixels( | 518 self.containerView.frame = AlignRectOriginAndSizeToPixels( |
517 CGRectMake(containerOriginX, containerOriginY, containerSize.width, | 519 CGRectMake(containerOriginX, containerOriginY, containerSize.width, |
518 containerSize.height)); | 520 containerSize.height)); |
519 } | 521 } |
520 | 522 |
521 #pragma mark Util | 523 #pragma mark Util |
522 | 524 |
523 - (void)handleActionButtonTapped:(id)sender { | 525 - (void)handleActionButtonTapped:(id)sender { |
524 switch (self.mode) { | 526 switch (self.mode) { |
525 case SadTabViewMode::RELOAD: | 527 case SadTabViewMode::RELOAD: |
| 528 UMA_HISTOGRAM_ENUMERATION(ui::kSadTabReloadHistogramKey, |
| 529 ui::SadTabEvent::SAD_TAB_EVENT_BUTTON_CLICKED, |
| 530 ui::SadTabEvent::SAD_TAB_EVENT_MAX); |
526 self.navigationManager->Reload(web::ReloadType::NORMAL, true); | 531 self.navigationManager->Reload(web::ReloadType::NORMAL, true); |
527 break; | 532 break; |
528 case SadTabViewMode::FEEDBACK: { | 533 case SadTabViewMode::FEEDBACK: { |
| 534 UMA_HISTOGRAM_ENUMERATION(ui::kSadTabFeedbackHistogramKey, |
| 535 ui::SadTabEvent::SAD_TAB_EVENT_BUTTON_CLICKED, |
| 536 ui::SadTabEvent::SAD_TAB_EVENT_MAX); |
529 GenericChromeCommand* command = | 537 GenericChromeCommand* command = |
530 [[GenericChromeCommand alloc] initWithTag:IDC_REPORT_AN_ISSUE]; | 538 [[GenericChromeCommand alloc] initWithTag:IDC_REPORT_AN_ISSUE]; |
531 [self chromeExecuteCommand:command]; | 539 [self chromeExecuteCommand:command]; |
532 break; | 540 break; |
533 } | 541 } |
534 }; | 542 }; |
535 } | 543 } |
536 | 544 |
537 + (UIColor*)sadTabBackgroundColor { | 545 + (UIColor*)sadTabBackgroundColor { |
538 return [UIColor colorWithWhite:kBackgroundColorBrightness alpha:1.0]; | 546 return [UIColor colorWithWhite:kBackgroundColorBrightness alpha:1.0]; |
539 } | 547 } |
540 | 548 |
541 @end | 549 @end |
OLD | NEW |