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

Side by Side Diff: content/browser/speech/google_one_shot_remote_engine.h

Issue 10392192: Remove content::URLFetcherDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ 5 #ifndef CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_
6 #define CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ 6 #define CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "content/browser/speech/audio_encoder.h" 14 #include "content/browser/speech/audio_encoder.h"
15 #include "content/browser/speech/speech_recognition_engine.h" 15 #include "content/browser/speech/speech_recognition_engine.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 #include "content/public/common/url_fetcher_delegate.h"
18 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
19 18 #include "net/url_request/url_fetcher_delegate.h"
20 class URLFetcher;
21 19
22 namespace content { 20 namespace content {
23 struct SpeechRecognitionResult; 21 struct SpeechRecognitionResult;
22 class URLFetcher;
24 } 23 }
25 24
26 namespace net { 25 namespace net {
27 class URLRequestContextGetter; 26 class URLRequestContextGetter;
28 } 27 }
29 28
30 namespace speech { 29 namespace speech {
31 30
32 class AudioChunk; 31 class AudioChunk;
33 32
34 // Implements a SpeechRecognitionEngine by means of remote interaction with 33 // Implements a SpeechRecognitionEngine by means of remote interaction with
35 // Google speech recognition webservice. 34 // Google speech recognition webservice.
36 class CONTENT_EXPORT GoogleOneShotRemoteEngine 35 class CONTENT_EXPORT GoogleOneShotRemoteEngine
37 : public NON_EXPORTED_BASE(SpeechRecognitionEngine), 36 : public NON_EXPORTED_BASE(SpeechRecognitionEngine),
38 public content::URLFetcherDelegate { 37 public net::URLFetcherDelegate {
39 public: 38 public:
40 // Duration of each audio packet. 39 // Duration of each audio packet.
41 static const int kAudioPacketIntervalMs; 40 static const int kAudioPacketIntervalMs;
42 // ID passed to URLFetcher::Create(). Used for testing. 41 // ID passed to URLFetcher::Create(). Used for testing.
43 static int url_fetcher_id_for_tests; 42 static int url_fetcher_id_for_tests;
44 43
45 explicit GoogleOneShotRemoteEngine(net::URLRequestContextGetter* context); 44 explicit GoogleOneShotRemoteEngine(net::URLRequestContextGetter* context);
46 virtual ~GoogleOneShotRemoteEngine(); 45 virtual ~GoogleOneShotRemoteEngine();
47 46
48 // SpeechRecognitionEngine methods. 47 // SpeechRecognitionEngine methods.
49 virtual void SetConfig(const SpeechRecognitionEngineConfig& config) OVERRIDE; 48 virtual void SetConfig(const SpeechRecognitionEngineConfig& config) OVERRIDE;
50 virtual void StartRecognition() OVERRIDE; 49 virtual void StartRecognition() OVERRIDE;
51 virtual void EndRecognition() OVERRIDE; 50 virtual void EndRecognition() OVERRIDE;
52 virtual void TakeAudioChunk(const AudioChunk& data) OVERRIDE; 51 virtual void TakeAudioChunk(const AudioChunk& data) OVERRIDE;
53 virtual void AudioChunksEnded() OVERRIDE; 52 virtual void AudioChunksEnded() OVERRIDE;
54 virtual bool IsRecognitionPending() const OVERRIDE; 53 virtual bool IsRecognitionPending() const OVERRIDE;
55 virtual int GetDesiredAudioChunkDurationMs() const OVERRIDE; 54 virtual int GetDesiredAudioChunkDurationMs() const OVERRIDE;
56 55
57 // content::URLFetcherDelegate methods. 56 // net::URLFetcherDelegate methods.
58 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 57 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
59 58
60 private: 59 private:
61 SpeechRecognitionEngineConfig config_; 60 SpeechRecognitionEngineConfig config_;
62 scoped_ptr<content::URLFetcher> url_fetcher_; 61 scoped_ptr<content::URLFetcher> url_fetcher_;
63 scoped_refptr<net::URLRequestContextGetter> url_context_; 62 scoped_refptr<net::URLRequestContextGetter> url_context_;
64 scoped_ptr<AudioEncoder> encoder_; 63 scoped_ptr<AudioEncoder> encoder_;
65 64
66 DISALLOW_COPY_AND_ASSIGN(GoogleOneShotRemoteEngine); 65 DISALLOW_COPY_AND_ASSIGN(GoogleOneShotRemoteEngine);
67 }; 66 };
68 67
69 } // namespace speech 68 } // namespace speech
70 69
71 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ 70 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_
OLDNEW
« no previous file with comments | « content/browser/geolocation/network_location_request.h ('k') | content/common/net/url_fetcher_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698