Commit 7d54a195 authored by zork@chromium.org's avatar zork@chromium.org

Move Chrome OS pairing interface to chrome/browser/chromeos

BUG=393413

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284549 0039d316-1c4b-4281-b951-d872f2087c98
parent 90e1a1b9
include_rules = [ include_rules = [
"+components/pairing",
"+components/onc", "+components/onc",
"+cros", "+cros",
"+dbus", "+dbus",
......
...@@ -9,10 +9,11 @@ ...@@ -9,10 +9,11 @@
#include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chromeos/chromeos_switches.h" #include "chromeos/chromeos_switches.h"
#include "chromeos/login/auth/user_context.h" #include "chromeos/login/auth/user_context.h"
#include "chromeos/pairing/fake_controller_pairing_controller.h" #include "components/pairing/fake_controller_pairing_controller.h"
#include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_auth_util.h"
using namespace chromeos::controller_pairing; using namespace chromeos::controller_pairing;
using namespace pairing_chromeos;
namespace chromeos { namespace chromeos {
......
...@@ -10,12 +10,13 @@ ...@@ -10,12 +10,13 @@
#include "chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.h" #include "chrome/browser/chromeos/login/screens/controller_pairing_screen_actor.h"
#include "chrome/browser/chromeos/login/screens/screen_context.h" #include "chrome/browser/chromeos/login/screens/screen_context.h"
#include "chrome/browser/chromeos/login/screens/wizard_screen.h" #include "chrome/browser/chromeos/login/screens/wizard_screen.h"
#include "chromeos/pairing/controller_pairing_controller.h" #include "components/pairing/controller_pairing_controller.h"
namespace chromeos { namespace chromeos {
class ControllerPairingScreen : public WizardScreen, class ControllerPairingScreen :
public ControllerPairingController::Observer, public WizardScreen,
public pairing_chromeos::ControllerPairingController::Observer,
public ControllerPairingScreenActor::Delegate { public ControllerPairingScreenActor::Delegate {
public: public:
ControllerPairingScreen(ScreenObserver* observer, ControllerPairingScreen(ScreenObserver* observer,
...@@ -23,7 +24,7 @@ class ControllerPairingScreen : public WizardScreen, ...@@ -23,7 +24,7 @@ class ControllerPairingScreen : public WizardScreen,
virtual ~ControllerPairingScreen(); virtual ~ControllerPairingScreen();
private: private:
typedef ControllerPairingController::Stage Stage; typedef pairing_chromeos::ControllerPairingController::Stage Stage;
void CommitContextChanges(); void CommitContextChanges();
bool ExpectStageIs(Stage stage) const; bool ExpectStageIs(Stage stage) const;
...@@ -34,7 +35,7 @@ class ControllerPairingScreen : public WizardScreen, ...@@ -34,7 +35,7 @@ class ControllerPairingScreen : public WizardScreen,
virtual void Hide() OVERRIDE; virtual void Hide() OVERRIDE;
virtual std::string GetName() const OVERRIDE; virtual std::string GetName() const OVERRIDE;
// Overridden from ControllerPairingController::Observer: // Overridden from pairing_chromeos::ControllerPairingController::Observer:
virtual void PairingStageChanged(Stage new_stage) OVERRIDE; virtual void PairingStageChanged(Stage new_stage) OVERRIDE;
virtual void DiscoveredDevicesListChanged() OVERRIDE; virtual void DiscoveredDevicesListChanged() OVERRIDE;
...@@ -52,7 +53,7 @@ class ControllerPairingScreen : public WizardScreen, ...@@ -52,7 +53,7 @@ class ControllerPairingScreen : public WizardScreen,
// Controller performing pairing. Owned by the screen for now. // Controller performing pairing. Owned by the screen for now.
// TODO(dzhioev): move to proper place later. // TODO(dzhioev): move to proper place later.
scoped_ptr<ControllerPairingController> controller_; scoped_ptr<pairing_chromeos::ControllerPairingController> controller_;
// Current stage of pairing process. // Current stage of pairing process.
Stage current_stage_; Stage current_stage_;
......
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chromeos/chromeos_switches.h" #include "chromeos/chromeos_switches.h"
#include "chromeos/pairing/fake_host_pairing_controller.h" #include "components/pairing/fake_host_pairing_controller.h"
namespace chromeos { namespace chromeos {
using namespace host_pairing; using namespace host_pairing;
using namespace pairing_chromeos;
HostPairingScreen::HostPairingScreen(ScreenObserver* observer, HostPairingScreen::HostPairingScreen(ScreenObserver* observer,
HostPairingScreenActor* actor) HostPairingScreenActor* actor)
......
...@@ -9,20 +9,22 @@ ...@@ -9,20 +9,22 @@
#include "chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h" #include "chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h"
#include "chrome/browser/chromeos/login/screens/screen_context.h" #include "chrome/browser/chromeos/login/screens/screen_context.h"
#include "chrome/browser/chromeos/login/screens/wizard_screen.h" #include "chrome/browser/chromeos/login/screens/wizard_screen.h"
#include "chromeos/pairing/host_pairing_controller.h" #include "components/pairing/host_pairing_controller.h"
namespace chromeos { namespace chromeos {
class HostPairingScreen : public WizardScreen, class HostPairingScreen :
public HostPairingController::Observer, public WizardScreen,
public pairing_chromeos::HostPairingController::Observer,
public HostPairingScreenActor::Delegate { public HostPairingScreenActor::Delegate {
public: public:
HostPairingScreen(ScreenObserver* observer, HostPairingScreenActor* actor); HostPairingScreen(ScreenObserver* observer, HostPairingScreenActor* actor);
virtual ~HostPairingScreen(); virtual ~HostPairingScreen();
private: private:
typedef HostPairingController::Stage Stage; typedef pairing_chromeos::HostPairingController::Stage Stage;
typedef HostPairingController::UpdateProgress UpdateProgress; typedef pairing_chromeos::HostPairingController::UpdateProgress
UpdateProgress;
void CommitContextChanges(); void CommitContextChanges();
...@@ -32,7 +34,7 @@ class HostPairingScreen : public WizardScreen, ...@@ -32,7 +34,7 @@ class HostPairingScreen : public WizardScreen,
virtual void Hide() OVERRIDE; virtual void Hide() OVERRIDE;
virtual std::string GetName() const OVERRIDE; virtual std::string GetName() const OVERRIDE;
// Overridden from HostPairingController::Observer: // Overridden from pairing_chromeos::HostPairingController::Observer:
virtual void PairingStageChanged(Stage new_stage) OVERRIDE; virtual void PairingStageChanged(Stage new_stage) OVERRIDE;
virtual void UpdateAdvanced(const UpdateProgress& progress) OVERRIDE; virtual void UpdateAdvanced(const UpdateProgress& progress) OVERRIDE;
...@@ -47,7 +49,7 @@ class HostPairingScreen : public WizardScreen, ...@@ -47,7 +49,7 @@ class HostPairingScreen : public WizardScreen,
// Controller performing pairing. Owned by the screen for now. // Controller performing pairing. Owned by the screen for now.
// TODO(dzhioev): move to proper place later. // TODO(dzhioev): move to proper place later.
scoped_ptr<HostPairingController> controller_; scoped_ptr<pairing_chromeos::HostPairingController> controller_;
// Current stage of pairing process. // Current stage of pairing process.
Stage current_stage_; Stage current_stage_;
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
'../chromeos/ime/input_method.gyp:gencode', '../chromeos/ime/input_method.gyp:gencode',
'../components/components.gyp:cloud_policy_proto', '../components/components.gyp:cloud_policy_proto',
'../components/components.gyp:onc_component', '../components/components.gyp:onc_component',
'../components/components.gyp:pairing',
'../components/components.gyp:policy', '../components/components.gyp:policy',
'../components/components.gyp:session_manager_component', '../components/components.gyp:session_manager_component',
'../components/components.gyp:user_manager', '../components/components.gyp:user_manager',
......
...@@ -370,14 +370,6 @@ ...@@ -370,14 +370,6 @@
'network/shill_property_util.h', 'network/shill_property_util.h',
'network/dhcp_proxy_script_fetcher_chromeos.cc', 'network/dhcp_proxy_script_fetcher_chromeos.cc',
'network/dhcp_proxy_script_fetcher_chromeos.h', 'network/dhcp_proxy_script_fetcher_chromeos.h',
'pairing/fake_controller_pairing_controller.cc',
'pairing/fake_controller_pairing_controller.h',
'pairing/fake_host_pairing_controller.cc',
'pairing/fake_host_pairing_controller.h',
'pairing/controller_pairing_controller.cc',
'pairing/controller_pairing_controller.h',
'pairing/host_pairing_controller.cc',
'pairing/host_pairing_controller.h',
'process_proxy/process_output_watcher.cc', 'process_proxy/process_output_watcher.cc',
'process_proxy/process_output_watcher.h', 'process_proxy/process_output_watcher.h',
'process_proxy/process_proxy.cc', 'process_proxy/process_proxy.cc',
......
...@@ -85,6 +85,12 @@ group("all_components") { ...@@ -85,6 +85,12 @@ group("all_components") {
] ]
} }
if (is_chromeos) {
deps += [
"//components/pairing",
]
}
if (!is_ios) { if (!is_ios) {
deps += [ "//components/keyed_service/content" ] deps += [ "//components/keyed_service/content" ]
} }
......
...@@ -77,6 +77,11 @@ ...@@ -77,6 +77,11 @@
'usb_service.gypi', 'usb_service.gypi',
] ]
}], }],
['chromeos == 1', {
'includes': [
'pairing.gypi',
],
}],
['OS == "win" or OS == "mac"', { ['OS == "win" or OS == "mac"', {
'includes': [ 'includes': [
'wifi.gypi', 'wifi.gypi',
......
# 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': [
{
'target_name': 'pairing',
'type': 'static_library',
'include_dirs': [
'..',
],
'dependencies': [
'../base/base.gyp:base',
'../device/bluetooth/bluetooth.gyp:device_bluetooth',
],
'sources': [
'pairing/fake_controller_pairing_controller.cc',
'pairing/fake_controller_pairing_controller.h',
'pairing/fake_host_pairing_controller.cc',
'pairing/fake_host_pairing_controller.h',
'pairing/controller_pairing_controller.cc',
'pairing/controller_pairing_controller.h',
'pairing/host_pairing_controller.cc',
'pairing/host_pairing_controller.h',
],
},
],
}
# 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("pairing") {
sources = [
"pairing/fake_controller_pairing_controller.cc",
"pairing/fake_controller_pairing_controller.h",
"pairing/fake_host_pairing_controller.cc",
"pairing/fake_host_pairing_controller.h",
"pairing/controller_pairing_controller.cc",
"pairing/controller_pairing_controller.h",
"pairing/host_pairing_controller.cc",
"pairing/host_pairing_controller.h",
]
deps = [
"//base",
"//device/bluetooth",
]
}
include_rules = [
"+device/bluetooth",
]
achuith@chromium.org
dzhioev@chromium.org
zork@chromium.org
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chromeos/pairing/controller_pairing_controller.h" #include "components/pairing/controller_pairing_controller.h"
namespace chromeos { namespace pairing_chromeos {
ControllerPairingController::Observer::Observer() { ControllerPairingController::Observer::Observer() {
} }
...@@ -18,4 +18,4 @@ ControllerPairingController::ControllerPairingController() { ...@@ -18,4 +18,4 @@ ControllerPairingController::ControllerPairingController() {
ControllerPairingController::~ControllerPairingController() { ControllerPairingController::~ControllerPairingController() {
} }
} // namespace chromeos } // namespace pairing_chromeos
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROMEOS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_ #ifndef COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_
#define CHROMEOS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_ #define COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/macros.h" #include "base/macros.h"
#include "chromeos/chromeos_export.h"
namespace chromeos { namespace chromeos {
class UserContext; class UserContext;
...@@ -19,9 +18,9 @@ namespace content { ...@@ -19,9 +18,9 @@ namespace content {
class BrowserContext; class BrowserContext;
} }
namespace chromeos { namespace pairing_chromeos {
class CHROMEOS_EXPORT ControllerPairingController { class ControllerPairingController {
public: public:
enum Stage { enum Stage {
STAGE_NONE, STAGE_NONE,
...@@ -104,6 +103,6 @@ class CHROMEOS_EXPORT ControllerPairingController { ...@@ -104,6 +103,6 @@ class CHROMEOS_EXPORT ControllerPairingController {
DISALLOW_COPY_AND_ASSIGN(ControllerPairingController); DISALLOW_COPY_AND_ASSIGN(ControllerPairingController);
}; };
} // namespace chromeos } // namespace pairing_chromeos
#endif // CHROMEOS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_ #endif // COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chromeos/pairing/fake_controller_pairing_controller.h" #include "components/pairing/fake_controller_pairing_controller.h"
#include <map> #include <map>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
namespace chromeos { namespace pairing_chromeos {
FakeControllerPairingController::FakeControllerPairingController( FakeControllerPairingController::FakeControllerPairingController(
const std::string& config) const std::string& config)
...@@ -332,4 +332,4 @@ void FakeControllerPairingController::PairingStageChanged(Stage new_stage) { ...@@ -332,4 +332,4 @@ void FakeControllerPairingController::PairingStageChanged(Stage new_stage) {
void FakeControllerPairingController::DiscoveredDevicesListChanged() { void FakeControllerPairingController::DiscoveredDevicesListChanged() {
} }
} // namespace chromeos } // namespace pairing_chromeos
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROMEOS_PAIRING_FAKE_CONTROLLER_PAIRING_CONTROLLER_H_ #ifndef COMPONENTS_PAIRING_FAKE_CONTROLLER_PAIRING_CONTROLLER_H_
#define CHROMEOS_PAIRING_FAKE_CONTROLLER_PAIRING_CONTROLLER_H_ #define COMPONENTS_PAIRING_FAKE_CONTROLLER_PAIRING_CONTROLLER_H_
#include <set> #include <set>
#include <utility> #include <utility>
...@@ -11,12 +11,11 @@ ...@@ -11,12 +11,11 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chromeos/chromeos_export.h" #include "components/pairing/controller_pairing_controller.h"
#include "chromeos/pairing/controller_pairing_controller.h"
namespace chromeos { namespace pairing_chromeos {
class CHROMEOS_EXPORT FakeControllerPairingController class FakeControllerPairingController
: public ControllerPairingController, : public ControllerPairingController,
public ControllerPairingController::Observer { public ControllerPairingController::Observer {
public: public:
...@@ -106,6 +105,6 @@ class CHROMEOS_EXPORT FakeControllerPairingController ...@@ -106,6 +105,6 @@ class CHROMEOS_EXPORT FakeControllerPairingController
DISALLOW_COPY_AND_ASSIGN(FakeControllerPairingController); DISALLOW_COPY_AND_ASSIGN(FakeControllerPairingController);
}; };
} // namespace chromeos } // namespace pairing_chromeos
#endif // CHROMEOS_PAIRING_FAKE_CONTROLLER_PAIRING_CONTROLLER_H_ #endif // COMPONENTS_PAIRING_FAKE_CONTROLLER_PAIRING_CONTROLLER_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chromeos/pairing/fake_host_pairing_controller.h" #include "components/pairing/fake_host_pairing_controller.h"
#include <map> #include <map>
#include <vector> #include <vector>
...@@ -22,7 +22,7 @@ const size_t kCodeLength = 6; ...@@ -22,7 +22,7 @@ const size_t kCodeLength = 6;
} // namespace } // namespace
namespace chromeos { namespace pairing_chromeos {
FakeHostPairingController::FakeHostPairingController(const std::string& config) FakeHostPairingController::FakeHostPairingController(const std::string& config)
: current_stage_(STAGE_NONE), : current_stage_(STAGE_NONE),
...@@ -189,4 +189,4 @@ void FakeHostPairingController::PairingStageChanged(Stage new_stage) { ...@@ -189,4 +189,4 @@ void FakeHostPairingController::PairingStageChanged(Stage new_stage) {
void FakeHostPairingController::UpdateAdvanced(const UpdateProgress& progress) { void FakeHostPairingController::UpdateAdvanced(const UpdateProgress& progress) {
} }
} // namespace chromeos } // namespace pairing_chromeos
...@@ -2,18 +2,17 @@ ...@@ -2,18 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROMEOS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_ #ifndef COMPONENTS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_
#define CHROMEOS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_ #define COMPONENTS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_
#include "base/macros.h" #include "base/macros.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chromeos/chromeos_export.h" #include "components/pairing/host_pairing_controller.h"
#include "chromeos/pairing/host_pairing_controller.h"
namespace chromeos { namespace pairing_chromeos {
class CHROMEOS_EXPORT FakeHostPairingController class FakeHostPairingController
: public HostPairingController, : public HostPairingController,
public HostPairingController::Observer { public HostPairingController::Observer {
public: public:
...@@ -28,7 +27,7 @@ class CHROMEOS_EXPORT FakeHostPairingController ...@@ -28,7 +27,7 @@ class CHROMEOS_EXPORT FakeHostPairingController
// empty, random code is generated. // empty, random code is generated.
// * device_name - string. Default: "Chromebox-01". // * device_name - string. Default: "Chromebox-01".
// * domain - string. Default: "example.com". // * domain - string. Default: "example.com".
FakeHostPairingController(const std::string& config); explicit FakeHostPairingController(const std::string& config);
virtual ~FakeHostPairingController(); virtual ~FakeHostPairingController();
// Applies given |config| to flow. // Applies given |config| to flow.
...@@ -69,6 +68,6 @@ class CHROMEOS_EXPORT FakeHostPairingController ...@@ -69,6 +68,6 @@ class CHROMEOS_EXPORT FakeHostPairingController
DISALLOW_COPY_AND_ASSIGN(FakeHostPairingController); DISALLOW_COPY_AND_ASSIGN(FakeHostPairingController);
}; };
} // namespace chromeos } // namespace pairing_chromeos
#endif // CHROMEOS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_ #endif // COMPONENTS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chromeos/pairing/host_pairing_controller.h" #include "components/pairing/host_pairing_controller.h"
namespace chromeos { namespace pairing_chromeos {
HostPairingController::HostPairingController() {} HostPairingController::HostPairingController() {}
...@@ -13,4 +13,4 @@ HostPairingController::~HostPairingController() {} ...@@ -13,4 +13,4 @@ HostPairingController::~HostPairingController() {}
HostPairingController::Observer::Observer() {} HostPairingController::Observer::Observer() {}
HostPairingController::Observer::~Observer() {} HostPairingController::Observer::~Observer() {}
} // namespace chromeos } // namespace pairing_chromeos
...@@ -2,17 +2,16 @@ ...@@ -2,17 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROMEOS_PAIRING_HOST_PAIRING_CONTROLLER_H_ #ifndef COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_
#define CHROMEOS_PAIRING_HOST_PAIRING_CONTROLLER_H_ #define COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_
#include <string> #include <string>
#include "base/macros.h" #include "base/macros.h"
#include "chromeos/chromeos_export.h"
namespace chromeos { namespace pairing_chromeos {
class CHROMEOS_EXPORT HostPairingController { class HostPairingController {
public: public:
enum Stage { enum Stage {
STAGE_NONE, STAGE_NONE,
...@@ -75,6 +74,6 @@ class CHROMEOS_EXPORT HostPairingController { ...@@ -75,6 +74,6 @@ class CHROMEOS_EXPORT HostPairingController {
DISALLOW_COPY_AND_ASSIGN(HostPairingController); DISALLOW_COPY_AND_ASSIGN(HostPairingController);
}; };
} // namespace chromeos } // namespace pairing_chromeos
#endif // CHROMEOS_PAIRING_HOST_PAIRING_CONTROLLER_H_ #endif // COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment