Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/browser/extensions/api/identity/identity_api.h

Issue 2654023005: Move impl of identity.LaunchWebAuthFlow() extension API to its own file (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "chrome/browser/extensions/api/identity/extension_token_key.h" 19 #include "chrome/browser/extensions/api/identity/extension_token_key.h"
20 #include "chrome/browser/extensions/api/identity/gaia_web_auth_flow.h" 20 #include "chrome/browser/extensions/api/identity/gaia_web_auth_flow.h"
21 #include "chrome/browser/extensions/api/identity/identity_launch_web_auth_flow_f unction.h"
21 #include "chrome/browser/extensions/api/identity/identity_mint_queue.h" 22 #include "chrome/browser/extensions/api/identity/identity_mint_queue.h"
22 #include "chrome/browser/extensions/api/identity/identity_signin_flow.h" 23 #include "chrome/browser/extensions/api/identity/identity_signin_flow.h"
23 #include "chrome/browser/extensions/api/identity/web_auth_flow.h" 24 #include "chrome/browser/extensions/api/identity/web_auth_flow.h"
24 #include "chrome/browser/extensions/chrome_extension_function.h" 25 #include "chrome/browser/extensions/chrome_extension_function.h"
25 #include "components/signin/core/browser/profile_identity_provider.h" 26 #include "components/signin/core/browser/profile_identity_provider.h"
26 #include "extensions/browser/browser_context_keyed_api_factory.h" 27 #include "extensions/browser/browser_context_keyed_api_factory.h"
27 #include "google_apis/gaia/account_tracker.h" 28 #include "google_apis/gaia/account_tracker.h"
28 #include "google_apis/gaia/oauth2_mint_token_flow.h" 29 #include "google_apis/gaia/oauth2_mint_token_flow.h"
29 #include "google_apis/gaia/oauth2_token_service.h" 30 #include "google_apis/gaia/oauth2_token_service.h"
30 31
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 EXPERIMENTAL_IDENTITY_REMOVECACHEDAUTHTOKEN) 325 EXPERIMENTAL_IDENTITY_REMOVECACHEDAUTHTOKEN)
325 IdentityRemoveCachedAuthTokenFunction(); 326 IdentityRemoveCachedAuthTokenFunction();
326 327
327 protected: 328 protected:
328 ~IdentityRemoveCachedAuthTokenFunction() override; 329 ~IdentityRemoveCachedAuthTokenFunction() override;
329 330
330 // ExtensionFunction: 331 // ExtensionFunction:
331 ResponseAction Run() override; 332 ResponseAction Run() override;
332 }; 333 };
333 334
334 class IdentityLaunchWebAuthFlowFunction : public ChromeAsyncExtensionFunction,
335 public WebAuthFlow::Delegate {
336 public:
337 DECLARE_EXTENSION_FUNCTION("identity.launchWebAuthFlow",
338 EXPERIMENTAL_IDENTITY_LAUNCHWEBAUTHFLOW);
339
340 IdentityLaunchWebAuthFlowFunction();
341
342 // Tests may override extension_id.
343 void InitFinalRedirectURLPrefixForTest(const std::string& extension_id);
344
345 private:
346 ~IdentityLaunchWebAuthFlowFunction() override;
347 bool RunAsync() override;
348
349 // WebAuthFlow::Delegate implementation.
350 void OnAuthFlowFailure(WebAuthFlow::Failure failure) override;
351 void OnAuthFlowURLChange(const GURL& redirect_url) override;
352 void OnAuthFlowTitleChange(const std::string& title) override {}
353
354 // Helper to initialize final URL prefix.
355 void InitFinalRedirectURLPrefix(const std::string& extension_id);
356
357 std::unique_ptr<WebAuthFlow> auth_flow_;
358 GURL final_url_prefix_;
359 };
360
361 } // namespace extensions 335 } // namespace extensions
362 336
363 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ 337 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/BUILD.gn ('k') | chrome/browser/extensions/api/identity/identity_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698