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

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

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 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/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/extensions/api/audio.h" 10 #include "chrome/common/extensions/api/audio.h"
(...skipping 28 matching lines...) Expand all
39 39
40 void AudioAPI::OnDeviceChanged() { 40 void AudioAPI::OnDeviceChanged() {
41 if (browser_context_ && EventRouter::Get(browser_context_)) { 41 if (browser_context_ && EventRouter::Get(browser_context_)) {
42 scoped_ptr<Event> event(new Event( 42 scoped_ptr<Event> event(new Event(
43 audio::OnDeviceChanged::kEventName, 43 audio::OnDeviceChanged::kEventName,
44 scoped_ptr<base::ListValue>(new base::ListValue()))); 44 scoped_ptr<base::ListValue>(new base::ListValue())));
45 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); 45 EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass());
46 } 46 }
47 } 47 }
48 48
49 bool AudioGetInfoFunction::RunImpl() { 49 bool AudioGetInfoFunction::RunAsync() {
50 AudioService* service = 50 AudioService* service =
51 AudioAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); 51 AudioAPI::GetFactoryInstance()->Get(GetProfile())->GetService();
52 DCHECK(service); 52 DCHECK(service);
53 service->StartGetInfo(base::Bind(&AudioGetInfoFunction::OnGetInfoCompleted, 53 service->StartGetInfo(base::Bind(&AudioGetInfoFunction::OnGetInfoCompleted,
54 this)); 54 this));
55 return true; 55 return true;
56 } 56 }
57 57
58 void AudioGetInfoFunction::OnGetInfoCompleted(const OutputInfo& output_info, 58 void AudioGetInfoFunction::OnGetInfoCompleted(const OutputInfo& output_info,
59 const InputInfo& input_info, 59 const InputInfo& input_info,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (!service->SetDeviceProperties(params->id, 96 if (!service->SetDeviceProperties(params->id,
97 params->properties.is_muted, 97 params->properties.is_muted,
98 volume_value, 98 volume_value,
99 gain_value)) 99 gain_value))
100 return false; 100 return false;
101 else 101 else
102 return true; 102 return true;
103 } 103 }
104 104
105 } // namespace extensions 105 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698