summaryrefslogtreecommitdiffstats
path: root/components/handoff/handoff_utility.mm
blob: de20e6964d763bec2310937c9b9eeec81be9962c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/handoff/handoff_utility.h"

namespace handoff {

NSString* const kChromeHandoffActivityType = @"com.google.chrome.handoff";
NSString* const kOriginKey = @"kOriginKey";
NSString* const kOriginiOS = @"kOriginiOS";
NSString* const kOriginMac = @"kOriginMac";

Origin OriginFromString(NSString* string) {
  if ([string isEqualToString:kOriginiOS])
    return ORIGIN_IOS;

  if ([string isEqualToString:kOriginMac])
    return ORIGIN_MAC;

  return ORIGIN_UNKNOWN;
}

NSString* StringFromOrigin(Origin origin) {
  switch (origin) {
    case ORIGIN_IOS:
      return kOriginiOS;
    case ORIGIN_MAC:
      return kOriginMac;
    default:
      return nil;
  }
}

}  // namespace handoff