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

Unified Diff: chrome/browser/password_manager/proxy/message_reader.h

Issue 8509038: Linux: split GNOME Keyring integration into a separate process. Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: everything works Created 9 years, 1 month 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
Index: chrome/browser/password_manager/proxy/message_reader.h
===================================================================
--- chrome/browser/password_manager/proxy/message_reader.h (revision 0)
+++ chrome/browser/password_manager/proxy/message_reader.h (revision 0)
@@ -0,0 +1,41 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_PASSWORD_MANAGER_PROXY_MESSAGE_READER_H_
+#define CHROME_BROWSER_PASSWORD_MANAGER_PROXY_MESSAGE_READER_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+// This class handles reading bits and pieces of input data and assembling them
+// into a set of newline-delimited lines. Each message is terminated by a blank
+// line. (Think HTTP, SMTP, etc.)
+// It is used in the (tiny) helper binary as well as the browser process, so it
+// must not have any dependencies beyond standard libraries.
+class MessageReader {
+ public:
+ MessageReader() : is_complete_(false) { lines_.resize(1); }
vandebo (ex-Chrome) 2011/12/01 19:57:30 Put this in the implementation file.
+
+ // Returns the number of characters actually used; on end-of-message,
+ // this may be smaller than |size|, but should otherwise be equal.
+ // It is an error to call HandleData() if is_complete() would return true.
+ size_t HandleData(const char* data, size_t size);
+
+ bool is_complete() const { return is_complete_; }
+ const std::vector<std::string>& lines() const { return lines_; }
+
+ // Resets internal state so the reader will be ready for another message.
+ void Reset() {
vandebo (ex-Chrome) 2011/12/01 19:57:30 Put this in the implementation file.
+ lines_.clear();
+ lines_.resize(1);
+ is_complete_ = false;
+ }
+
+ private:
+ bool is_complete_;
+ std::vector<std::string> lines_;
+};
+
+#endif // CHROME_BROWSER_PASSWORD_MANAGER_PROXY_MESSAGE_READER_H_
Property changes on: chrome/browser/password_manager/proxy/message_reader.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698