Commit 0430281d authored by Allen Vicencio's avatar Allen Vicencio Committed by Commit Bot

Add SmbShareFinder class stubs

Adds SmbShareFinder which is a high-level class responsible for finding
available shares in a network. Functions are all NOTREACHED and will be
implemented in a future CL.

Bug: 757625
Change-Id: I88ba748df0dafa0a0a2a46d3500b4e057d59163b
Reviewed-on: https://chromium-review.googlesource.com/1089850
Commit-Queue: Allen Vicencio <allenvic@chromium.org>
Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566974}
parent b5ef312b
...@@ -1620,6 +1620,8 @@ source_set("chromeos") { ...@@ -1620,6 +1620,8 @@ source_set("chromeos") {
"smb_client/smb_service_factory.h", "smb_client/smb_service_factory.h",
"smb_client/smb_service_helper.cc", "smb_client/smb_service_helper.cc",
"smb_client/smb_service_helper.h", "smb_client/smb_service_helper.h",
"smb_client/smb_share_finder.cc",
"smb_client/smb_share_finder.h",
"smb_client/smb_task_queue.cc", "smb_client/smb_task_queue.cc",
"smb_client/smb_task_queue.h", "smb_client/smb_task_queue.h",
"smb_client/smb_url.cc", "smb_client/smb_url.cc",
......
// Copyright 2018 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 "chrome/browser/chromeos/smb_client/smb_share_finder.h"
namespace chromeos {
namespace smb_client {
void SmbShareFinder::GatherSharesInNetwork(GatherSharesResponse callback) {
NOTREACHED();
}
void SmbShareFinder::RegisterHostLocator(std::unique_ptr<HostLocator> locator) {
NOTREACHED();
}
void SmbShareFinder::OnHostsFound(GatherSharesResponse callback,
bool success,
const HostMap& hosts) {
NOTREACHED();
}
void SmbShareFinder::OnSharesFound(
const std::string& host_name,
GatherSharesResponse callback,
smbprovider::ErrorType error,
const smbprovider::DirectoryEntryListProto& entries) {
NOTREACHED();
}
} // namespace smb_client
} // namespace chromeos
// Copyright 2018 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.
#ifndef CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_SHARE_FINDER_H_
#define CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_SHARE_FINDER_H_
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/chromeos/smb_client/discovery/host_locator.h"
#include "chrome/browser/chromeos/smb_client/discovery/network_scanner.h"
#include "chrome/browser/chromeos/smb_client/smb_url.h"
#include "chromeos/dbus/smb_provider_client.h"
namespace chromeos {
namespace smb_client {
// The callback that will be passed to GatherSharesInNetwork. The shares found
// will have a format of "smb://host/share". This will be called once per host.
using GatherSharesResponse =
base::RepeatingCallback<void(const std::vector<SmbUrl>& shares_gathered)>;
// This class is responsible for finding hosts in a network and getting the
// available shares for each host found.
class SmbShareFinder : public base::SupportsWeakPtr<SmbShareFinder> {
public:
SmbShareFinder();
~SmbShareFinder();
// Gathers the hosts in the network using |scanner_| and gets the shares for
// each of the hosts found. |callback| will be called once per host and will
// contain the paths to the shares found (e.g. "smb://host/share").
void GatherSharesInNetwork(GatherSharesResponse callback);
// Registers HostLocator |locator| to |scanner_|.
void RegisterHostLocator(std::unique_ptr<HostLocator> locator);
private:
// Handles the response from finding hosts in the network.
void OnHostsFound(GatherSharesResponse callback,
bool success,
const HostMap& hosts);
// Handles the response from getting shares for a given host.
void OnSharesFound(const std::string& host_name,
GatherSharesResponse callback,
smbprovider::ErrorType error,
const smbprovider::DirectoryEntryListProto& entries);
NetworkScanner scanner_;
DISALLOW_COPY_AND_ASSIGN(SmbShareFinder);
};
} // namespace smb_client
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_SHARE_FINDER_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