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 REMOTING_IOS_HOST_REFRESH_H_
6#define REMOTING_IOS_HOST_REFRESH_H_
7
8#import <Foundation/Foundation.h>
9
10#import "GTMOAuth2Authentication.h"
11
12// HostRefresh encapsulates a fetch of the Chromoting host list from
13// the jabber service.
14
15// Contract to handle the host list result of a Chromoting host list fetch.
16@protocol HostRefreshDelegate<NSObject>
17
18- (void)hostListRefresh:(NSArray*)hostList errorMessage:(NSString*)errorMessage;
19
20@end
21
22// Fetches the host list from the jabber service async.  Authenticates,
23// and parses the results to provide to a HostListViewController
24@interface HostRefresh : NSObject<NSURLConnectionDataDelegate>
25
26// Store data read while the connection is active, and can be used after the
27// connection has been discarded
28@property(nonatomic, copy) NSMutableData* jsonData;
29@property(nonatomic, copy) NSString* errorMessage;
30@property(nonatomic, assign) id<HostRefreshDelegate> delegate;
31
32- (void)refreshHostList:(GTMOAuth2Authentication*)authReq
33               delegate:(id<HostRefreshDelegate>)delegate;
34
35@end
36
37#endif  // REMOTING_IOS_HOST_REFRESH_H_
38