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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 extension_id_ = ext->id(); | 717 extension_id_ = ext->id(); |
718 oauth_scopes_ = std::set<std::string>(oauth2_info.scopes.begin(), | 718 oauth_scopes_ = std::set<std::string>(oauth2_info.scopes.begin(), |
719 oauth2_info.scopes.end()); | 719 oauth2_info.scopes.end()); |
720 return ext; | 720 return ext; |
721 } | 721 } |
722 | 722 |
723 IdentityAPI* id_api() { | 723 IdentityAPI* id_api() { |
724 return IdentityAPI::GetFactoryInstance()->Get(browser()->profile()); | 724 return IdentityAPI::GetFactoryInstance()->Get(browser()->profile()); |
725 } | 725 } |
726 | 726 |
727 const std::string GetPrimaryAccountId() { | 727 const std::string& GetPrimaryAccountId() { |
728 SigninManagerBase* signin_manager = | 728 SigninManagerBase* signin_manager = |
729 SigninManagerFactory::GetForProfile(browser()->profile()); | 729 SigninManagerFactory::GetForProfile(browser()->profile()); |
730 return signin_manager->GetAuthenticatedAccountId(); | 730 return signin_manager->GetAuthenticatedAccountId(); |
731 } | 731 } |
732 | 732 |
733 void SetCachedToken(const IdentityTokenCacheValue& token_data) { | 733 void SetCachedToken(const IdentityTokenCacheValue& token_data) { |
734 ExtensionTokenKey key(extension_id_, GetPrimaryAccountId(), oauth_scopes_); | 734 ExtensionTokenKey key(extension_id_, GetPrimaryAccountId(), oauth_scopes_); |
735 id_api()->SetCachedToken(key, token_data); | 735 id_api()->SetCachedToken(key, token_data); |
736 } | 736 } |
737 | 737 |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 1825 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
1826 url); | 1826 url); |
1827 } | 1827 } |
1828 | 1828 |
1829 } // namespace extensions | 1829 } // namespace extensions |
1830 | 1830 |
1831 // Tests the chrome.identity API implemented by custom JS bindings . | 1831 // Tests the chrome.identity API implemented by custom JS bindings . |
1832 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { | 1832 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { |
1833 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; | 1833 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; |
1834 } | 1834 } |
OLD | NEW |