| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/app/application_delegate/url_opener.h" | 5 #import "ios/chrome/app/application_delegate/url_opener.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #import "base/ios/weak_nsobject.h" | |
| 10 #import "base/mac/scoped_nsobject.h" | |
| 11 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 12 #import "ios/chrome/app/application_delegate/app_state.h" | 10 #import "ios/chrome/app/application_delegate/app_state.h" |
| 13 #import "ios/chrome/app/application_delegate/startup_information.h" | 11 #import "ios/chrome/app/application_delegate/startup_information.h" |
| 14 #import "ios/chrome/app/application_delegate/tab_opening.h" | 12 #import "ios/chrome/app/application_delegate/tab_opening.h" |
| 15 #include "ios/chrome/app/chrome_app_startup_parameters.h" | 13 #include "ios/chrome/app/chrome_app_startup_parameters.h" |
| 16 | 14 |
| 15 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 16 #error "This file requires ARC support." |
| 17 #endif |
| 18 |
| 17 namespace { | 19 namespace { |
| 18 // Key of the UMA Startup.MobileSessionStartFromApps histogram. | 20 // Key of the UMA Startup.MobileSessionStartFromApps histogram. |
| 19 const char* const kUMAMobileSessionStartFromAppsHistogram = | 21 const char* const kUMAMobileSessionStartFromAppsHistogram = |
| 20 "Startup.MobileSessionStartFromApps"; | 22 "Startup.MobileSessionStartFromApps"; |
| 21 } // namespace | 23 } // namespace |
| 22 | 24 |
| 23 @implementation URLOpener | 25 @implementation URLOpener |
| 24 | 26 |
| 25 - (instancetype)init { | 27 - (instancetype)init { |
| 26 NOTREACHED(); | 28 NOTREACHED(); |
| 27 return nil; | 29 return nil; |
| 28 } | 30 } |
| 29 | 31 |
| 30 #pragma mark - ApplicationDelegate - URL Opening methods | 32 #pragma mark - ApplicationDelegate - URL Opening methods |
| 31 | 33 |
| 32 + (BOOL)openURL:(NSURL*)url | 34 + (BOOL)openURL:(NSURL*)url |
| 33 applicationActive:(BOOL)applicationActive | 35 applicationActive:(BOOL)applicationActive |
| 34 options:(NSDictionary<NSString*, id>*)options | 36 options:(NSDictionary<NSString*, id>*)options |
| 35 tabOpener:(id<TabOpening>)tabOpener | 37 tabOpener:(id<TabOpening>)tabOpener |
| 36 startupInformation:(id<StartupInformation>)startupInformation { | 38 startupInformation:(id<StartupInformation>)startupInformation { |
| 37 NSString* sourceApplication = | 39 NSString* sourceApplication = |
| 38 options[UIApplicationOpenURLOptionsSourceApplicationKey]; | 40 options[UIApplicationOpenURLOptionsSourceApplicationKey]; |
| 39 base::scoped_nsobject<ChromeAppStartupParameters> params( | 41 ChromeAppStartupParameters* params = [ChromeAppStartupParameters |
| 40 [ChromeAppStartupParameters | 42 newChromeAppStartupParametersWithURL:url |
| 41 newChromeAppStartupParametersWithURL:url | 43 fromSourceApplication:sourceApplication]; |
| 42 fromSourceApplication:sourceApplication]); | |
| 43 | 44 |
| 44 MobileSessionCallerApp callerApp = [params callerApp]; | 45 MobileSessionCallerApp callerApp = [params callerApp]; |
| 45 | 46 |
| 46 UMA_HISTOGRAM_ENUMERATION(kUMAMobileSessionStartFromAppsHistogram, callerApp, | 47 UMA_HISTOGRAM_ENUMERATION(kUMAMobileSessionStartFromAppsHistogram, callerApp, |
| 47 MOBILE_SESSION_CALLER_APP_COUNT); | 48 MOBILE_SESSION_CALLER_APP_COUNT); |
| 48 | 49 |
| 49 if (startupInformation.isPresentingFirstRunUI) { | 50 if (startupInformation.isPresentingFirstRunUI) { |
| 50 UMA_HISTOGRAM_ENUMERATION("FirstRun.LaunchSource", [params launchSource], | 51 UMA_HISTOGRAM_ENUMERATION("FirstRun.LaunchSource", [params launchSource], |
| 51 first_run::LAUNCH_SIZE); | 52 first_run::LAUNCH_SIZE); |
| 52 } | 53 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 BOOL openURLResult = [URLOpener openURL:url | 89 BOOL openURLResult = [URLOpener openURL:url |
| 89 applicationActive:applicationActive | 90 applicationActive:applicationActive |
| 90 options:options | 91 options:options |
| 91 tabOpener:tabOpener | 92 tabOpener:tabOpener |
| 92 startupInformation:startupInformation]; | 93 startupInformation:startupInformation]; |
| 93 [appState launchFromURLHandled:openURLResult]; | 94 [appState launchFromURLHandled:openURLResult]; |
| 94 } | 95 } |
| 95 } | 96 } |
| 96 | 97 |
| 97 @end | 98 @end |
| OLD | NEW |