Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[QuickStart] Add QuickStartConnectivityService and related plumbing
Add a new KeyedService for Quick Start which is used to fetch a NearbyConnectionsManager. Quick Start will use this to advertise and create a NearbyConnection to communicate with the phone. The service is added to //chrome/browser/ash/nearby in order to avoid a dependency cycle that would result if :oobe_quick_start depended on NearbyConnectionsManagerImpl directly. In the future, after we finish refactoring //chrome/browser/nearby_sharing to extract out the Nearby-Share-agnostic code into a reusable component, we should then be able to move the service into the oobe_quick_start directory and get rid of the dependency injection. The next CL in this relation chain will perform Nearby Connections advertising, and the unit tests for that functionality will provide additional coverage for this code. TEST=Manually test for regressions in Quick Start and Nearby Share. Bug: b/234655072 Change-Id: I304fa4bb479d6ed07b641d010139c9372ffe728f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4006775 Reviewed-by: Ryan Hansberry <hansberry@chromium.org> Reviewed-by: Renato Silva <rrsilva@google.com> Reviewed-by: Michael Hansen <hansenmichael@google.com> Commit-Queue: Michael Hansen <hansenmichael@google.com> Cr-Commit-Position: refs/heads/main@{#1085134}
- Loading branch information
Curt Clemens
authored and
Chromium LUCI CQ
committed
Dec 19, 2022
1 parent
326f09b
commit 8054c42
Showing
27 changed files
with
301 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
chrome/browser/ash/nearby/quick_start_connectivity_service.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2022 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/ash/nearby/quick_start_connectivity_service.h" | ||
|
||
#include "base/memory/weak_ptr.h" | ||
#include "chrome/browser/nearby_sharing/nearby_connections_manager_impl.h" | ||
#include "chrome/browser/nearby_sharing/public/cpp/nearby_connections_manager.h" | ||
#include "chromeos/ash/services/nearby/public/cpp/nearby_process_manager.h" | ||
|
||
namespace ash::quick_start { | ||
|
||
namespace { | ||
|
||
constexpr char kServiceId[] = "QuickStart"; | ||
|
||
} // namespace | ||
|
||
QuickStartConnectivityService::QuickStartConnectivityService( | ||
nearby::NearbyProcessManager* nearby_process_manager) | ||
: nearby_process_manager_(nearby_process_manager) {} | ||
|
||
QuickStartConnectivityService::~QuickStartConnectivityService() = default; | ||
|
||
base::WeakPtr<NearbyConnectionsManager> | ||
QuickStartConnectivityService::GetNearbyConnectionsManager() { | ||
DCHECK(nearby_process_manager_); | ||
|
||
if (!nearby_connections_manager_) { | ||
nearby_connections_manager_ = | ||
std::make_unique<NearbyConnectionsManagerImpl>(nearby_process_manager_, | ||
kServiceId); | ||
} | ||
|
||
return nearby_connections_manager_->GetWeakPtr(); | ||
} | ||
|
||
} // namespace ash::quick_start |
Oops, something went wrong.