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

Unified Diff: chrome/browser/operation_output.h

Issue 12674028: Report text output and exit code for command-line operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forgotten review responses. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_process_singleton_unittest.cc ('k') | chrome/browser/operation_output.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
+
+#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_
« no previous file with comments | « chrome/browser/chrome_process_singleton_unittest.cc ('k') | chrome/browser/operation_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698