Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1130)

Side by Side Diff: ios/chrome/app/chrome_app_startup_parameters.mm

Issue 2807583002: Add app startup parameters to start the app in qr and incognito search. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ios/chrome/common/app_group/app_group_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/app/chrome_app_startup_parameters.h" 5 #import "ios/chrome/app/chrome_app_startup_parameters.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (!externalURL.is_valid() || !externalURL.SchemeIsHTTPOrHTTPS()) 279 if (!externalURL.is_valid() || !externalURL.SchemeIsHTTPOrHTTPS())
280 return nil; 280 return nil;
281 return 281 return
282 [[ChromeAppStartupParameters alloc] initWithExternalURL:externalURL 282 [[ChromeAppStartupParameters alloc] initWithExternalURL:externalURL
283 xCallbackParameters:nil 283 xCallbackParameters:nil
284 declaredSourceApp:appId 284 declaredSourceApp:appId
285 secureSourceApp:secureSourceApp 285 secureSourceApp:secureSourceApp
286 completeURL:url]; 286 completeURL:url];
287 } 287 }
288 288
289 if ([command
290 isEqualToString:base::SysUTF8ToNSString(
291 app_group::kChromeAppGroupQRScannerCommand)]) {
292 ChromeAppStartupParameters* params = [[ChromeAppStartupParameters alloc]
293 initWithExternalURL:GURL(kChromeUINewTabURL)
294 xCallbackParameters:nil
295 declaredSourceApp:appId
296 secureSourceApp:secureSourceApp
297 completeURL:url];
298 [params setLaunchQRScanner:YES];
299 return params;
300 }
301
302 if ([command isEqualToString:
303 base::SysUTF8ToNSString(
304 app_group::kChromeAppGroupIncognitoSearchCommand)]) {
305 ChromeAppStartupParameters* params = [[ChromeAppStartupParameters alloc]
306 initWithExternalURL:GURL(kChromeUINewTabURL)
307 xCallbackParameters:nil
308 declaredSourceApp:appId
309 secureSourceApp:secureSourceApp
310 completeURL:url];
311 [params setLaunchInIncognito:YES];
312 [params setLaunchFocusOmnibox:YES];
313 return params;
314 }
315
289 return nil; 316 return nil;
290 } 317 }
291 318
292 - (MobileSessionCallerApp)callerApp { 319 - (MobileSessionCallerApp)callerApp {
293 if ([_secureSourceApp isEqualToString:@"TodayExtension"]) 320 if ([_secureSourceApp isEqualToString:@"TodayExtension"])
294 return CALLER_APP_GOOGLE_CHROME_TODAY_EXTENSION; 321 return CALLER_APP_GOOGLE_CHROME_TODAY_EXTENSION;
295 322
296 if (![_declaredSourceApp length]) 323 if (![_declaredSourceApp length])
297 return CALLER_APP_NOT_AVAILABLE; 324 return CALLER_APP_NOT_AVAILABLE;
298 if ([_declaredSourceApp isEqualToString:@"com.google.GoogleMobile"]) 325 if ([_declaredSourceApp isEqualToString:@"com.google.GoogleMobile"])
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 371 }
345 if (found.location > 0) { 372 if (found.location > 0) {
346 unichar charBefore = [query characterAtIndex:(found.location - 1)]; 373 unichar charBefore = [query characterAtIndex:(found.location - 1)];
347 if (charBefore != '&') 374 if (charBefore != '&')
348 return first_run::LAUNCH_BY_MOBILESAFARI; 375 return first_run::LAUNCH_BY_MOBILESAFARI;
349 } 376 }
350 return first_run::LAUNCH_BY_SMARTAPPBANNER; 377 return first_run::LAUNCH_BY_SMARTAPPBANNER;
351 } 378 }
352 379
353 @end 380 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/common/app_group/app_group_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698