1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_DIAGNOSIS_RUNNER_H_
6#define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_DIAGNOSIS_RUNNER_H_
7
8#include <string>
9
10#include "base/basictypes.h"
11#include "base/memory/weak_ptr.h"
12#include "chrome/browser/extensions/api/feedback_private/feedback_service.h"
13#include "components/keyed_service/core/keyed_service.h"
14
15class Profile;
16
17namespace chromeos {
18
19// A class to run diagnose for kiosk app. Currently, it only schedules a
20// feedback to collected.
21class KioskDiagnosisRunner : public KeyedService {
22 public:
23  // Run diagnostic jobs for |app_id|.
24  static void Run(Profile* profile, const std::string& app_id);
25
26 private:
27  // A BrowserContextKeyedServiceFactory for this service.
28  class Factory;
29
30  explicit KioskDiagnosisRunner(Profile* profile);
31  virtual ~KioskDiagnosisRunner();
32
33  void Start(const std::string& app_id);
34
35  void StartSystemLogCollection();
36  void SendSysLogFeedback(const extensions::SystemInformationList& sys_info);
37  void OnFeedbackSent(bool sent);
38
39  Profile* profile_;
40  std::string app_id_;
41  base::WeakPtrFactory<KioskDiagnosisRunner> weak_factory_;
42
43  DISALLOW_COPY_AND_ASSIGN(KioskDiagnosisRunner);
44};
45
46}  // namespace chromeos
47
48#endif  // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_DIAGNOSIS_RUNNER_H_
49