OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ |
6 #define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 | 10 |
11 class CommandLine; | 11 class CommandLine; |
12 | 12 |
13 namespace diagnostics { | 13 namespace diagnostics { |
14 | 14 |
15 class DiagnosticsWriter; | 15 class DiagnosticsWriter; |
16 class DiagnosticsModel; | 16 class DiagnosticsModel; |
17 | 17 |
18 class DiagnosticsController { | 18 class DiagnosticsController { |
19 public: | 19 public: |
20 static DiagnosticsController* GetInstance(); | 20 static DiagnosticsController* GetInstance(); |
21 | 21 |
22 // Entry point for the diagnostics mode. Returns zero if able to run | 22 // Entry point for the diagnostics mode. Returns zero if able to run |
23 // diagnostics successfully, regardless of the results of the diagnostics. | 23 // diagnostics successfully, regardless of the results of the diagnostics. |
24 int Run(const CommandLine& command_line, DiagnosticsWriter* writer); | 24 int Run(const CommandLine& command_line, DiagnosticsWriter* writer); |
25 | 25 |
26 // Returns a model with the results that have accumulated. They can then be | 26 // Entry point for running recovery based on diagnostics that have already |
| 27 // been run. In order for this to do anything, Run() must be executed first. |
| 28 int RunRecovery(const CommandLine& command_line, DiagnosticsWriter* writer); |
| 29 |
| 30 // Returns a model with the results that have accumulated. They can then be |
27 // queried for their attributes for human consumption later. | 31 // queried for their attributes for human consumption later. |
28 const DiagnosticsModel& GetResults() const; | 32 const DiagnosticsModel& GetResults() const; |
29 | 33 |
30 // Returns true if there are any results available. | 34 // Returns true if there are any results available. |
31 bool HasResults(); | 35 bool HasResults(); |
32 | 36 |
33 // Clears any results that have accumulated. After calling this, do not call | 37 // Clears any results that have accumulated. After calling this, do not call |
34 // GetResults until after Run is called again. | 38 // GetResults until after Run is called again. |
35 void ClearResults(); | 39 void ClearResults(); |
36 | 40 |
37 private: | 41 private: |
38 friend struct DefaultSingletonTraits<DiagnosticsController>; | 42 friend struct DefaultSingletonTraits<DiagnosticsController>; |
39 | 43 |
40 DiagnosticsController(); | 44 DiagnosticsController(); |
41 ~DiagnosticsController(); | 45 ~DiagnosticsController(); |
42 | 46 |
43 scoped_ptr<DiagnosticsModel> model_; | 47 scoped_ptr<DiagnosticsModel> model_; |
44 DiagnosticsWriter* writer_; | 48 DiagnosticsWriter* writer_; |
45 | 49 |
46 DISALLOW_COPY_AND_ASSIGN(DiagnosticsController); | 50 DISALLOW_COPY_AND_ASSIGN(DiagnosticsController); |
47 }; | 51 }; |
48 | 52 |
49 } // namespace diagnostics | 53 } // namespace diagnostics |
50 | 54 |
51 #endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ | 55 #endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ |
OLD | NEW |