Skip to content

Commit

Permalink
[iOS] Add NSUserActivityTypeBrowsingWeb compatible modes
Browse files Browse the repository at this point in the history
This CL fixes `CompatibleModeForActivityType` to add the activity type
NSUserActivityTypeBrowsingWeb as a possible input and avoid NOTREACHED.
This activity type might be passed when the Handoff feature is used.

(cherry picked from commit 473ca15)

Fixed: 1435075
Change-Id: Ibb07bbda2fccb3b3807bc420c95d64b7f41bb4ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4466163
Reviewed-by: Mark Cogan <marq@chromium.org>
Commit-Queue: Quentin Pubert <qpubert@google.com>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Olivier Robin <olivierrobin@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1135811}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4481933
Cr-Commit-Position: refs/branch-heads/5735@{#18}
Cr-Branched-From: 2f562e4-refs/heads/main@{#1135570}
  • Loading branch information
Quentin Pubert authored and Chromium LUCI CQ committed Apr 27, 2023
1 parent ec2069f commit 06b8422
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ios/chrome/app/application_delegate/user_activity_handler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import "base/metrics/histogram_macros.h"
#import "base/metrics/user_metrics_action.h"
#import "base/strings/sys_string_conversions.h"
#import "components/crash/core/common/crash_key.h"
#import "components/handoff/handoff_utility.h"
#import "components/search_engines/template_url_service.h"
#import "ios/chrome/app/app_startup_parameters.h"
Expand Down Expand Up @@ -80,15 +81,19 @@
[activityType isEqualToString:kShortcutVoiceSearch] ||
[activityType isEqualToString:kShortcutQRScanner] ||
[activityType isEqualToString:kShortcutLens] ||
[activityType isEqualToString:kSiriShortcutSearchInChrome]) {
[activityType isEqualToString:kSiriShortcutSearchInChrome] ||
[activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
return @[ kRegularMode, kIncognitoMode ];
} else if ([activityType isEqualToString:kSiriShortcutOpenInChrome]) {
return @[ kRegularMode ];
} else if ([activityType isEqualToString:kShortcutNewIncognitoSearch] ||
[activityType isEqualToString:kSiriShortcutOpenInIncognito]) {
return @[ kIncognitoMode ];
} else {
NOTREACHED();
static crash_reporter::CrashKeyString<4> key("activity");
crash_reporter::ScopedCrashKeyString crash_key(
&key, base::SysNSStringToUTF8(activityType));
base::debug::DumpWithoutCrashing();
}
return nil;
}
Expand Down

0 comments on commit 06b8422

Please sign in to comment.