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

Side by Side Diff: trunk/src/chrome/browser/extensions/api/audio/audio_api.cc

Issue 14655010: Revert 198556 "Implement the rest of the audio API." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/audio/audio_api.h" 5 #include "chrome/browser/extensions/api/audio/audio_api.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/event_names.h" 9 #include "chrome/browser/extensions/event_names.h"
10 #include "chrome/browser/extensions/event_router.h" 10 #include "chrome/browser/extensions/event_router.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 this)); 53 this));
54 return true; 54 return true;
55 } 55 }
56 56
57 void AudioGetInfoFunction::OnGetInfoCompleted(const OutputInfo& output_info, 57 void AudioGetInfoFunction::OnGetInfoCompleted(const OutputInfo& output_info,
58 const InputInfo& input_info, 58 const InputInfo& input_info,
59 bool success) { 59 bool success) {
60 if (success) 60 if (success)
61 results_ = api::audio::GetInfo::Results::Create(output_info, input_info); 61 results_ = api::audio::GetInfo::Results::Create(output_info, input_info);
62 else 62 else
63 SetError("Error occurred when querying audio device information."); 63 SetError("Error occured when querying audio device information.");
64 SendResponse(success); 64 SendResponse(success);
65 } 65 }
66 66
67 bool AudioSetActiveDevicesFunction::RunImpl() { 67 bool AudioSetActiveDevicesFunction::RunImpl() {
68 scoped_ptr<api::audio::SetActiveDevices::Params> params( 68 // TODO: implement this.
69 api::audio::SetActiveDevices::Params::Create(*args_)); 69 return false;
70 EXTENSION_FUNCTION_VALIDATE(params.get());
71
72 AudioService* service =
73 AudioAPI::GetFactoryInstance()->GetForProfile(profile())->GetService();
74 DCHECK(service);
75
76 service->SetActiveDevices(params->ids);
77 return true;
78 } 70 }
79 71
80 bool AudioSetPropertiesFunction::RunImpl() { 72 bool AudioSetPropertiesFunction::RunImpl() {
81 scoped_ptr<api::audio::SetProperties::Params> params( 73 // TODO: implement this.
82 api::audio::SetProperties::Params::Create(*args_)); 74 return false;
83 EXTENSION_FUNCTION_VALIDATE(params.get());
84
85 AudioService* service =
86 AudioAPI::GetFactoryInstance()->GetForProfile(profile())->GetService();
87 DCHECK(service);
88
89 int volume_value = params->properties.volume.get() ?
90 *params->properties.volume : -1;
91
92 int gain_value = params->properties.gain.get() ?
93 *params->properties.gain : -1;
94
95 if (!service->SetDeviceProperties(params->id,
96 params->properties.is_muted,
97 volume_value,
98 gain_value))
99 return false;
100 else
101 return true;
102 } 75 }
103 76
104 } // namespace extensions 77 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698