Index: chrome/browser/extensions/api/identity/identity_api.cc |
=================================================================== |
--- chrome/browser/extensions/api/identity/identity_api.cc (revision 176209) |
+++ chrome/browser/extensions/api/identity/identity_api.cc (working copy) |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/extensions/api/identity/identity_api.h" |
+#include "base/lazy_instance.h" |
#include "base/values.h" |
#include "chrome/common/extensions/api/experimental_identity.h" |
#include "chrome/browser/extensions/extension_install_prompt.h" |
@@ -17,7 +18,9 @@ |
#include "chrome/browser/ui/webui/signin/login_ui_service.h" |
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
+#include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" |
#include "chrome/common/extensions/extension.h" |
+#include "chrome/common/extensions/extension_manifest_constants.h" |
#include "chrome/common/url_constants.h" |
#include "content/public/common/page_transition_types.h" |
#include "googleurl/src/gurl.h" |
@@ -50,15 +53,16 @@ |
if (params->details.get() && params->details->interactive.get()) |
interactive_ = *params->details->interactive; |
- const Extension::OAuth2Info& oauth2_info = GetExtension()->oauth2_info(); |
+ const extensions::OAuth2Info* oauth2_info = |
Devlin
2013/01/14 20:18:34
You're in the extensions namespace - you don't nee
SanjoyPal
2013/01/16 19:10:52
Done.
|
+ OAuth2Info::GetOAuth2Info(GetExtension()); |
// Check that the necessary information is present in the manfist. |
- if (oauth2_info.client_id.empty()) { |
+ if (oauth2_info->client_id.empty()) { |
error_ = identity_constants::kInvalidClientId; |
return false; |
} |
- if (oauth2_info.scopes.size() == 0) { |
+ if (oauth2_info->scopes.size() == 0) { |
error_ = identity_constants::kInvalidScopes; |
return false; |
} |
@@ -183,7 +187,8 @@ |
OAuth2MintTokenFlow* IdentityGetAuthTokenFunction::CreateMintTokenFlow( |
OAuth2MintTokenFlow::Mode mode) { |
- const Extension::OAuth2Info& oauth2_info = GetExtension()->oauth2_info(); |
+ const extensions::OAuth2Info* oauth2_info = |
+ OAuth2Info::GetOAuth2Info(GetExtension()); |
TokenService* token_service = TokenServiceFactory::GetForProfile(profile()); |
return new OAuth2MintTokenFlow( |
profile()->GetRequestContext(), |
@@ -191,8 +196,8 @@ |
OAuth2MintTokenFlow::Parameters( |
token_service->GetOAuth2LoginRefreshToken(), |
GetExtension()->id(), |
- oauth2_info.client_id, |
- oauth2_info.scopes, |
+ oauth2_info->client_id, |
+ oauth2_info->scopes, |
mode)); |
} |
@@ -252,4 +257,20 @@ |
Release(); // Balanced in RunImpl. |
} |
+IdentityAPI::IdentityAPI(Profile* profile) { |
+ ManifestHandler::Register(extension_manifest_keys::kOAuth2, |
Devlin
2013/01/14 20:18:34
Include what you use - c/c/e/manifest_handler.h.
SanjoyPal
2013/01/16 19:10:52
Done.
|
+ new OAuth2ManifestHandler); |
+} |
+ |
+IdentityAPI::~IdentityAPI() { |
+} |
+ |
+static base::LazyInstance<ProfileKeyedAPIFactory<IdentityAPI> > |
+g_factory = LAZY_INSTANCE_INITIALIZER; |
Devlin
2013/01/14 20:18:34
Indentation.
SanjoyPal
2013/01/16 19:10:52
Done.
|
+ |
+// static |
+ProfileKeyedAPIFactory<IdentityAPI>* IdentityAPI::GetFactoryInstance() { |
+ return &g_factory.Get(); |
+} |
+ |
} // namespace extensions |