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

Side by Side Diff: content/browser/renderer_host/media/audio_output_authorization_handler.h

Issue 2869733005: Convert some audio code to OnceCallback. (Closed)
Patch Set: Rebase, comments on unretained. Created 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLER_H _ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLER_H _
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLER_H _ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLER_H _
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 18 matching lines...) Expand all
29 // use the device, and gets the default device parameters for the selected audio 29 // use the device, and gets the default device parameters for the selected audio
30 // device. 30 // device.
31 class CONTENT_EXPORT AudioOutputAuthorizationHandler { 31 class CONTENT_EXPORT AudioOutputAuthorizationHandler {
32 public: 32 public:
33 // The result of an authorization check. In addition to the status, it 33 // The result of an authorization check. In addition to the status, it
34 // indicates whether a device was found using the |session_id| in the variable 34 // indicates whether a device was found using the |session_id| in the variable
35 // |should_send_id|, in which case the renderer expects to get the id hash. It 35 // |should_send_id|, in which case the renderer expects to get the id hash. It
36 // also has the default audio parameters for the device, and the id for the 36 // also has the default audio parameters for the device, and the id for the
37 // device, which is needed to open a stream for the device. This id is not 37 // device, which is needed to open a stream for the device. This id is not
38 // hashed, so it must be hashed before sending it to the renderer. 38 // hashed, so it must be hashed before sending it to the renderer.
39 // TODO(maxmorin): Change to OnceCallback once base:: code is ready for it.
40 using AuthorizationCompletedCallback = 39 using AuthorizationCompletedCallback =
41 base::Callback<void(media::OutputDeviceStatus status, 40 base::OnceCallback<void(media::OutputDeviceStatus status,
42 bool should_send_id, 41 bool should_send_id,
43 const media::AudioParameters& params, 42 const media::AudioParameters& params,
44 const std::string& raw_device_id)>; 43 const std::string& raw_device_id)>;
45 44
46 AudioOutputAuthorizationHandler(media::AudioSystem* audio_system, 45 AudioOutputAuthorizationHandler(media::AudioSystem* audio_system,
47 MediaStreamManager* media_stream_manager, 46 MediaStreamManager* media_stream_manager,
48 int render_process_id_, 47 int render_process_id_,
49 const std::string& salt); 48 const std::string& salt);
50 49
51 ~AudioOutputAuthorizationHandler(); 50 ~AudioOutputAuthorizationHandler();
52 51
53 // Checks authorization of the device with the hashed id |device_id| for the 52 // Checks authorization of the device with the hashed id |device_id| for the
54 // given render frame id and security origin, or uses |session_id| for 53 // given render frame id and security origin, or uses |session_id| for
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // const, so this can be mutable. 96 // const, so this can be mutable.
98 mutable base::WeakPtrFactory<const AudioOutputAuthorizationHandler> 97 mutable base::WeakPtrFactory<const AudioOutputAuthorizationHandler>
99 weak_factory_; 98 weak_factory_;
100 99
101 DISALLOW_COPY_AND_ASSIGN(AudioOutputAuthorizationHandler); 100 DISALLOW_COPY_AND_ASSIGN(AudioOutputAuthorizationHandler);
102 }; 101 };
103 102
104 } // namespace content 103 } // namespace content
105 104
106 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLE R_H_ 105 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_AUTHORIZATION_HANDLE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698