Skip to content

Commit

Permalink
Create a new component "handoff" to be shared between Mac and iOS.
Browse files Browse the repository at this point in the history
The files handoff_utility.{h,mm} were moved from chrome/browser/mac/ to
components/handoff/, but were not otherwise changed.

In an attempt to reduce duplicated conditionals in build files, I introduced
the platform conditionals into the gyp/GN files for the handoff component, and
then included the component on all platforms.

BUG=380419

Review URL: https://codereview.chromium.org/709123003

Cr-Commit-Position: refs/heads/master@{#304257}
  • Loading branch information
erikchen authored and Commit bot committed Nov 14, 2014
1 parent c962497 commit 332265b
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 17 deletions.
5 changes: 1 addition & 4 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ static_library("browser") {
"//components/feedback",
"//components/gcm_driver",
"//components/google/core/browser",
"//components/handoff",
"//components/history/core/browser",
"//components/history/core/common",
"//components/infobars/core",
Expand Down Expand Up @@ -249,10 +250,6 @@ static_library("browser") {
#"browser_app_shim" TODO(GYP)
]
}
if (is_mac || is_ios) {
sources += rebase_path(gypi_values.chrome_browser_mac_ios_sources,
".", "//chrome")
}
if (enable_extensions) {
public_deps += [ "//chrome/browser/extensions" ]
deps += [
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ include_rules = [
"+components/gcm_driver",
"+components/google",
"+components/grit",
"+components/handoff",
"+components/history",
"+components/infobars",
"+components/invalidation",
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/app_controller_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/mac/handoff_utility.h"
#include "chrome/browser/mac/mac_startup_profiler.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile_info_cache_observer.h"
Expand Down Expand Up @@ -83,6 +82,7 @@
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/handoff/handoff_utility.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/browser_thread.h"
Expand Down
9 changes: 1 addition & 8 deletions chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1364,11 +1364,6 @@
'browser/media_galleries/fileapi/iphoto_file_util.cc',
'browser/media_galleries/fileapi/iphoto_file_util.h',
],
# Sources used by Mac and iOS.
'chrome_browser_mac_ios_sources': [
'browser/mac/handoff_utility.h',
'browser/mac/handoff_utility.mm',
],
# Sources (generally "desktop OS importers") used only on Mac & Windows.
'chrome_browser_win_mac_sources': [
'browser/media_galleries/fileapi/iapps_data_provider.cc',
Expand Down Expand Up @@ -2838,6 +2833,7 @@
'../components/components.gyp:feedback_component',
'../components/components.gyp:gcm_driver',
'../components/components.gyp:google_core_browser',
'../components/components.gyp:handoff',
'../components/components.gyp:history_core_browser',
'../components/components.gyp:history_core_common',
'../components/components.gyp:infobars_core',
Expand Down Expand Up @@ -3042,9 +3038,6 @@
],
'sources': [ '<@(chrome_browser_mac_sources)' ]
}],
['OS=="mac" or OS=="ios"', {
'sources': [ '<@(chrome_browser_mac_ios_sources)' ]
}],
['chromeos==1 or OS=="ios"', {
'sources!': [
'browser/metrics/signin_status_metrics_provider.cc',
Expand Down
1 change: 1 addition & 0 deletions components/components.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
'favicon.gypi',
'favicon_base.gypi',
'google.gypi',
'handoff.gypi',
'history.gypi',
'infobars.gypi',
'json_schema.gypi',
Expand Down
24 changes: 24 additions & 0 deletions components/handoff.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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.

{
'targets': [
{
# GN version: //components/handoff
'target_name': 'handoff',
'type': 'static_library',
'include_dirs': [
'..',
],
'conditions': [
['OS=="mac" or OS=="ios"', {
'sources': [
'handoff/handoff_utility.h',
'handoff/handoff_utility.mm',
],
}],
],
},
],
}
12 changes: 12 additions & 0 deletions components/handoff/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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.

source_set("handoff") {
if (is_mac || is_ios) {
sources += [
"handoff_utility.h",
"handoff_utility.mm",
]
}
}
1 change: 1 addition & 0 deletions components/handoff/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
erikchen@chromium.org
5 changes: 5 additions & 0 deletions components/handoff/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Handoff is a feature introduced in iOS 8 and Mac OS X 10.10. It allows a user to
continue tasks between Apple devices connected to the same iCloud account.

This directory contains files used by both Chrome on Mac and Chrome on iOS to
support the Handoff feature.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_MAC_HANDOFF_UTILITY_H_
#define CHROME_BROWSER_MAC_HANDOFF_UTILITY_H_
#ifndef COMPONENTS_HANDOFF_HANDOFF_UTILITY_H_
#define COMPONENTS_HANDOFF_HANDOFF_UTILITY_H_

#import <Foundation/Foundation.h>

Expand Down Expand Up @@ -34,4 +34,4 @@ Origin OriginFromString(NSString* string);

} // namespace handoff

#endif // CHROME_BROWSER_MAC_HANDOFF_UTILITY_H_
#endif // COMPONENTS_HANDOFF_HANDOFF_UTILITY_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/mac/handoff_utility.h"
#include "components/handoff/handoff_utility.h"

namespace handoff {

Expand Down

0 comments on commit 332265b

Please sign in to comment.