Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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. | |
| 4 // | |
| 5 // See apps/app_host/operation_launcher.h for more information about the | |
| 6 // definition of an operation. | |
|
robertshield
2013/03/28 03:39:34
I don't have a strong preference (a chrome/browser
erikwright (departed)
2013/04/18 17:43:04
I don't have a strong opinion either. I'll see wha
| |
| 7 | |
| 8 #ifndef CHROME_BROWSER_OPERATION_OUTPUT_H_ | |
| 9 #define CHROME_BROWSER_OPERATION_OUTPUT_H_ | |
| 10 | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 | |
| 13 class CommandLine; | |
| 14 | |
| 15 // Defines an interface for reporting the output of an operation to its client. | |
| 16 // While the operation is ongoing, it may produce output (via |Write()|). | |
| 17 // Terminate the operation by passing it to |Complete()| along with an exit | |
| 18 // code. | |
| 19 class OperationOutput { | |
| 20 public: | |
| 21 // Instantiates an OperationOutput channel based on the provided command-line. | |
| 22 // The required arguments are platform dependent. | |
| 23 // This always returns NULL if not on Windows. | |
| 24 static scoped_ptr<OperationOutput> Create(const CommandLine& command_line); | |
| 25 | |
| 26 virtual ~OperationOutput() {} | |
| 27 | |
| 28 // Signals the completion of the operation with the specified exit code. | |
| 29 // Returns true if the exit code is successfully written. | |
| 30 static bool Complete(scoped_ptr<OperationOutput> operation_output, | |
| 31 unsigned int exit_code); | |
| 32 | |
| 33 // Sends operation output to the client. Returns true if the output is | |
| 34 // successfully written. | |
| 35 virtual bool Write(const char* data, unsigned int length) = 0; | |
| 36 | |
| 37 private: | |
| 38 // Sends operation exit code to the client. Returns true if the exit code is | |
| 39 // successfully written. | |
| 40 virtual bool SetExitCode(unsigned int exit_code) = 0; | |
| 41 }; | |
| 42 | |
| 43 #endif // CHROME_BROWSER_OPERATION_OUTPUT_H_ | |
| OLD | NEW |