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

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

Issue 235113002: Oilpan: Remove guardRef and guardDeref from TreeScope. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments. 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/Page.cpp ('k') | 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 26 matching lines...) Expand all
37 #include "core/speech/SpeechInputListener.h" 37 #include "core/speech/SpeechInputListener.h"
38 #include "wtf/Forward.h" 38 #include "wtf/Forward.h"
39 #include "wtf/HashMap.h" 39 #include "wtf/HashMap.h"
40 40
41 namespace WebCore { 41 namespace WebCore {
42 42
43 class IntRect; 43 class IntRect;
44 class SecurityOrigin; 44 class SecurityOrigin;
45 class SpeechInputClient; 45 class SpeechInputClient;
46 class SpeechInputListener; 46 class SpeechInputListener;
47 class InputFieldSpeechButtonElement;
47 48
48 // This class connects the input elements requiring speech input with the platfo rm specific 49 // 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 50 // 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. 51 // recognition and methods for the speech recognition engine to return back the results.
51 class SpeechInput FINAL : public SpeechInputListener, public Supplement<Page> { 52 class SpeechInput FINAL : public SpeechInputListener, public Supplement<Page> {
52 WTF_MAKE_NONCOPYABLE(SpeechInput); 53 WTF_MAKE_NONCOPYABLE(SpeechInput);
53 public: 54 public:
54 virtual ~SpeechInput(); 55 virtual ~SpeechInput();
55 56
56 static PassOwnPtr<SpeechInput> create(PassOwnPtr<SpeechInputClient>); 57 static PassOwnPtr<SpeechInput> create(PassOwnPtr<SpeechInputClient>);
57 static const char* supplementName(); 58 static const char* supplementName();
58 static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(Supp lement<Page>::from(page, supplementName())); } 59 static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(Supp lement<Page>::from(page, supplementName())); }
59 60
60 // Generates a unique ID for the given listener to be used for speech reques ts. 61 // 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. 62 // This should be the first call made by listeners before anything else.
62 int registerListener(SpeechInputListener*); 63 int registerListener(InputFieldSpeechButtonElement*);
63 64
64 // Invoked when the listener is done with recording or getting destroyed. 65 // 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. 66 // Failure to unregister may result in crashes if there were any pending spe ech events.
66 void unregisterListener(int); 67 void unregisterListener(int);
67 68
68 // Methods invoked by the input elements. 69 // Methods invoked by the input elements.
69 bool startRecognition(int listenerId, const IntRect& elementRect, const Atom icString& language, const String& grammar, SecurityOrigin*); 70 bool startRecognition(int listenerId, const IntRect& elementRect, const Atom icString& language, const String& grammar, SecurityOrigin*);
70 void stopRecording(int); 71 void stopRecording(int);
71 void cancelRecognition(int); 72 void cancelRecognition(int);
72 73
73 // SpeechInputListener methods. 74 // SpeechInputListener methods.
74 virtual void didCompleteRecording(int) OVERRIDE; 75 virtual void didCompleteRecording(int) OVERRIDE;
75 virtual void didCompleteRecognition(int) OVERRIDE; 76 virtual void didCompleteRecognition(int) OVERRIDE;
76 virtual void setRecognitionResult(int, const SpeechInputResultArray&) OVERRI DE; 77 virtual void setRecognitionResult(int, const SpeechInputResultArray&) OVERRI DE;
77 78
78 virtual void trace(Visitor*) OVERRIDE { } 79 virtual void trace(Visitor*) OVERRIDE { }
80 void clearWeakMembers(Visitor*);
79 81
80 private: 82 private:
81 explicit SpeechInput(PassOwnPtr<SpeechInputClient>); 83 explicit SpeechInput(PassOwnPtr<SpeechInputClient>);
82 84
83 OwnPtr<SpeechInputClient> m_client; 85 OwnPtr<SpeechInputClient> m_client;
84 HashMap<int, SpeechInputListener*> m_listeners; 86 // FIXME: Oilpan: go back to using SpeechInputListener as the type when
87 // all SpeechInputListeners (SpeechInput and InputFieldSpeechButtonElement)
88 // have been moved to the oilpan heap. At that point SpeechInputListener
89 // will be a GarbageCollectedMixin.
90 HashMap<int, InputFieldSpeechButtonElement*> m_listeners;
85 int m_nextListenerId; 91 int m_nextListenerId;
86 }; 92 };
87 93
88 } // namespace WebCore 94 } // namespace WebCore
89 95
90 #endif // ENABLE(INPUT_SPEECH) 96 #endif // ENABLE(INPUT_SPEECH)
91 97
92 #endif // SpeechInput_h 98 #endif // SpeechInput_h
OLDNEW
« no previous file with comments | « Source/core/page/Page.cpp ('k') | Source/core/speech/SpeechInput.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698