diagnostics_controller.h revision 7dbb3d5cf0c15f500944d211057644d6a2f37371
1// Copyright 2013 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_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ 6#define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ 7 8#include "base/memory/scoped_ptr.h" 9#include "base/memory/singleton.h" 10 11class CommandLine; 12 13namespace diagnostics { 14 15class DiagnosticsWriter; 16class DiagnosticsModel; 17 18class DiagnosticsController { 19 public: 20 static DiagnosticsController* GetInstance(); 21 22 // Entry point for the diagnostics mode. Returns zero if able to run 23 // diagnostics successfully, regardless of the results of the diagnostics. 24 int Run(const CommandLine& command_line, DiagnosticsWriter* writer); 25 26 // Returns a model with the results that have accumulated. They can then be 27 // queried for their attributes for human consumption later. 28 const DiagnosticsModel& GetResults() const; 29 30 // Returns true if there are any results available. 31 bool HasResults(); 32 33 // Clears any results that have accumulated. After calling this, do not call 34 // GetResults until after Run is called again. 35 void ClearResults(); 36 37 private: 38 friend struct DefaultSingletonTraits<DiagnosticsController>; 39 40 DiagnosticsController(); 41 ~DiagnosticsController(); 42 43 scoped_ptr<DiagnosticsModel> model_; 44 DiagnosticsWriter* writer_; 45 46 DISALLOW_COPY_AND_ASSIGN(DiagnosticsController); 47}; 48 49} // namespace diagnostics 50 51#endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ 52