blob: a43aea1f4dd19c46f2293ee90b987b471f38bce0 [file] [log] [blame]
// Copyright 2013 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 <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
#include "ipc/ipc_listener.h"
namespace base {
class Thread;
class TimeDelta;
class WaitableEvent;
} // base
namespace IPC {
class Channel;
} // IPC
// Simple IPC listener to run on setup utility size wait message with data about
// environment from service process.
class SetupListener : public IPC::Listener {
static const char kXpsAvailableJsonValueName[];
static const char kChromePathJsonValueName[];
static const char kPrintersJsonValueName[];
static const char kUserDataDirJsonValueName[];
static const char kUserNameJsonValueName[];
static const wchar_t kSetupPipeName[];
explicit SetupListener(const base::string16& user);
virtual ~SetupListener();
virtual bool OnMessageReceived(const IPC::Message& msg) override;
virtual void OnChannelError() override;
bool WaitResponce(const base::TimeDelta& delta);
const base::FilePath& chrome_path() const {
return chrome_path_;
const base::FilePath& user_data_dir() const {
return user_data_dir_;
const base::string16& user_name() const {
return user_name_;
const std::vector<std::string>& printers() const {
return printers_;
bool is_xps_available() const {
return is_xps_available_;
void Disconnect();
void Connect(const base::string16& user);
base::FilePath chrome_path_;
base::FilePath user_data_dir_;
base::string16 user_name_;
std::vector<std::string> printers_;
bool is_xps_available_;
bool succeded_;
scoped_ptr<base::WaitableEvent> done_event_;
scoped_ptr<base::Thread> ipc_thread_;
scoped_ptr<IPC::Channel> channel_;