OLD | NEW |
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 #include "chrome/browser/extensions/api/identity/identity_api.h" | 5 #include "chrome/browser/extensions/api/identity/identity_api.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/common/extensions/api/identity.h" | 26 #include "chrome/common/extensions/api/identity.h" |
27 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" | 27 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" |
28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
29 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
30 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 30 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
31 #include "components/signin/core/browser/signin_manager.h" | 31 #include "components/signin/core/browser/signin_manager.h" |
32 #include "components/signin/core/common/profile_management_switches.h" | 32 #include "components/signin/core/common/profile_management_switches.h" |
33 #include "extensions/browser/event_router.h" | 33 #include "extensions/browser/event_router.h" |
34 #include "extensions/browser/extension_function_dispatcher.h" | 34 #include "extensions/browser/extension_function_dispatcher.h" |
35 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
| 36 #include "extensions/common/extension_l10n_util.h" |
36 #include "extensions/common/permissions/permission_set.h" | 37 #include "extensions/common/permissions/permission_set.h" |
37 #include "extensions/common/permissions/permissions_data.h" | 38 #include "extensions/common/permissions/permissions_data.h" |
38 #include "google_apis/gaia/gaia_urls.h" | 39 #include "google_apis/gaia/gaia_urls.h" |
39 #include "url/gurl.h" | 40 #include "url/gurl.h" |
40 | 41 |
41 #if defined(OS_CHROMEOS) | 42 #if defined(OS_CHROMEOS) |
42 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 43 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
43 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 44 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
44 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 45 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
45 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 46 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 mint_token_flow_->Start(); | 768 mint_token_flow_->Start(); |
768 } | 769 } |
769 | 770 |
770 void IdentityGetAuthTokenFunction::ShowLoginPopup() { | 771 void IdentityGetAuthTokenFunction::ShowLoginPopup() { |
771 signin_flow_.reset(new IdentitySigninFlow(this, GetProfile())); | 772 signin_flow_.reset(new IdentitySigninFlow(this, GetProfile())); |
772 signin_flow_->Start(); | 773 signin_flow_->Start(); |
773 } | 774 } |
774 | 775 |
775 void IdentityGetAuthTokenFunction::ShowOAuthApprovalDialog( | 776 void IdentityGetAuthTokenFunction::ShowOAuthApprovalDialog( |
776 const IssueAdviceInfo& issue_advice) { | 777 const IssueAdviceInfo& issue_advice) { |
777 const std::string locale = g_browser_process->local_state()->GetString( | 778 const std::string locale = extension_l10n_util::CurrentLocaleOrDefault(); |
778 prefs::kApplicationLocale); | |
779 | 779 |
780 gaia_web_auth_flow_.reset(new GaiaWebAuthFlow( | 780 gaia_web_auth_flow_.reset(new GaiaWebAuthFlow( |
781 this, GetProfile(), token_key_.get(), oauth2_client_id_, locale)); | 781 this, GetProfile(), token_key_.get(), oauth2_client_id_, locale)); |
782 gaia_web_auth_flow_->Start(); | 782 gaia_web_auth_flow_->Start(); |
783 } | 783 } |
784 | 784 |
785 OAuth2MintTokenFlow* IdentityGetAuthTokenFunction::CreateMintTokenFlow( | 785 OAuth2MintTokenFlow* IdentityGetAuthTokenFunction::CreateMintTokenFlow( |
786 const std::string& login_access_token) { | 786 const std::string& login_access_token) { |
787 OAuth2MintTokenFlow* mint_token_flow = new OAuth2MintTokenFlow( | 787 OAuth2MintTokenFlow* mint_token_flow = new OAuth2MintTokenFlow( |
788 GetProfile()->GetRequestContext(), | 788 GetProfile()->GetRequestContext(), |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( | 943 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( |
944 const GURL& redirect_url) { | 944 const GURL& redirect_url) { |
945 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { | 945 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { |
946 SetResult(new base::StringValue(redirect_url.spec())); | 946 SetResult(new base::StringValue(redirect_url.spec())); |
947 SendResponse(true); | 947 SendResponse(true); |
948 Release(); // Balanced in RunAsync. | 948 Release(); // Balanced in RunAsync. |
949 } | 949 } |
950 } | 950 } |
951 | 951 |
952 } // namespace extensions | 952 } // namespace extensions |
OLD | NEW |