Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / ios / chrome / browser / signin / gaia_auth_fetcher_ios_private.h
blobe77e6a389e5a1b0b12e946e6191915775df5126a
1 // Copyright 2015 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.
5 #ifndef IOS_CHROME_BROWSER_SIGNIN_GAIA_AUTH_FETCHER_IOS_PRIVATE_H_
6 #define IOS_CHROME_BROWSER_SIGNIN_GAIA_AUTH_FETCHER_IOS_PRIVATE_H_
8 #import <Webkit/Webkit.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "base/macros.h"
13 class GaiaAuthFetcherIOS;
14 class GURL;
16 namespace web {
17 class BrowserState;
20 // Navigation delegate attached to a WKWebView used for URL fetches.
21 @interface GaiaAuthFetcherNavigationDelegate : NSObject<WKNavigationDelegate>
22 @end
24 // Bridge between the GaiaAuthFetcherIOS and the webview (and its navigation
25 // delegate) used to actually do the network fetch.
26 class GaiaAuthFetcherIOSBridge {
27 public:
28 GaiaAuthFetcherIOSBridge(GaiaAuthFetcherIOS* fetcher,
29 web::BrowserState* browser_state);
30 ~GaiaAuthFetcherIOSBridge();
32 // Starts a network fetch.
33 // * |url| is the URL to fetch.
34 // * |headers| are the HTTP headers to add to the request.
35 // * |body| is the HTTP body to add to the request. If not empty, the fetch
36 // will be a POST request.
37 void Fetch(const GURL& url,
38 const std::string& headers,
39 const std::string& body);
41 // Cancels the current fetch.
42 void Cancel();
44 // Informs the bridge of the success of the URL fetch.
45 // * |data| is the body of the HTTP response.
46 // URLFetchSuccess and URLFetchFailure are no-op if one of them was already
47 // called.
48 void URLFetchSuccess(const std::string& data);
50 // Informs the bridge of the failure of the URL fetch.
51 // * |is_cancelled| whether the fetch failed because it was cancelled.
52 // URLFetchSuccess and URLFetchFailure are no-op if one of them was already
53 // called.
54 void URLFetchFailure(bool is_cancelled);
56 private:
57 friend class GaiaAuthFetcherIOSTest;
59 bool fetch_pending_;
60 GaiaAuthFetcherIOS* fetcher_;
61 GURL url_;
62 base::scoped_nsobject<GaiaAuthFetcherNavigationDelegate> navigation_delegate_;
63 base::scoped_nsobject<WKWebView> web_view_;
65 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcherIOSBridge);
68 #endif // IOS_CHROME_BROWSER_SIGNIN_GAIA_AUTH_FETCHER_IOS_PRIVATE_H_