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.

     2 /*
     3  * Copyright 2006 The Android Open Source Project
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #ifndef SkViewInflate_DEFINED
    11 #define SkViewInflate_DEFINED
    13 #include "SkDOM.h"
    14 #include "SkTDict.h"
    15 #include "SkEvent.h"
    17 class SkView;
    19 class SkViewInflate {
    20 public:
    21             SkViewInflate();
    22     virtual ~SkViewInflate();
    24     /** Return the tree of inflated views. If root is null, create the root element
    25         as a view, otherwise assume root is that view, and just "inflate" it.
    27         Returns null if the tree cannot be built.
    28     */
    29     SkView* inflate(const SkDOM& dom, const SkDOM::Node* node, SkView* root = NULL);
    30     SkView* inflate(const char xml[], size_t len, SkView* root = NULL);
    32     /** Given an id attribute value, return the corresponding view, or null
    33         if no match is found.
    34     */
    35     SkView* findViewByID(const char id[]) const;
    37     SkDEBUGCODE(void dump() const;)
    39 protected:
    40     /*  Override this in your subclass to handle instantiating views
    41         Call the inherited version for nodes you don't recognize.
    43         Do not call "inflate" on the view, just return it. This will
    44         get called automatically after createView returns.
    45     */
    46     virtual SkView* createView(const SkDOM& dom, const SkDOM::Node* node);
    47     /** Base implementation calls view->inflate(dom, node). Subclasses may override this
    48         to perform additional initializations to view, either before or after calling
    49         the inherited version.
    50     */
    51     virtual void inflateView(SkView* view, const SkDOM& dom, const SkDOM::Node* node);
    53 private:
    54     enum {
    55         kMinIDStrAlloc = 64
    56     };
    57     SkTDict<SkView*> fIDs;
    59     struct IDStr {
    60         SkView* fView;
    61         char*   fStr;
    62     };
    63     SkTDArray<IDStr>    fListenTo, fBroadcastTo;
    64     SkChunkAlloc        fStrings;
    66     void addIDStr(SkTDArray<IDStr>* list, SkView*, const char* str);
    68     void    rInflate(const SkDOM& dom, const SkDOM::Node* node, SkView* parent);
    69 };
    71 #endif

mercurial