help_view_controller.mm 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #if !defined(__has_feature) || !__has_feature(objc_arc)
  5. #error "This file requires ARC support."
  6. #endif
  7. #import "remoting/ios/app/help_view_controller.h"
  8. #include "remoting/base/string_resources.h"
  9. #import "remoting/ios/app/web_view_controller.h"
  10. #include "ui/base/l10n/l10n_util.h"
  11. // TODO(nicholss): These urls should come from a global config.
  12. static NSString* const kHelpCenterUrl =
  13. @"https://support.google.com/chrome/answer/1649523?co=GENIE.Platform%3DiOS";
  14. static NSString* const kCreditsUrlString =
  15. [[NSBundle mainBundle] URLForResource:@"credits" withExtension:@"html"]
  16. .absoluteString;
  17. @implementation HelpViewController
  18. - (instancetype)init {
  19. if (self = [super initWithURL:[NSURL URLWithString:kHelpCenterUrl]]) {
  20. self.navigationItem.title =
  21. l10n_util::GetNSString(IDS_ACTIONBAR_HELP_TITLE);
  22. self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
  23. initWithTitle:l10n_util::GetNSString(IDS_CREDITS)
  24. style:UIBarButtonItemStylePlain
  25. target:self
  26. action:@selector(onTapCredits:)];
  27. }
  28. return self;
  29. }
  30. #pragma mark - Private
  31. - (void)onTapCredits:(id)button {
  32. WebViewController* creditsVC = [[WebViewController alloc]
  33. initWithUrl:kCreditsUrlString
  34. title:l10n_util::GetNSString(IDS_CREDITS)];
  35. [self.navigationController pushViewController:creditsVC animated:YES];
  36. }
  37. @end