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/webstore_private/webstore_private_api.h" | 5 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 "You cannot specify both icon data and an icon url"; | 96 "You cannot specify both icon data and an icon url"; |
97 const char kInvalidIconUrlError[] = "Invalid icon url"; | 97 const char kInvalidIconUrlError[] = "Invalid icon url"; |
98 const char kInvalidIdError[] = "Invalid id"; | 98 const char kInvalidIdError[] = "Invalid id"; |
99 const char kInvalidManifestError[] = "Invalid manifest"; | 99 const char kInvalidManifestError[] = "Invalid manifest"; |
100 const char kNoPreviousBeginInstallWithManifestError[] = | 100 const char kNoPreviousBeginInstallWithManifestError[] = |
101 "* does not match a previous call to beginInstallWithManifest3"; | 101 "* does not match a previous call to beginInstallWithManifest3"; |
102 const char kUserCancelledError[] = "User cancelled install"; | 102 const char kUserCancelledError[] = "User cancelled install"; |
103 | 103 |
104 ProfileSyncService* test_sync_service = NULL; | 104 ProfileSyncService* test_sync_service = NULL; |
105 | 105 |
106 // Returns either the test sync service, or the real one from |profile|. | |
107 ProfileSyncService* GetSyncService(Profile* profile) { | |
108 // TODO(webstore): It seems |test_sync_service| is not used anywhere. It | |
109 // should be removed. | |
110 if (test_sync_service) | |
111 return test_sync_service; | |
112 else | |
113 return ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | |
114 } | |
115 | |
116 // Helper to create a dictionary with login and token properties set from | 106 // Helper to create a dictionary with login and token properties set from |
117 // the appropriate values in the passed-in |profile|. | 107 // the appropriate values in the passed-in |profile|. |
118 DictionaryValue* CreateLoginResult(Profile* profile) { | 108 DictionaryValue* CreateLoginResult(Profile* profile) { |
119 DictionaryValue* dictionary = new DictionaryValue(); | 109 DictionaryValue* dictionary = new DictionaryValue(); |
120 std::string username = profile->GetPrefs()->GetString( | 110 std::string username = profile->GetPrefs()->GetString( |
121 prefs::kGoogleServicesUsername); | 111 prefs::kGoogleServicesUsername); |
122 dictionary->SetString(kLoginKey, username); | 112 dictionary->SetString(kLoginKey, username); |
123 if (!username.empty()) { | 113 if (!username.empty()) { |
124 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 114 CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
125 TokenService* token_service = TokenServiceFactory::GetForProfile(profile); | 115 TokenService* token_service = TokenServiceFactory::GetForProfile(profile); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 feature_checker_->CheckGPUFeatureAvailability(); | 509 feature_checker_->CheckGPUFeatureAvailability(); |
520 return true; | 510 return true; |
521 } | 511 } |
522 | 512 |
523 void GetWebGLStatusFunction::OnFeatureCheck(bool feature_allowed) { | 513 void GetWebGLStatusFunction::OnFeatureCheck(bool feature_allowed) { |
524 CreateResult(feature_allowed); | 514 CreateResult(feature_allowed); |
525 SendResponse(true); | 515 SendResponse(true); |
526 } | 516 } |
527 | 517 |
528 } // namespace extensions | 518 } // namespace extensions |
OLD | NEW |