#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include "base/at_exit.h"
#include "base/base64.h"
#include "base/command_line.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/message_loop/message_pump_type.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_executor.h"
#include "base/task/thread_pool.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "chrome/enterprise_companion/device_management_storage/dm_storage.h"
#include "chrome/updater/app/app.h"
#include "chrome/updater/configurator.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/device_management/dm_message.h"
#include "chrome/updater/device_management/dm_response_validator.h"
#include "chrome/updater/external_constants_default.h"
#include "chrome/updater/ipc/ipc_support.h"
#include "chrome/updater/policy/service.h"
#include "chrome/updater/prefs.h"
#include "chrome/updater/protos/omaha_settings.pb.h"
#include "chrome/updater/service_proxy_factory.h"
#include "chrome/updater/update_service.h"
#include "components/policy/proto/device_management_backend.pb.h"
namespace updater::tools {
constexpr char kProductSwitch[] = …;
constexpr char kBackgroundSwitch[] = …;
constexpr char kListAppsSwitch[] = …;
constexpr char kListUpdateSwitch[] = …;
constexpr char kListPoliciesSwitch[] = …;
constexpr char kListCBCMPoliciesSwitch[] = …;
constexpr char kCBCMPolicyPathSwitch[] = …;
constexpr char kJSONFormatSwitch[] = …;
constexpr char kUpdateSwitch[] = …;
namespace updater_policy {
namespace edm = ::wireless_android_enterprise_devicemanagement;
std::ostream& operator<<(std::ostream& os, edm::UpdateValue value) { … }
std::ostream& operator<<(std::ostream& os, edm::InstallDefaultValue value) { … }
std::ostream& operator<<(std::ostream& os, edm::InstallValue value) { … }
std::ostream& operator<<(std::ostream& os,
PolicyValidationResult::Status status) { … }
scoped_refptr<device_management_storage::DMStorage> GetDMStorage() { … }
std::unique_ptr<device_management_storage::CachedPolicyInfo>
GetCachedPolicyInfo(
scoped_refptr<device_management_storage::DMStorage> dm_storage) { … }
std::unique_ptr<edm::OmahaSettingsClientProto> GetOmahaPolicySettings() { … }
void PrintCachedPolicy(const base::FilePath& policy_path) { … }
void PrintCachedPolicyInfo(
const device_management_storage::CachedPolicyInfo& cached_info) { … }
void PrintCBCMPolicies() { … }
}
UpdaterScope Scope() { … }
UpdateService::Priority Priority() { … }
std::string Quoted(const std::string& value) { … }
bool OutputInJSONFormat() { … }
std::string ValueToJSONString(const base::Value& value) { … }
void OnAppStateChanged(const UpdateService::UpdateState& update_state) { … }
void OnUpdateComplete(base::OnceCallback<void(int)> cb,
UpdateService::Result result) { … }
class AppState : public base::RefCountedThreadSafe<AppState> { … };
class UpdaterUtilApp : public App { … };
void UpdaterUtilApp::PrintUsage(const std::string& error_message) { … }
void UpdaterUtilApp::ListApps() { … }
void UpdaterUtilApp::FindApp(
const std::string& app_id,
base::OnceCallback<void(scoped_refptr<AppState>)> callback) { … }
void UpdaterUtilApp::ListUpdate() { … }
void UpdaterUtilApp::DoListUpdate(scoped_refptr<AppState> app_state) { … }
void UpdaterUtilApp::Update() { … }
void UpdaterUtilApp::DoUpdateApp(scoped_refptr<AppState> app_state) { … }
void UpdaterUtilApp::ListPolicies() { … }
void UpdaterUtilApp::ListCBCMPolicies() { … }
void UpdaterUtilApp::FirstTaskRun() { … }
int UpdaterUtilMain(int argc, char** argv) { … }
}
int main(int argc, char** argv) { … }