| 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_translations.h" | 5 #include "chrome/browser/extensions/api/copresence/copresence_translations.h" |
| 6 | 6 |
| 7 #include "chrome/common/extensions/api/copresence.h" | 7 #include "chrome/common/extensions/api/copresence.h" |
| 8 #include "components/copresence/proto/data.pb.h" | 8 #include "components/copresence/proto/data.pb.h" |
| 9 #include "components/copresence/proto/enums.pb.h" | 9 #include "components/copresence/proto/enums.pb.h" |
| 10 #include "components/copresence/proto/rpcs.pb.h" | 10 #include "components/copresence/proto/rpcs.pb.h" |
| 11 | 11 |
| 12 using copresence::AUDIBLE; |
| 13 using copresence::AUDIO_CONFIGURATION_UNKNOWN; |
| 12 using copresence::BROADCAST_AND_SCAN; | 14 using copresence::BROADCAST_AND_SCAN; |
| 13 using copresence::BROADCAST_ONLY; | 15 using copresence::BROADCAST_ONLY; |
| 14 using copresence::BROADCAST_SCAN_CONFIGURATION_UNKNOWN; | 16 using copresence::BROADCAST_SCAN_CONFIGURATION_UNKNOWN; |
| 15 using copresence::BroadcastScanConfiguration; | 17 using copresence::BroadcastScanConfiguration; |
| 16 using copresence::ReportRequest; | 18 using copresence::ReportRequest; |
| 17 using copresence::SCAN_ONLY; | 19 using copresence::SCAN_ONLY; |
| 18 using copresence::TokenExchangeStrategy; | 20 using copresence::TokenExchangeStrategy; |
| 19 | 21 |
| 20 using extensions::api::copresence::Strategy; | 22 using extensions::api::copresence::Strategy; |
| 21 | 23 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 47 | 49 |
| 48 // The strategy may be null (unspecified), so we pass it as a pointer. | 50 // The strategy may be null (unspecified), so we pass it as a pointer. |
| 49 void SetTokenExchangeStrategy(const Strategy* strategy, | 51 void SetTokenExchangeStrategy(const Strategy* strategy, |
| 50 BroadcastScanConfiguration default_config, | 52 BroadcastScanConfiguration default_config, |
| 51 TokenExchangeStrategy* strategy_proto) { | 53 TokenExchangeStrategy* strategy_proto) { |
| 52 if (strategy) { | 54 if (strategy) { |
| 53 BroadcastScanConfiguration config = TranslateStrategy(*strategy); | 55 BroadcastScanConfiguration config = TranslateStrategy(*strategy); |
| 54 strategy_proto->set_broadcast_scan_configuration( | 56 strategy_proto->set_broadcast_scan_configuration( |
| 55 config == BROADCAST_SCAN_CONFIGURATION_UNKNOWN ? | 57 config == BROADCAST_SCAN_CONFIGURATION_UNKNOWN ? |
| 56 default_config : config); | 58 default_config : config); |
| 57 strategy_proto->set_use_audible(strategy->audible && *strategy->audible); | 59 strategy_proto->set_audio_configuration( |
| 60 strategy->audible && *strategy->audible ? |
| 61 AUDIBLE : AUDIO_CONFIGURATION_UNKNOWN); |
| 58 } else { | 62 } else { |
| 59 strategy_proto->set_broadcast_scan_configuration(default_config); | 63 strategy_proto->set_broadcast_scan_configuration(default_config); |
| 64 strategy_proto->set_audio_configuration(AUDIO_CONFIGURATION_UNKNOWN); |
| 60 } | 65 } |
| 61 } | 66 } |
| 62 | 67 |
| 63 } // namespace | 68 } // namespace |
| 64 | 69 |
| 65 namespace extensions { | 70 namespace extensions { |
| 66 | 71 |
| 67 using api::copresence::Operation; | 72 using api::copresence::Operation; |
| 68 | 73 |
| 69 // Adds a publish operation to the report request. Returns false if the | 74 // Adds a publish operation to the report request. Returns false if the |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 apps_by_subscription_id, | 222 apps_by_subscription_id, |
| 218 request)) | 223 request)) |
| 219 return false; | 224 return false; |
| 220 } | 225 } |
| 221 } | 226 } |
| 222 | 227 |
| 223 return true; | 228 return true; |
| 224 } | 229 } |
| 225 | 230 |
| 226 } // namespace extensions | 231 } // namespace extensions |
| OLD | NEW |