OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/copresence/copresence_api.h" | 5 #include "chrome/browser/extensions/api/copresence/copresence_api.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/copresence/chrome_whispernet_client.h" | 10 #include "chrome/browser/copresence/chrome_whispernet_client.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 12 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
13 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 13 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
14 #include "chrome/common/chrome_version_info.h" | 14 #include "chrome/common/channel_info.h" |
15 #include "chrome/common/extensions/api/copresence.h" | 15 #include "chrome/common/extensions/api/copresence.h" |
16 #include "chrome/common/extensions/manifest_handlers/copresence_manifest.h" | 16 #include "chrome/common/extensions/manifest_handlers/copresence_manifest.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "components/copresence/copresence_manager_impl.h" | 18 #include "components/copresence/copresence_manager_impl.h" |
19 #include "components/copresence/proto/data.pb.h" | 19 #include "components/copresence/proto/data.pb.h" |
20 #include "components/copresence/proto/enums.pb.h" | 20 #include "components/copresence/proto/enums.pb.h" |
21 #include "components/copresence/proto/rpcs.pb.h" | 21 #include "components/copresence/proto/rpcs.pb.h" |
22 #include "components/pref_registry/pref_registry_syncable.h" | 22 #include "components/pref_registry/pref_registry_syncable.h" |
23 #include "content/public/browser/browser_context.h" | 23 #include "content/public/browser/browser_context.h" |
24 #include "extensions/browser/event_router.h" | 24 #include "extensions/browser/event_router.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 browser_context_)); | 166 browser_context_)); |
167 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); | 167 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); |
168 DVLOG(2) << "Sent Audio Failed status update."; | 168 DVLOG(2) << "Sent Audio Failed status update."; |
169 } | 169 } |
170 | 170 |
171 net::URLRequestContextGetter* CopresenceService::GetRequestContext() const { | 171 net::URLRequestContextGetter* CopresenceService::GetRequestContext() const { |
172 return browser_context_->GetRequestContext(); | 172 return browser_context_->GetRequestContext(); |
173 } | 173 } |
174 | 174 |
175 const std::string CopresenceService::GetPlatformVersionString() const { | 175 const std::string CopresenceService::GetPlatformVersionString() const { |
176 return chrome::VersionInfo().CreateVersionString(); | 176 return chrome::GetVersionString(); |
177 } | 177 } |
178 | 178 |
179 const std::string | 179 const std::string |
180 CopresenceService::GetAPIKey(const std::string& app_id) const { | 180 CopresenceService::GetAPIKey(const std::string& app_id) const { |
181 // Check first if the app has set its key via the API. | 181 // Check first if the app has set its key via the API. |
182 const auto& key = api_keys_by_app_.find(app_id); | 182 const auto& key = api_keys_by_app_.find(app_id); |
183 if (key != api_keys_by_app_.end()) | 183 if (key != api_keys_by_app_.end()) |
184 return key->second; | 184 return key->second; |
185 | 185 |
186 // If no key was found, look in the manifest. | 186 // If no key was found, look in the manifest. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 scoped_ptr<SetAuthToken::Params> params(SetAuthToken::Params::Create(*args_)); | 294 scoped_ptr<SetAuthToken::Params> params(SetAuthToken::Params::Create(*args_)); |
295 EXTENSION_FUNCTION_VALIDATE(params.get()); | 295 EXTENSION_FUNCTION_VALIDATE(params.get()); |
296 | 296 |
297 // The token may be set to empty, to clear it. | 297 // The token may be set to empty, to clear it. |
298 CopresenceService::GetFactoryInstance()->Get(browser_context()) | 298 CopresenceService::GetFactoryInstance()->Get(browser_context()) |
299 ->set_auth_token(extension_id(), params->token); | 299 ->set_auth_token(extension_id(), params->token); |
300 return RespondNow(NoArguments()); | 300 return RespondNow(NoArguments()); |
301 } | 301 } |
302 | 302 |
303 } // namespace extensions | 303 } // namespace extensions |
OLD | NEW |