Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / diagnostics / diagnostics_controller.h
blobf5d3d2292ff1918e60a937e92f4696d9c8a470d5
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.
5 #ifndef CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_
6 #define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/singleton.h"
11 class CommandLine;
13 namespace diagnostics {
15 class DiagnosticsWriter;
16 class DiagnosticsModel;
18 class DiagnosticsController {
19 public:
20 static DiagnosticsController* GetInstance();
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);
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);
30 // Returns a model with the results that have accumulated. They can then be
31 // queried for their attributes for human consumption later.
32 const DiagnosticsModel& GetResults() const;
34 // Returns true if there are any results available.
35 bool HasResults();
37 // Clears any results that have accumulated. After calling this, do not call
38 // GetResults until after Run is called again.
39 void ClearResults();
41 // Records UMA statistics indicating that a regular Chrome startup happened,
42 // with no diagnostics or recovery being run. This is necessary to provide a
43 // denominator for the diagnostics metrics.
44 void RecordRegularStartup();
46 private:
47 friend struct DefaultSingletonTraits<DiagnosticsController>;
49 DiagnosticsController();
50 ~DiagnosticsController();
52 scoped_ptr<DiagnosticsModel> model_;
53 DiagnosticsWriter* writer_;
55 DISALLOW_COPY_AND_ASSIGN(DiagnosticsController);
58 } // namespace diagnostics
60 #endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_