| 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" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 app_id); | 66 app_id); |
| 67 publish_proto->set_strategy(copresence::AGGRESSIVE); | 67 publish_proto->set_strategy(copresence::AGGRESSIVE); |
| 68 | 68 |
| 69 if (publish.strategies.get()) { | 69 if (publish.strategies.get()) { |
| 70 copresence::BroadcastScanConfiguration config = | 70 copresence::BroadcastScanConfiguration config = |
| 71 TranslateStrategy(*publish.strategies); | 71 TranslateStrategy(*publish.strategies); |
| 72 if (config != copresence::BROADCAST_SCAN_CONFIGURATION_UNKNOWN) { | 72 if (config != copresence::BROADCAST_SCAN_CONFIGURATION_UNKNOWN) { |
| 73 copresence::TokenExchangeStrategy* strategy_proto = | 73 copresence::TokenExchangeStrategy* strategy_proto = |
| 74 publish_proto->mutable_token_exchange_strategy(); | 74 publish_proto->mutable_token_exchange_strategy(); |
| 75 strategy_proto->set_broadcast_scan_configuration(config); | 75 strategy_proto->set_broadcast_scan_configuration(config); |
| 76 if (publish.strategies->audible && *publish.strategies->audible) |
| 77 strategy_proto->set_use_audible(true); |
| 76 } | 78 } |
| 77 } | 79 } |
| 78 | 80 |
| 79 DVLOG(2) << "Publishing message of type " << publish.message.type << ":\n" | 81 DVLOG(2) << "Publishing message of type " << publish.message.type << ":\n" |
| 80 << publish.message.payload; | 82 << publish.message.payload; |
| 81 // TODO(ckehoe): Validate that required fields are non-empty, etc. | 83 // TODO(ckehoe): Validate that required fields are non-empty, etc. |
| 82 return true; | 84 return true; |
| 83 } | 85 } |
| 84 | 86 |
| 85 // Adds an unpublish operation to the report request. Returns false if the | 87 // Adds an unpublish operation to the report request. Returns false if the |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 apps_by_subscription_id, | 216 apps_by_subscription_id, |
| 215 request)) | 217 request)) |
| 216 return false; | 218 return false; |
| 217 } | 219 } |
| 218 } | 220 } |
| 219 | 221 |
| 220 return true; | 222 return true; |
| 221 } | 223 } |
| 222 | 224 |
| 223 } // namespace extensions | 225 } // namespace extensions |
| OLD | NEW |