| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_LAUNCH_WEB_AUTH_FLOW_FUN
CTION_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_LAUNCH_WEB_AUTH_FLOW_FUN
CTION_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "chrome/browser/extensions/api/identity/web_auth_flow.h" |
| 11 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 12 #include "extensions/browser/extension_function_histogram_value.h" |
| 13 |
| 14 namespace extensions { |
| 15 |
| 16 class IdentityLaunchWebAuthFlowFunction : public ChromeAsyncExtensionFunction, |
| 17 public WebAuthFlow::Delegate { |
| 18 public: |
| 19 DECLARE_EXTENSION_FUNCTION("identity.launchWebAuthFlow", |
| 20 EXPERIMENTAL_IDENTITY_LAUNCHWEBAUTHFLOW); |
| 21 |
| 22 IdentityLaunchWebAuthFlowFunction(); |
| 23 |
| 24 // Tests may override extension_id. |
| 25 void InitFinalRedirectURLPrefixForTest(const std::string& extension_id); |
| 26 |
| 27 private: |
| 28 ~IdentityLaunchWebAuthFlowFunction() override; |
| 29 bool RunAsync() override; |
| 30 |
| 31 // WebAuthFlow::Delegate implementation. |
| 32 void OnAuthFlowFailure(WebAuthFlow::Failure failure) override; |
| 33 void OnAuthFlowURLChange(const GURL& redirect_url) override; |
| 34 void OnAuthFlowTitleChange(const std::string& title) override {} |
| 35 |
| 36 // Helper to initialize final URL prefix. |
| 37 void InitFinalRedirectURLPrefix(const std::string& extension_id); |
| 38 |
| 39 std::unique_ptr<WebAuthFlow> auth_flow_; |
| 40 GURL final_url_prefix_; |
| 41 }; |
| 42 |
| 43 } // namespace extensions |
| 44 |
| 45 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_LAUNCH_WEB_AUTH_FLOW_
FUNCTION_H_ |
| OLD | NEW |