1 // Copyright 2018 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 #ifndef COMPONENTS_FEED_CORE_FEED_CONTENT_OPERATION_H_ 6 #define COMPONENTS_FEED_CORE_FEED_CONTENT_OPERATION_H_ 7 8 #include <string> 9 10 #include "base/macros.h" 11 12 namespace feed { 13 14 // Native counterpart of ContentOperation.java. 15 class ContentOperation { 16 public: 17 enum Type { 18 CONTENT_DELETE, 19 CONTENT_DELETE_ALL, 20 CONTENT_DELETE_BY_PREFIX, 21 CONTENT_UPSERT, 22 }; 23 24 static ContentOperation CreateDeleteOperation(std::string key); 25 static ContentOperation CreateDeleteAllOperation(); 26 static ContentOperation CreateDeleteByPrefixOperation(std::string prefix); 27 static ContentOperation CreateUpsertOperation(std::string key, 28 std::string value); 29 30 ContentOperation(ContentOperation&& operation); 31 32 Type type(); 33 const std::string& key(); 34 const std::string& value(); 35 const std::string& prefix(); 36 37 private: 38 ContentOperation(Type type, 39 std::string key, 40 std::string value, 41 std::string prefix); 42 43 const Type type_; 44 const std::string key_; 45 const std::string value_; 46 const std::string prefix_; 47 48 DISALLOW_COPY_AND_ASSIGN(ContentOperation); 49 }; 50 51 } // namespace feed 52 53 #endif // COMPONENTS_FEED_CORE_FEED_CONTENT_OPERATION_H_ 54