gfx/skia/trunk/include/views/SkViewInflate.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 SkViewInflate_DEFINED
michael@0 11 #define SkViewInflate_DEFINED
michael@0 12
michael@0 13 #include "SkDOM.h"
michael@0 14 #include "SkTDict.h"
michael@0 15 #include "SkEvent.h"
michael@0 16
michael@0 17 class SkView;
michael@0 18
michael@0 19 class SkViewInflate {
michael@0 20 public:
michael@0 21 SkViewInflate();
michael@0 22 virtual ~SkViewInflate();
michael@0 23
michael@0 24 /** Return the tree of inflated views. If root is null, create the root element
michael@0 25 as a view, otherwise assume root is that view, and just "inflate" it.
michael@0 26
michael@0 27 Returns null if the tree cannot be built.
michael@0 28 */
michael@0 29 SkView* inflate(const SkDOM& dom, const SkDOM::Node* node, SkView* root = NULL);
michael@0 30 SkView* inflate(const char xml[], size_t len, SkView* root = NULL);
michael@0 31
michael@0 32 /** Given an id attribute value, return the corresponding view, or null
michael@0 33 if no match is found.
michael@0 34 */
michael@0 35 SkView* findViewByID(const char id[]) const;
michael@0 36
michael@0 37 SkDEBUGCODE(void dump() const;)
michael@0 38
michael@0 39 protected:
michael@0 40 /* Override this in your subclass to handle instantiating views
michael@0 41 Call the inherited version for nodes you don't recognize.
michael@0 42
michael@0 43 Do not call "inflate" on the view, just return it. This will
michael@0 44 get called automatically after createView returns.
michael@0 45 */
michael@0 46 virtual SkView* createView(const SkDOM& dom, const SkDOM::Node* node);
michael@0 47 /** Base implementation calls view->inflate(dom, node). Subclasses may override this
michael@0 48 to perform additional initializations to view, either before or after calling
michael@0 49 the inherited version.
michael@0 50 */
michael@0 51 virtual void inflateView(SkView* view, const SkDOM& dom, const SkDOM::Node* node);
michael@0 52
michael@0 53 private:
michael@0 54 enum {
michael@0 55 kMinIDStrAlloc = 64
michael@0 56 };
michael@0 57 SkTDict<SkView*> fIDs;
michael@0 58
michael@0 59 struct IDStr {
michael@0 60 SkView* fView;
michael@0 61 char* fStr;
michael@0 62 };
michael@0 63 SkTDArray<IDStr> fListenTo, fBroadcastTo;
michael@0 64 SkChunkAlloc fStrings;
michael@0 65
michael@0 66 void addIDStr(SkTDArray<IDStr>* list, SkView*, const char* str);
michael@0 67
michael@0 68 void rInflate(const SkDOM& dom, const SkDOM::Node* node, SkView* parent);
michael@0 69 };
michael@0 70
michael@0 71 #endif

mercurial