Chromium Code Reviews| Index: chrome/browser/operation_output.h |
| diff --git a/chrome/browser/operation_output.h b/chrome/browser/operation_output.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6ffff12f1bddaf7ef75febc3112264bc94e28938 |
| --- /dev/null |
| +++ b/chrome/browser/operation_output.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| +// |
| +// See apps/app_host/operation_launcher.h for more information about the |
| +// 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
|
| + |
| +#ifndef CHROME_BROWSER_OPERATION_OUTPUT_H_ |
| +#define CHROME_BROWSER_OPERATION_OUTPUT_H_ |
| + |
| +#include "base/memory/scoped_ptr.h" |
| + |
| +class CommandLine; |
| + |
| +// Defines an interface for reporting the output of an operation to its client. |
| +// While the operation is ongoing, it may produce output (via |Write()|). |
| +// Terminate the operation by passing it to |Complete()| along with an exit |
| +// code. |
| +class OperationOutput { |
| + public: |
| + // Instantiates an OperationOutput channel based on the provided command-line. |
| + // The required arguments are platform dependent. |
| + // This always returns NULL if not on Windows. |
| + static scoped_ptr<OperationOutput> Create(const CommandLine& command_line); |
| + |
| + virtual ~OperationOutput() {} |
| + |
| + // Signals the completion of the operation with the specified exit code. |
| + // Returns true if the exit code is successfully written. |
| + static bool Complete(scoped_ptr<OperationOutput> operation_output, |
| + unsigned int exit_code); |
| + |
| + // Sends operation output to the client. Returns true if the output is |
| + // successfully written. |
| + virtual bool Write(const char* data, unsigned int length) = 0; |
| + |
| + private: |
| + // Sends operation exit code to the client. Returns true if the exit code is |
| + // successfully written. |
| + virtual bool SetExitCode(unsigned int exit_code) = 0; |
| +}; |
| + |
| +#endif // CHROME_BROWSER_OPERATION_OUTPUT_H_ |