OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 IOS_CHROME_BROWSER_WEB_AUTO_RELOAD_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_WEB_AUTO_RELOAD_CONTROLLER_H_ |
| 7 |
| 8 #include <Foundation/Foundation.h> |
| 9 |
| 10 #include "url/gurl.h" |
| 11 |
| 12 // AutoReloadDelegate is the interface by which AutoReloadController affects the |
| 13 // outside world. Tests can use a mock object implementing this protocol; |
| 14 // normally, this is provided by AutoReloadBridge. |
| 15 @protocol AutoReloadDelegate |
| 16 |
| 17 // When called, this method should reload the tab being tracked (see the class |
| 18 // comment on AutoReloadController below). |
| 19 - (void)reload; |
| 20 |
| 21 @end |
| 22 |
| 23 // AutoReloadController implements the auto-reload logic. An |
| 24 // AutoReloadController instance receives state change notifications from an |
| 25 // AutoReloadBridge and calls back to its AutoReloadDelegate (in practice the |
| 26 // same object as the AutoReloadBridge) to issue reload requests. Conceptually, |
| 27 // an AutoReloadController tracks the state of a single tab. |
| 28 @interface AutoReloadController : NSObject |
| 29 |
| 30 // Initialize this object with a supplied delegate and initial online status. |
| 31 - (instancetype)initWithDelegate:(id<AutoReloadDelegate>)delegate |
| 32 onlineStatus:(BOOL)onlineStatus; |
| 33 |
| 34 // This method notifies this object that a page load started for |url|. |
| 35 - (void)loadStartedForURL:(const GURL&)url; |
| 36 |
| 37 // This method notifies this object that a page load finished for |url|. |
| 38 - (void)loadFinishedForURL:(const GURL&)url wasPost:(BOOL)wasPost; |
| 39 |
| 40 // This method notifies this object that a page load failed for |url|. |
| 41 - (void)loadFailedForURL:(const GURL&)url wasPost:(BOOL)wasPost; |
| 42 |
| 43 // This method notifies this object that the device's network state changed to |
| 44 // |online|. |
| 45 - (void)networkStateChangedToOnline:(BOOL)online; |
| 46 |
| 47 @end |
| 48 |
| 49 #endif // IOS_CHROME_BROWSER_WEB_AUTO_RELOAD_CONTROLLER_H_ |
OLD | NEW |