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

Side by Side Diff: chrome/browser/speech/speech_recognition_request.h

Issue 6134003: Prototype of chunked transfer encoded POST. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ 5 #ifndef CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_
6 #define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ 6 #define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 27 matching lines...) Expand all
38 38
39 // |url| is the server address to which the request wil be sent. 39 // |url| is the server address to which the request wil be sent.
40 SpeechRecognitionRequest(URLRequestContextGetter* context, 40 SpeechRecognitionRequest(URLRequestContextGetter* context,
41 Delegate* delegate); 41 Delegate* delegate);
42 42
43 virtual ~SpeechRecognitionRequest(); 43 virtual ~SpeechRecognitionRequest();
44 44
45 // Sends a new request with the given audio data, returns true if successful. 45 // Sends a new request with the given audio data, returns true if successful.
46 // The same object can be used to send multiple requests but only after the 46 // The same object can be used to send multiple requests but only after the
47 // previous request has completed. 47 // previous request has completed.
48 bool Send(const std::string& language, 48 void Start(const std::string& language,
49 const std::string& grammar, 49 const std::string& grammar,
50 const std::string& hardware_info, 50 const std::string& hardware_info,
51 const std::string& content_type, 51 const std::string& content_type);
52 const std::string& audio_data); 52
53 void UploadAudioChunk(const std::string& audio_data);
54 void FinishAudioUpload();
53 55
54 bool HasPendingRequest() { return url_fetcher_ != NULL; } 56 bool HasPendingRequest() { return url_fetcher_ != NULL; }
55 57
56 // URLFetcher::Delegate methods. 58 // URLFetcher::Delegate methods.
57 virtual void OnURLFetchComplete(const URLFetcher* source, 59 virtual void OnURLFetchComplete(const URLFetcher* source,
58 const GURL& url, 60 const GURL& url,
59 const net::URLRequestStatus& status, 61 const net::URLRequestStatus& status,
60 int response_code, 62 int response_code,
61 const ResponseCookies& cookies, 63 const ResponseCookies& cookies,
62 const std::string& data); 64 const std::string& data);
63 65
64 private: 66 private:
65 scoped_refptr<URLRequestContextGetter> url_context_; 67 scoped_refptr<URLRequestContextGetter> url_context_;
66 Delegate* delegate_; 68 Delegate* delegate_;
67 scoped_ptr<URLFetcher> url_fetcher_; 69 scoped_ptr<URLFetcher> url_fetcher_;
68 70
69 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionRequest); 71 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionRequest);
70 }; 72 };
71 73
72 // This typedef is to workaround the issue with certain versions of 74 // This typedef is to workaround the issue with certain versions of
73 // Visual Studio where it gets confused between multiple Delegate 75 // Visual Studio where it gets confused between multiple Delegate
74 // classes and gives a C2500 error. (I saw this error on the try bots - 76 // classes and gives a C2500 error. (I saw this error on the try bots -
75 // the workaround was not needed for my machine). 77 // the workaround was not needed for my machine).
76 typedef SpeechRecognitionRequest::Delegate SpeechRecognitionRequestDelegate; 78 typedef SpeechRecognitionRequest::Delegate SpeechRecognitionRequestDelegate;
77 79
78 } // namespace speech_input 80 } // namespace speech_input
79 81
80 #endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ 82 #endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698