OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PUBLIC_RENDERER_PLATFORM_EVENT_OBSERVER_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_PLATFORM_EVENT_OBSERVER_H_ |
6 #define CONTENT_PUBLIC_RENDERER_PLATFORM_EVENT_OBSERVER_H_ | 6 #define CONTENT_PUBLIC_RENDERER_PLATFORM_EVENT_OBSERVER_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/public/renderer/render_process_observer.h" | 9 #include "content/public/renderer/render_process_observer.h" |
10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // did not stop before. Implementations of PlatformEventObserver must do | 64 // did not stop before. Implementations of PlatformEventObserver must do |
65 // so by calling StopIfObserving() from their destructors. | 65 // so by calling StopIfObserving() from their destructors. |
66 virtual ~PlatformEventObserver() { | 66 virtual ~PlatformEventObserver() { |
67 // If this assert fails, the derived destructor failed to invoke | 67 // If this assert fails, the derived destructor failed to invoke |
68 // StopIfObserving(). | 68 // StopIfObserving(). |
69 DCHECK(!is_observing()); | 69 DCHECK(!is_observing()); |
70 } | 70 } |
71 | 71 |
72 // Called when a new IPC message is received. Must be used to listen to the | 72 // Called when a new IPC message is received. Must be used to listen to the |
73 // responses from the browser process if any expected. | 73 // responses from the browser process if any expected. |
74 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE { | 74 virtual bool OnControlMessageReceived(const IPC::Message& msg) override { |
75 return false; | 75 return false; |
76 } | 76 } |
77 | 77 |
78 // Start observing. Will request the browser process to start listening to the | 78 // Start observing. Will request the browser process to start listening to the |
79 // events. |listener| will receive any response from the browser process. | 79 // events. |listener| will receive any response from the browser process. |
80 // Note: should not be called if already observing. | 80 // Note: should not be called if already observing. |
81 virtual void Start(blink::WebPlatformEventListener* listener) { | 81 virtual void Start(blink::WebPlatformEventListener* listener) { |
82 DCHECK(!is_observing()); | 82 DCHECK(!is_observing()); |
83 listener_ = static_cast<ListenerType*>(listener); | 83 listener_ = static_cast<ListenerType*>(listener); |
84 is_observing_ = true; | 84 is_observing_ = true; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 private: | 127 private: |
128 bool is_observing_; | 128 bool is_observing_; |
129 ListenerType* listener_; | 129 ListenerType* listener_; |
130 | 130 |
131 DISALLOW_COPY_AND_ASSIGN(PlatformEventObserver); | 131 DISALLOW_COPY_AND_ASSIGN(PlatformEventObserver); |
132 }; | 132 }; |
133 | 133 |
134 } // namespace content | 134 } // namespace content |
135 | 135 |
136 #endif // CONTENT_PUBLIC_RENDERER_PLATFORM_EVENT_OBSERVER_H_ | 136 #endif // CONTENT_PUBLIC_RENDERER_PLATFORM_EVENT_OBSERVER_H_ |
OLD | NEW |