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

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

Issue 2661913002: Identity extension API impl: Split constants into their own file (Closed)
Patch Set: Created 3 years, 10 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 #include "chrome/browser/extensions/api/identity/identity_api.h" 5 #include "chrome/browser/extensions/api/identity/identity_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/trace_event/trace_event.h" 20 #include "base/trace_event/trace_event.h"
21 #include "base/values.h" 21 #include "base/values.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "chrome/browser/app_mode/app_mode_utils.h" 23 #include "chrome/browser/app_mode/app_mode_utils.h"
24 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/chrome_notification_types.h" 25 #include "chrome/browser/chrome_notification_types.h"
26 #include "chrome/browser/extensions/api/identity/identity_constants.h"
26 #include "chrome/browser/extensions/extension_service.h" 27 #include "chrome/browser/extensions/extension_service.h"
27 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/signin/account_tracker_service_factory.h" 29 #include "chrome/browser/signin/account_tracker_service_factory.h"
29 #include "chrome/browser/signin/chrome_signin_client_factory.h" 30 #include "chrome/browser/signin/chrome_signin_client_factory.h"
30 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 31 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
31 #include "chrome/browser/signin/signin_manager_factory.h" 32 #include "chrome/browser/signin/signin_manager_factory.h"
32 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 33 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
33 #include "chrome/common/extensions/api/identity.h" 34 #include "chrome/common/extensions/api/identity.h"
34 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
35 #include "components/signin/core/browser/account_tracker_service.h" 36 #include "components/signin/core/browser/account_tracker_service.h"
(...skipping 14 matching lines...) Expand all
50 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 51 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
51 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 52 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
52 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" 53 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
53 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " 54 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h "
54 #include "components/user_manager/user_manager.h" 55 #include "components/user_manager/user_manager.h"
55 #include "google_apis/gaia/gaia_constants.h" 56 #include "google_apis/gaia/gaia_constants.h"
56 #endif 57 #endif
57 58
58 namespace extensions { 59 namespace extensions {
59 60
60 namespace identity_constants {
61 const char kInvalidClientId[] = "Invalid OAuth2 Client ID.";
62 const char kInvalidScopes[] = "Invalid OAuth2 scopes.";
63 const char kAuthFailure[] = "OAuth2 request failed: ";
64 const char kNoGrant[] = "OAuth2 not granted or revoked.";
65 const char kUserRejected[] = "The user did not approve access.";
66 const char kUserNotSignedIn[] = "The user is not signed in.";
67 const char kInteractionRequired[] = "User interaction required.";
68 const char kInvalidRedirect[] = "Did not redirect to the right URL.";
69 const char kOffTheRecord[] = "Identity API is disabled in incognito windows.";
70 const char kPageLoadFailure[] = "Authorization page could not be loaded.";
71 const char kCanceled[] = "canceled";
72
73 const int kCachedIssueAdviceTTLSeconds = 1;
74 } // namespace identity_constants
75
76 namespace { 61 namespace {
77 62
78 #if defined(OS_CHROMEOS) 63 #if defined(OS_CHROMEOS)
79 // The list of apps that are allowed to use the Identity API to retrieve the 64 // The list of apps that are allowed to use the Identity API to retrieve the
80 // token from the device robot account in a public session. 65 // token from the device robot account in a public session.
81 const char* const kPublicSessionAllowedOrigins[] = { 66 const char* const kPublicSessionAllowedOrigins[] = {
82 // Chrome Remote Desktop - Chromium branding. 67 // Chrome Remote Desktop - Chromium branding.
83 "chrome-extension://ljacajndfccfgnfohlgkdphmbnpkjflk/", 68 "chrome-extension://ljacajndfccfgnfohlgkdphmbnpkjflk/",
84 // Chrome Remote Desktop - Official branding. 69 // Chrome Remote Desktop - Official branding.
85 "chrome-extension://gbchcmhmhahfdphkhkmpfmihenigjmpp/"}; 70 "chrome-extension://gbchcmhmhahfdphkhkmpfmihenigjmpp/"};
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 if (extension()->permissions_data()->HasAPIPermission( 898 if (extension()->permissions_data()->HasAPIPermission(
914 APIPermission::kIdentityEmail)) { 899 APIPermission::kIdentityEmail)) {
915 profile_user_info.email = account.email; 900 profile_user_info.email = account.email;
916 profile_user_info.id = account.gaia; 901 profile_user_info.id = account.gaia;
917 } 902 }
918 903
919 return RespondNow(OneArgument(profile_user_info.ToValue())); 904 return RespondNow(OneArgument(profile_user_info.ToValue()));
920 } 905 }
921 906
922 } // namespace extensions 907 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/identity/identity_api.h ('k') | chrome/browser/extensions/api/identity/identity_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698