Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: chrome/browser/diagnostics/diagnostics_controller.cc

Issue 16948012: This adds a recovery mode to the diagnostics (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload after merge Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/diagnostics/diagnostics_controller.h" 5 #include "chrome/browser/diagnostics/diagnostics_controller.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 16 matching lines...) Expand all
27 const DiagnosticsModel& DiagnosticsController::GetResults() const { 27 const DiagnosticsModel& DiagnosticsController::GetResults() const {
28 return *model_; 28 return *model_;
29 } 29 }
30 30
31 bool DiagnosticsController::HasResults() { 31 bool DiagnosticsController::HasResults() {
32 return (model_.get() && model_->GetTestRunCount() > 0); 32 return (model_.get() && model_->GetTestRunCount() > 0);
33 } 33 }
34 34
35 void DiagnosticsController::ClearResults() { model_.reset(); } 35 void DiagnosticsController::ClearResults() { model_.reset(); }
36 36
37 // This entry point is called from ChromeMain() when very few things 37 // This entry point is called from early in startup when very few things have
38 // have been initialized, so be careful what you use. 38 // been initialized, so be careful what you use.
39 int DiagnosticsController::Run(const CommandLine& command_line, 39 int DiagnosticsController::Run(const CommandLine& command_line,
40 DiagnosticsWriter* writer) { 40 DiagnosticsWriter* writer) {
41 writer_ = writer; 41 writer_ = writer;
42 42
43 model_.reset(MakeDiagnosticsModel(command_line)); 43 model_.reset(MakeDiagnosticsModel(command_line));
44 model_->RunAll(writer_); 44 model_->RunAll(writer_);
45 45
46 return 0; 46 return 0;
47 } 47 }
48 48
49 // This entry point is called from early in startup when very few things have
50 // been initialized, so be careful what you use.
51 int DiagnosticsController::RunRecovery(const CommandLine& command_line,
52 DiagnosticsWriter* writer) {
53 if (!HasResults()) {
54 if (writer) {
55 writer->WriteInfoLine("No diagnostics have been run.");
56 writer->OnAllRecoveryDone(model_.get());
57 }
58 return -1;
59 }
60
61 writer_ = writer;
62
63 model_->RecoverAll(writer_);
64 return 0;
65 }
66
49 } // namespace diagnostics 67 } // namespace diagnostics
OLDNEW
« no previous file with comments | « chrome/browser/diagnostics/diagnostics_controller.h ('k') | chrome/browser/diagnostics/diagnostics_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698