OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 NET_BASE_LOAD_STATES_H__ | 5 #ifndef NET_BASE_LOAD_STATES_H__ |
6 #define NET_BASE_LOAD_STATES_H__ | 6 #define NET_BASE_LOAD_STATES_H__ |
7 | 7 |
8 #include "base/callback_forward.h" | |
8 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
9 | 10 |
10 namespace net { | 11 namespace net { |
11 | 12 |
12 // These states correspond to the lengthy periods of time that a resource load | 13 // These states correspond to the lengthy periods of time that a resource load |
13 // may be blocked and unable to make progress. | 14 // may be blocked and unable to make progress. |
14 enum LoadState { | 15 enum LoadState { |
15 | 16 |
16 #define LOAD_STATE(label) LOAD_STATE_ ## label, | 17 #define LOAD_STATE(label) LOAD_STATE_ ## label, |
17 #include "net/base/load_states_list.h" | 18 #include "net/base/load_states_list.h" |
18 #undef LOAD_STATE | 19 #undef LOAD_STATE |
19 | 20 |
20 }; | 21 }; |
21 | 22 |
22 // Some states, like LOAD_STATE_WAITING_FOR_DELEGATE, are associated with extra | 23 // Some states, like LOAD_STATE_WAITING_FOR_DELEGATE, are associated with extra |
23 // data that describes more precisely what the delegate (for example) is doing. | 24 // data that describes more precisely what the delegate (for example) is doing. |
24 // This class provides an easy way to hold a load state with an extra parameter. | 25 // This class provides an easy way to hold a load state with an extra parameter. |
25 struct LoadStateWithParam { | 26 struct LoadStateWithParam { |
26 LoadState state; | 27 LoadState state; |
27 base::string16 param; | 28 base::string16 param; |
28 LoadStateWithParam() : state(LOAD_STATE_IDLE) {} | 29 LoadStateWithParam() : state(LOAD_STATE_IDLE) {} |
29 LoadStateWithParam(LoadState state, const base::string16& param) | 30 LoadStateWithParam(LoadState state, const base::string16& param) |
30 : state(state), param(param) {} | 31 : state(state), param(param) {} |
31 }; | 32 }; |
32 | 33 |
34 template <typename RequestHandle> | |
eroman
2015/03/06 05:13:01
I don't feel this belongs in the generic load_stat
Sam McNally
2015/03/06 09:33:02
Done.
| |
35 using LoadStateChangedCallback = | |
36 const base::Callback<void(RequestHandle, LoadState)>; | |
37 | |
33 } // namespace net | 38 } // namespace net |
34 | 39 |
35 #endif // NET_BASE_LOAD_STATES_H__ | 40 #endif // NET_BASE_LOAD_STATES_H__ |
OLD | NEW |