OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 IOS_CHROME_BROWSER_WEB_NETWORK_ACTIVITY_INDICATOR_TAB_HELPER_H_ | 5 #ifndef IOS_CHROME_BROWSER_WEB_NETWORK_ACTIVITY_INDICATOR_TAB_HELPER_H_ |
6 #define IOS_CHROME_BROWSER_WEB_NETWORK_ACTIVITY_INDICATOR_TAB_HELPER_H_ | 6 #define IOS_CHROME_BROWSER_WEB_NETWORK_ACTIVITY_INDICATOR_TAB_HELPER_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "ios/web/public/web_state/web_state_observer.h" | 12 #include "ios/web/public/web_state/web_state_observer.h" |
13 #include "ios/web/public/web_state/web_state_user_data.h" | 13 #include "ios/web/public/web_state/web_state_user_data.h" |
14 | 14 |
15 @class NSString; | 15 @class NSString; |
16 | 16 |
17 // Handles listening to webState network activity to control network activity | 17 // Handles listening to webState network activity to control network activity |
18 // indicator. | 18 // indicator. |
19 class NetworkActivityIndicatorTabHelper | 19 class NetworkActivityIndicatorTabHelper |
20 : public web::WebStateObserver, | 20 : public web::WebStateObserver, |
21 public web::WebStateUserData<NetworkActivityIndicatorTabHelper> { | 21 public web::WebStateUserData<NetworkActivityIndicatorTabHelper> { |
22 public: | 22 public: |
| 23 ~NetworkActivityIndicatorTabHelper() override; |
| 24 |
23 static void CreateForWebState(web::WebState* web_state, NSString* tab_id); | 25 static void CreateForWebState(web::WebState* web_state, NSString* tab_id); |
24 | 26 |
25 private: | 27 private: |
26 NetworkActivityIndicatorTabHelper(web::WebState* web_state, NSString* tab_id); | 28 NetworkActivityIndicatorTabHelper(web::WebState* web_state, NSString* tab_id); |
27 ~NetworkActivityIndicatorTabHelper() override; | |
28 | 29 |
29 // web::WebStateObserver overrides: | 30 // web::WebStateObserver overrides: |
30 void DidStartLoading() override; | 31 void DidStartLoading() override; |
31 void DidStopLoading() override; | 32 void DidStopLoading() override; |
32 | 33 |
33 // Clears any network activity state associated with this activity. | 34 // Clears any network activity state associated with this activity. |
34 void Stop(); | 35 void Stop(); |
35 | 36 |
36 // Key used to uniquely identify this activity. | 37 // Key used to uniquely identify this activity. |
37 base::scoped_nsobject<NSString> network_activity_key_; | 38 base::scoped_nsobject<NSString> network_activity_key_; |
38 | 39 |
39 DISALLOW_COPY_AND_ASSIGN(NetworkActivityIndicatorTabHelper); | 40 DISALLOW_COPY_AND_ASSIGN(NetworkActivityIndicatorTabHelper); |
40 }; | 41 }; |
41 | 42 |
42 #endif // IOS_CHROME_BROWSER_WEB_NETWORK_ACTIVITY_INDICATOR_TAB_HELPER_H_ | 43 #endif // IOS_CHROME_BROWSER_WEB_NETWORK_ACTIVITY_INDICATOR_TAB_HELPER_H_ |
OLD | NEW |