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

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

Issue 1109043003: Apply automated fixits for Chrome clang plugin to chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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_writer.h" 5 #include "chrome/browser/diagnostics/diagnostics_writer.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 class WinConsole : public SimpleConsole { 60 class WinConsole : public SimpleConsole {
61 public: 61 public:
62 // The ctor allocates a console. This avoids having to ask the user to start 62 // The ctor allocates a console. This avoids having to ask the user to start
63 // chrome from a command prompt. 63 // chrome from a command prompt.
64 WinConsole() 64 WinConsole()
65 : std_out_(INVALID_HANDLE_VALUE), 65 : std_out_(INVALID_HANDLE_VALUE),
66 std_in_(INVALID_HANDLE_VALUE) { 66 std_in_(INVALID_HANDLE_VALUE) {
67 ::AllocConsole(); 67 ::AllocConsole();
68 } 68 }
69 69
70 virtual ~WinConsole() { 70 ~WinConsole() override { ::FreeConsole(); }
71 ::FreeConsole();
72 }
73 71
74 virtual bool Init() { 72 bool Init() override { return SetIOHandles(); }
75 return SetIOHandles();
76 }
77 73
78 virtual bool Write(const base::string16& txt) { 74 bool Write(const base::string16& txt) override {
79 DWORD sz = txt.size(); 75 DWORD sz = txt.size();
80 return (TRUE == ::WriteConsoleW(std_out_, txt.c_str(), sz, &sz, NULL)); 76 return (TRUE == ::WriteConsoleW(std_out_, txt.c_str(), sz, &sz, NULL));
81 } 77 }
82 78
83 // Reads a string from the console. Internally it is limited to 256 79 // Reads a string from the console. Internally it is limited to 256
84 // characters. 80 // characters.
85 virtual void OnQuit() { 81 void OnQuit() override {
86 // Block here so the user can see the results. 82 // Block here so the user can see the results.
87 SetColor(SimpleConsole::DEFAULT); 83 SetColor(SimpleConsole::DEFAULT);
88 Write(L"Press [enter] to continue\n"); 84 Write(L"Press [enter] to continue\n");
89 wchar_t buf[256]; 85 wchar_t buf[256];
90 DWORD read = arraysize(buf); 86 DWORD read = arraysize(buf);
91 ::ReadConsoleW(std_in_, buf, read, &read, NULL); 87 ::ReadConsoleW(std_in_, buf, read, &read, NULL);
92 } 88 }
93 89
94 // Sets the foreground and background color. 90 // Sets the foreground and background color.
95 virtual bool SetColor(Color color) { 91 bool SetColor(Color color) override {
96 uint16 color_combo = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | 92 uint16 color_combo = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE |
97 FOREGROUND_INTENSITY; 93 FOREGROUND_INTENSITY;
98 switch (color) { 94 switch (color) {
99 case RED: 95 case RED:
100 color_combo = FOREGROUND_RED | FOREGROUND_INTENSITY; 96 color_combo = FOREGROUND_RED | FOREGROUND_INTENSITY;
101 break; 97 break;
102 case GREEN: 98 case GREEN:
103 color_combo = FOREGROUND_GREEN | FOREGROUND_INTENSITY; 99 color_combo = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
104 break; 100 break;
105 case DEFAULT: 101 case DEFAULT:
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 result.c_str(), 275 result.c_str(),
280 outcome_code, 276 outcome_code,
281 id.c_str(), 277 id.c_str(),
282 extra.c_str())); 278 extra.c_str()));
283 } 279 }
284 } 280 }
285 return true; 281 return true;
286 } 282 }
287 283
288 } // namespace diagnostics 284 } // namespace diagnostics
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/sw_reporter_installer_win.cc ('k') | chrome/browser/first_run/try_chrome_dialog_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698