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

Side by Side Diff: chrome/browser/extensions/api/copresence/copresence_translations.cc

Issue 637223011: Redesign the copresence audio handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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 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; 12 using copresence::AUDIO_CONFIGURATION_AUDIBLE;
13 using copresence::AUDIO_CONFIGURATION_UNKNOWN; 13 using copresence::AUDIO_CONFIGURATION_UNKNOWN;
14 using copresence::BROADCAST_AND_SCAN; 14 using copresence::BROADCAST_AND_SCAN;
15 using copresence::BROADCAST_ONLY; 15 using copresence::BROADCAST_ONLY;
16 using copresence::BROADCAST_SCAN_CONFIGURATION_UNKNOWN; 16 using copresence::BROADCAST_SCAN_CONFIGURATION_UNKNOWN;
17 using copresence::BroadcastScanConfiguration; 17 using copresence::BroadcastScanConfiguration;
18 using copresence::ReportRequest; 18 using copresence::ReportRequest;
19 using copresence::SCAN_ONLY; 19 using copresence::SCAN_ONLY;
20 using copresence::TokenExchangeStrategy; 20 using copresence::TokenExchangeStrategy;
21 21
22 using extensions::api::copresence::Strategy; 22 using extensions::api::copresence::Strategy;
(...skipping 27 matching lines...) Expand all
50 // 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.
51 void SetTokenExchangeStrategy(const Strategy* strategy, 51 void SetTokenExchangeStrategy(const Strategy* strategy,
52 BroadcastScanConfiguration default_config, 52 BroadcastScanConfiguration default_config,
53 TokenExchangeStrategy* strategy_proto) { 53 TokenExchangeStrategy* strategy_proto) {
54 if (strategy) { 54 if (strategy) {
55 BroadcastScanConfiguration config = TranslateStrategy(*strategy); 55 BroadcastScanConfiguration config = TranslateStrategy(*strategy);
56 strategy_proto->set_broadcast_scan_configuration( 56 strategy_proto->set_broadcast_scan_configuration(
57 config == BROADCAST_SCAN_CONFIGURATION_UNKNOWN ? 57 config == BROADCAST_SCAN_CONFIGURATION_UNKNOWN ?
58 default_config : config); 58 default_config : config);
59 strategy_proto->set_audio_configuration( 59 strategy_proto->set_audio_configuration(
60 strategy->audible && *strategy->audible ? 60 strategy->audible && *strategy->audible ? AUDIO_CONFIGURATION_AUDIBLE
61 AUDIBLE : AUDIO_CONFIGURATION_UNKNOWN); 61 : AUDIO_CONFIGURATION_UNKNOWN);
62 } else { 62 } else {
63 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); 64 strategy_proto->set_audio_configuration(AUDIO_CONFIGURATION_UNKNOWN);
65 } 65 }
66 } 66 }
67 67
68 } // namespace 68 } // namespace
69 69
70 namespace extensions { 70 namespace extensions {
71 71
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 apps_by_subscription_id, 222 apps_by_subscription_id,
223 request)) 223 request))
224 return false; 224 return false;
225 } 225 }
226 } 226 }
227 227
228 return true; 228 return true;
229 } 229 }
230 230
231 } // namespace extensions 231 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698