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

Unified Diff: components/enhanced_bookmarks/stars_position.h

Issue 510543002: Introduce ItemPosition class for enhanced bookmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 4 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
Index: components/enhanced_bookmarks/stars_position.h
diff --git a/components/enhanced_bookmarks/stars_position.h b/components/enhanced_bookmarks/stars_position.h
new file mode 100644
index 0000000000000000000000000000000000000000..15bf26e10e41f6171f402eef1553059cb865b486
--- /dev/null
+++ b/components/enhanced_bookmarks/stars_position.h
@@ -0,0 +1,46 @@
+// Copyright 2014 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 COMPONENTS_ENHANCED_BOOKMARKS_STARS_POSITION_H_
+#define COMPONENTS_ENHANCED_BOOKMARKS_STARS_POSITION_H_
+
+#include <string>
+#include <vector>
+
+namespace enhanced_bookmarks {
+
+class StarsPosition {
Mark 2014/09/04 21:51:24 Please add class level comment as to what this is
Rune Fevang 2014/09/04 22:56:47 Done.
+ public:
+ ~StarsPosition();
+
+ static StarsPosition CreateInitialPosition();
+
+ static StarsPosition CreateBefore(const StarsPosition& other);
+ static StarsPosition CreateBetween(const StarsPosition& before,
+ const StarsPosition& after);
+ static StarsPosition CreateAfter(const StarsPosition& other);
+
+ bool IsValid() const;
+
+ std::string ToString() const;
+
+ private:
+ typedef std::vector<char> PositionVector;
+
+ StarsPosition();
+ explicit StarsPosition(const PositionVector& position);
+
+ static PositionVector CreateBeforeImpl(const PositionVector& before,
+ size_t from_index);
+ static PositionVector CreateBetweenImpl(const PositionVector& before,
+ const PositionVector& after);
+ static PositionVector CreateAfterImpl(const PositionVector& after,
+ size_t from_index);
+
+ PositionVector position_;
+};
+
+} // namespace enhanced_bookmarks
+
+#endif // COMPONENTS_ENHANCED_BOOKMARKS_STARS_POSITION_H_

Powered by Google App Engine
This is Rietveld 408576698