gfx/skia/trunk/include/views/SkEventSink.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1
michael@0 2 /*
michael@0 3 * Copyright 2006 The Android Open Source Project
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8
michael@0 9
michael@0 10 #ifndef SkEventSink_DEFINED
michael@0 11 #define SkEventSink_DEFINED
michael@0 12
michael@0 13 #include "SkRefCnt.h"
michael@0 14 #include "SkEvent.h"
michael@0 15
michael@0 16 struct SkTagList;
michael@0 17
michael@0 18 /** \class SkEventSink
michael@0 19
michael@0 20 SkEventSink is the base class for all objects that receive SkEvents.
michael@0 21 */
michael@0 22 class SkEventSink : public SkRefCnt {
michael@0 23 public:
michael@0 24 SK_DECLARE_INST_COUNT(SkEventSink)
michael@0 25
michael@0 26 SkEventSink();
michael@0 27 virtual ~SkEventSink();
michael@0 28
michael@0 29 /**
michael@0 30 * Returns this eventsink's unique ID. Use this to post SkEvents to
michael@0 31 * this eventsink.
michael@0 32 */
michael@0 33 SkEventSinkID getSinkID() const { return fID; }
michael@0 34
michael@0 35 /**
michael@0 36 * Call this to pass an event to this object for processing. Returns true if the
michael@0 37 * event was handled.
michael@0 38 */
michael@0 39 bool doEvent(const SkEvent&);
michael@0 40
michael@0 41 /** Returns true if the sink (or one of its subclasses) understands the event as a query.
michael@0 42 If so, the sink may modify the event to communicate its "answer".
michael@0 43 */
michael@0 44 bool doQuery(SkEvent* query);
michael@0 45
michael@0 46 /**
michael@0 47 * Add sinkID to the list of listeners, to receive events from calls to sendToListeners()
michael@0 48 * and postToListeners(). If sinkID already exists in the listener list, no change is made.
michael@0 49 */
michael@0 50 void addListenerID(SkEventSinkID sinkID);
michael@0 51
michael@0 52 /**
michael@0 53 * Copy listeners from one event sink to another, typically from parent to child.
michael@0 54 * @param from the event sink to copy the listeners from
michael@0 55 */
michael@0 56 void copyListeners(const SkEventSink& from);
michael@0 57
michael@0 58 /**
michael@0 59 * Remove sinkID from the list of listeners. If sinkID does not appear in the list,
michael@0 60 * no change is made.
michael@0 61 */
michael@0 62 void removeListenerID(SkEventSinkID);
michael@0 63
michael@0 64 /**
michael@0 65 * Returns true if there are 1 or more listeners attached to this eventsink
michael@0 66 */
michael@0 67 bool hasListeners() const;
michael@0 68
michael@0 69 /**
michael@0 70 * Posts a copy of evt to each of the eventsinks in the lisener list.
michael@0 71 * This ignores the targetID and target proc in evt.
michael@0 72 */
michael@0 73 void postToListeners(const SkEvent& evt, SkMSec delay = 0);
michael@0 74
michael@0 75 enum EventResult {
michael@0 76 kHandled_EventResult, //!< the eventsink returned true from its doEvent method
michael@0 77 kNotHandled_EventResult, //!< the eventsink returned false from its doEvent method
michael@0 78 kSinkNotFound_EventResult //!< no matching eventsink was found for the event's getSink().
michael@0 79 };
michael@0 80
michael@0 81 /**
michael@0 82 * DoEvent handles dispatching the event to its target ID or proc.
michael@0 83 */
michael@0 84 static EventResult DoEvent(const SkEvent&);
michael@0 85
michael@0 86 /**
michael@0 87 * Returns the matching eventsink, or null if not found
michael@0 88 */
michael@0 89 static SkEventSink* FindSink(SkEventSinkID);
michael@0 90
michael@0 91 protected:
michael@0 92 /** Override this to handle events in your subclass. Be sure to call the inherited version
michael@0 93 for events that you don't handle.
michael@0 94 */
michael@0 95 virtual bool onEvent(const SkEvent&);
michael@0 96 virtual bool onQuery(SkEvent*);
michael@0 97
michael@0 98 SkTagList* findTagList(U8CPU tag) const;
michael@0 99 void addTagList(SkTagList*);
michael@0 100 void removeTagList(U8CPU tag);
michael@0 101
michael@0 102 private:
michael@0 103 SkEventSinkID fID;
michael@0 104 SkTagList* fTagHead;
michael@0 105
michael@0 106 // for our private link-list
michael@0 107 SkEventSink* fNextSink;
michael@0 108
michael@0 109 typedef SkRefCnt INHERITED;
michael@0 110 };
michael@0 111
michael@0 112 #endif

mercurial