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 #include "chrome/browser/diagnostics/diagnostics_writer.h" | 5 #include "chrome/browser/diagnostics/diagnostics_writer.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" |
| 13 #include "base/macros.h" |
| 14 #include "base/strings/string16.h" |
| 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/strings/utf_string_conversions.h" |
7 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "ui/base/ui_base_paths.h" |
8 | 20 |
9 #if defined(OS_POSIX) | 21 #if defined(OS_POSIX) |
10 #include <stdio.h> | 22 #include <stdio.h> |
11 #include <unistd.h> | 23 #include <unistd.h> |
12 #endif | 24 #endif |
13 | 25 |
14 #include <string> | |
15 | |
16 #include "base/basictypes.h" | |
17 #include "base/command_line.h" | |
18 #include "base/logging.h" | |
19 #include "base/strings/string16.h" | |
20 #include "base/strings/stringprintf.h" | |
21 #include "base/strings/utf_string_conversions.h" | |
22 #include "chrome/common/chrome_switches.h" | |
23 #include "ui/base/ui_base_paths.h" | |
24 | |
25 namespace diagnostics { | 26 namespace diagnostics { |
26 | 27 |
27 // This is a minimalistic interface to wrap the platform console. | 28 // This is a minimalistic interface to wrap the platform console. |
28 class SimpleConsole { | 29 class SimpleConsole { |
29 public: | 30 public: |
30 enum Color { | 31 enum Color { |
31 DEFAULT, | 32 DEFAULT, |
32 RED, | 33 RED, |
33 GREEN, | 34 GREEN, |
34 }; | 35 }; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Block here so the user can see the results. | 83 // Block here so the user can see the results. |
83 SetColor(SimpleConsole::DEFAULT); | 84 SetColor(SimpleConsole::DEFAULT); |
84 Write(L"Press [enter] to continue\n"); | 85 Write(L"Press [enter] to continue\n"); |
85 wchar_t buf[256]; | 86 wchar_t buf[256]; |
86 DWORD read = arraysize(buf); | 87 DWORD read = arraysize(buf); |
87 ::ReadConsoleW(std_in_, buf, read, &read, NULL); | 88 ::ReadConsoleW(std_in_, buf, read, &read, NULL); |
88 } | 89 } |
89 | 90 |
90 // Sets the foreground and background color. | 91 // Sets the foreground and background color. |
91 bool SetColor(Color color) override { | 92 bool SetColor(Color color) override { |
92 uint16 color_combo = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | | 93 uint16_t color_combo = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | |
93 FOREGROUND_INTENSITY; | 94 FOREGROUND_INTENSITY; |
94 switch (color) { | 95 switch (color) { |
95 case RED: | 96 case RED: |
96 color_combo = FOREGROUND_RED | FOREGROUND_INTENSITY; | 97 color_combo = FOREGROUND_RED | FOREGROUND_INTENSITY; |
97 break; | 98 break; |
98 case GREEN: | 99 case GREEN: |
99 color_combo = FOREGROUND_GREEN | FOREGROUND_INTENSITY; | 100 color_combo = FOREGROUND_GREEN | FOREGROUND_INTENSITY; |
100 break; | 101 break; |
101 case DEFAULT: | 102 case DEFAULT: |
102 break; | 103 break; |
103 default: | 104 default: |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 result.c_str(), | 276 result.c_str(), |
276 outcome_code, | 277 outcome_code, |
277 id.c_str(), | 278 id.c_str(), |
278 extra.c_str())); | 279 extra.c_str())); |
279 } | 280 } |
280 } | 281 } |
281 return true; | 282 return true; |
282 } | 283 } |
283 | 284 |
284 } // namespace diagnostics | 285 } // namespace diagnostics |
OLD | NEW |