OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_INSTALLER_UTIL_CALLBACK_WORK_ITEM_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_CALLBACK_WORK_ITEM_H_ |
6 #define CHROME_INSTALLER_UTIL_CALLBACK_WORK_ITEM_H_ | 6 #define CHROME_INSTALLER_UTIL_CALLBACK_WORK_ITEM_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // | 28 // |
29 // void SomeFunctionThatAddsItemsToAList(WorkItemList* item_list) { | 29 // void SomeFunctionThatAddsItemsToAList(WorkItemList* item_list) { |
30 // ... | 30 // ... |
31 // item_list->AddCallbackWorkItem(base::Bind(&SomeWorkItemCallback)); | 31 // item_list->AddCallbackWorkItem(base::Bind(&SomeWorkItemCallback)); |
32 // ... | 32 // ... |
33 // } | 33 // } |
34 class CallbackWorkItem : public WorkItem { | 34 class CallbackWorkItem : public WorkItem { |
35 public: | 35 public: |
36 virtual ~CallbackWorkItem(); | 36 virtual ~CallbackWorkItem(); |
37 | 37 |
38 virtual bool Do() OVERRIDE; | 38 virtual bool Do() override; |
39 virtual void Rollback() OVERRIDE; | 39 virtual void Rollback() override; |
40 | 40 |
41 bool IsRollback() const; | 41 bool IsRollback() const; |
42 | 42 |
43 private: | 43 private: |
44 friend class WorkItem; | 44 friend class WorkItem; |
45 | 45 |
46 enum RollState { | 46 enum RollState { |
47 RS_UNDEFINED, | 47 RS_UNDEFINED, |
48 RS_FORWARD, | 48 RS_FORWARD, |
49 RS_BACKWARD, | 49 RS_BACKWARD, |
50 }; | 50 }; |
51 | 51 |
52 CallbackWorkItem(base::Callback<bool(const CallbackWorkItem&)> callback); | 52 CallbackWorkItem(base::Callback<bool(const CallbackWorkItem&)> callback); |
53 | 53 |
54 base::Callback<bool(const CallbackWorkItem&)> callback_; | 54 base::Callback<bool(const CallbackWorkItem&)> callback_; |
55 RollState roll_state_; | 55 RollState roll_state_; |
56 | 56 |
57 FRIEND_TEST_ALL_PREFIXES(CallbackWorkItemTest, TestFailure); | 57 FRIEND_TEST_ALL_PREFIXES(CallbackWorkItemTest, TestFailure); |
58 FRIEND_TEST_ALL_PREFIXES(CallbackWorkItemTest, TestForwardBackward); | 58 FRIEND_TEST_ALL_PREFIXES(CallbackWorkItemTest, TestForwardBackward); |
59 }; | 59 }; |
60 | 60 |
61 #endif // CHROME_INSTALLER_UTIL_CALLBACK_WORK_ITEM_H_ | 61 #endif // CHROME_INSTALLER_UTIL_CALLBACK_WORK_ITEM_H_ |
OLD | NEW |