-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce DeviceCommandFetchSupportPacketJob class
DeviceCommandFetchSupportPacketJob will execute FETCH_SUPPORT_PACKET remote command. Introduce the class (the contents will be filled in follow-up CL as a TODO). Sync FETCH_SUPPORT_PACKET command type in device_management.proto in google3. Add the enum values for histograms for the new command type. Bug: b:264399756 Change-Id: I5837cd3a2550341118859a33f80700e6c214852c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4274929 Reviewed-by: Pavol Marko <pmarko@chromium.org> Commit-Queue: Irem Uguz <iremuguz@google.com> Reviewed-by: Igor Ruvinov <igorruvinov@chromium.org> Cr-Commit-Position: refs/heads/main@{#1108870}
- Loading branch information
Irem Uguz
authored and
Chromium LUCI CQ
committed
Feb 23, 2023
1 parent
1528450
commit 2c946a4
Showing
11 changed files
with
106 additions
and
1 deletion.
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
37 changes: 37 additions & 0 deletions
37
chrome/browser/ash/policy/remote_commands/device_command_fetch_support_packet_job.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,37 @@ | ||
// Copyright 2023 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/policy/remote_commands/device_command_fetch_support_packet_job.h" | ||
|
||
#include <string> | ||
#include <utility> | ||
|
||
#include "chrome/browser/support_tool/data_collection_module.pb.h" | ||
#include "components/policy/proto/device_management_backend.pb.h" | ||
|
||
namespace policy { | ||
|
||
DeviceCommandFetchSupportPacketJob::DeviceCommandFetchSupportPacketJob() = | ||
default; | ||
|
||
DeviceCommandFetchSupportPacketJob::~DeviceCommandFetchSupportPacketJob() = | ||
default; | ||
|
||
enterprise_management::RemoteCommand_Type | ||
DeviceCommandFetchSupportPacketJob::GetType() const { | ||
return enterprise_management::RemoteCommand_Type_FETCH_SUPPORT_PACKET; | ||
} | ||
|
||
void DeviceCommandFetchSupportPacketJob::RunImpl( | ||
CallbackWithResult result_callback) { | ||
result_callback_ = std::move(result_callback); | ||
// TODO(b/264399756): The contents will be filled in the follow-up CL. | ||
} | ||
|
||
bool DeviceCommandFetchSupportPacketJob::ParseCommandPayload( | ||
const std::string& command_payload) { | ||
return support_packet_details_.ParseFromString(command_payload); | ||
} | ||
|
||
} // namespace policy |
50 changes: 50 additions & 0 deletions
50
chrome/browser/ash/policy/remote_commands/device_command_fetch_support_packet_job.h
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,50 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROME_BROWSER_ASH_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_FETCH_SUPPORT_PACKET_JOB_H_ | ||
#define CHROME_BROWSER_ASH_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_FETCH_SUPPORT_PACKET_JOB_H_ | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "base/memory/weak_ptr.h" | ||
#include "chrome/browser/support_tool/data_collection_module.pb.h" | ||
#include "components/policy/core/common/remote_commands/remote_command_job.h" | ||
#include "components/policy/proto/device_management_backend.pb.h" | ||
|
||
namespace policy { | ||
|
||
class DeviceCommandFetchSupportPacketJob : public RemoteCommandJob { | ||
public: | ||
DeviceCommandFetchSupportPacketJob(); | ||
|
||
DeviceCommandFetchSupportPacketJob( | ||
const DeviceCommandFetchSupportPacketJob&) = delete; | ||
DeviceCommandFetchSupportPacketJob& operator=( | ||
const DeviceCommandFetchSupportPacketJob&) = delete; | ||
|
||
~DeviceCommandFetchSupportPacketJob() override; | ||
|
||
// RemoteCommandJob: | ||
enterprise_management::RemoteCommand_Type GetType() const override; | ||
|
||
protected: | ||
// RemoteCommandJob: | ||
void RunImpl(CallbackWithResult result_callback) override; | ||
// Parses `command_payload` into SupportPacketDetails proto message. | ||
bool ParseCommandPayload(const std::string& command_payload) override; | ||
|
||
private: | ||
// The details of requested support packet. Contains details like data | ||
// collectors, PII types, case ID etc. | ||
support_tool::SupportPacketDetails support_packet_details_; | ||
// The callback to run when the execution of RemoteCommandJob has finished. | ||
CallbackWithResult result_callback_; | ||
base::WeakPtrFactory<DeviceCommandFetchSupportPacketJob> weak_ptr_factory_{ | ||
this}; | ||
}; | ||
|
||
} // namespace policy | ||
|
||
#endif // CHROME_BROWSER_ASH_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_FETCH_SUPPORT_PACKET_JOB_H_ |
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