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

Side by Side Diff: Source/core/speech/SpeechInput.h

Issue 219273002: Use OwnPtr|PassOwnPtr to pass a pointer of SpeechInputClient (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | Source/core/speech/SpeechInput.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class SpeechInputListener; 46 class SpeechInputListener;
47 47
48 // This class connects the input elements requiring speech input with the platfo rm specific 48 // This class connects the input elements requiring speech input with the platfo rm specific
49 // speech recognition engine. It provides methods for the input elements to acti vate speech 49 // speech recognition engine. It provides methods for the input elements to acti vate speech
50 // recognition and methods for the speech recognition engine to return back the results. 50 // recognition and methods for the speech recognition engine to return back the results.
51 class SpeechInput FINAL : public SpeechInputListener, public Supplement<Page> { 51 class SpeechInput FINAL : public SpeechInputListener, public Supplement<Page> {
52 WTF_MAKE_NONCOPYABLE(SpeechInput); 52 WTF_MAKE_NONCOPYABLE(SpeechInput);
53 public: 53 public:
54 virtual ~SpeechInput(); 54 virtual ~SpeechInput();
55 55
56 static PassOwnPtr<SpeechInput> create(SpeechInputClient*); 56 static PassOwnPtr<SpeechInput> create(PassOwnPtr<SpeechInputClient>);
57 static const char* supplementName(); 57 static const char* supplementName();
58 static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(Supp lement<Page>::from(page, supplementName())); } 58 static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(Supp lement<Page>::from(page, supplementName())); }
59 59
60 // Generates a unique ID for the given listener to be used for speech reques ts. 60 // Generates a unique ID for the given listener to be used for speech reques ts.
61 // This should be the first call made by listeners before anything else. 61 // This should be the first call made by listeners before anything else.
62 int registerListener(SpeechInputListener*); 62 int registerListener(SpeechInputListener*);
63 63
64 // Invoked when the listener is done with recording or getting destroyed. 64 // Invoked when the listener is done with recording or getting destroyed.
65 // Failure to unregister may result in crashes if there were any pending spe ech events. 65 // Failure to unregister may result in crashes if there were any pending spe ech events.
66 void unregisterListener(int); 66 void unregisterListener(int);
67 67
68 // Methods invoked by the input elements. 68 // Methods invoked by the input elements.
69 bool startRecognition(int listenerId, const IntRect& elementRect, const Atom icString& language, const String& grammar, SecurityOrigin*); 69 bool startRecognition(int listenerId, const IntRect& elementRect, const Atom icString& language, const String& grammar, SecurityOrigin*);
70 void stopRecording(int); 70 void stopRecording(int);
71 void cancelRecognition(int); 71 void cancelRecognition(int);
72 72
73 // SpeechInputListener methods. 73 // SpeechInputListener methods.
74 virtual void didCompleteRecording(int) OVERRIDE; 74 virtual void didCompleteRecording(int) OVERRIDE;
75 virtual void didCompleteRecognition(int) OVERRIDE; 75 virtual void didCompleteRecognition(int) OVERRIDE;
76 virtual void setRecognitionResult(int, const SpeechInputResultArray&) OVERRI DE; 76 virtual void setRecognitionResult(int, const SpeechInputResultArray&) OVERRI DE;
77 77
78 private: 78 private:
79 explicit SpeechInput(SpeechInputClient*); 79 explicit SpeechInput(PassOwnPtr<SpeechInputClient>);
80 80
81 SpeechInputClient* m_client; 81 OwnPtr<SpeechInputClient> m_client;
82 HashMap<int, SpeechInputListener*> m_listeners; 82 HashMap<int, SpeechInputListener*> m_listeners;
83 int m_nextListenerId; 83 int m_nextListenerId;
84 }; 84 };
85 85
86 } // namespace WebCore 86 } // namespace WebCore
87 87
88 #endif // ENABLE(INPUT_SPEECH) 88 #endif // ENABLE(INPUT_SPEECH)
89 89
90 #endif // SpeechInput_h 90 #endif // SpeechInput_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/speech/SpeechInput.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698