| 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 static void CreateForWebState(web::WebState* web_state, NSString* tab_id); | 23 static void CreateForWebState(web::WebState* web_state, NSString* tab_id); |
| 24 | 24 |
| 25 private: | 25 private: |
| 26 NetworkActivityIndicatorTabHelper(web::WebState* web_state, NSString* tab_id); | 26 NetworkActivityIndicatorTabHelper(web::WebState* web_state, NSString* tab_id); |
| 27 ~NetworkActivityIndicatorTabHelper() override; | 27 ~NetworkActivityIndicatorTabHelper() override; |
| 28 | 28 |
| 29 // Clears any network activity state associated with this activity. |
| 30 void Stop(); |
| 31 |
| 29 // web::WebStateObserver overrides: | 32 // web::WebStateObserver overrides: |
| 30 void DidStartLoading() override; | 33 void DidStartLoading() override; |
| 31 void DidStopLoading() override; | 34 void DidStopLoading() override; |
| 32 | 35 |
| 33 // Key used to uniquely identify this activity. | 36 // Key used to uniquely identify this activity. |
| 34 base::scoped_nsobject<NSString> network_activity_key_; | 37 base::scoped_nsobject<NSString> network_activity_key_; |
| 35 | 38 |
| 36 DISALLOW_COPY_AND_ASSIGN(NetworkActivityIndicatorTabHelper); | 39 DISALLOW_COPY_AND_ASSIGN(NetworkActivityIndicatorTabHelper); |
| 37 }; | 40 }; |
| 38 | 41 |
| 39 #endif // IOS_CHROME_BROWSER_WEB_NETWORK_ACTIVITY_INDICATOR_TAB_HELPER_H_ | 42 #endif // IOS_CHROME_BROWSER_WEB_NETWORK_ACTIVITY_INDICATOR_TAB_HELPER_H_ |
| OLD | NEW |