gfx/skia/trunk/src/pdf/SkPDFResourceDict.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.

     1 /*
     2  * Copyright 2013 Google Inc.
     3  *
     4  * Use of this source code is governed by a BSD-style license that can be
     5  * found in the LICENSE file.
     6  */
     8 #ifndef SkPDFResourceDict_DEFINED
     9 #define SkPDFResourceDict_DEFINED
    11 #include "SkPDFTypes.h"
    12 #include "SkTDArray.h"
    13 #include "SkTSet.h"
    14 #include "SkTypes.h"
    16 /** \class SkPDFResourceDict
    18     A resource dictionary, which maintains the relevant sub-dicts and
    19     allows generation of a list of referenced SkPDFObjects inserted with
    20     insertResourceAsRef.
    21 */
    22 class SkPDFResourceDict : public SkPDFDict {
    23 public:
    24     SK_DECLARE_INST_COUNT(SkPDFResourceDict)
    26      enum SkPDFResourceType{
    27         kExtGState_ResourceType,
    28         kPattern_ResourceType,
    29         kXObject_ResourceType,
    30         kFont_ResourceType,
    31         // These additional types are defined by the spec, but not
    32         // currently used by Skia: ColorSpace, Shading, Properties
    33         kResourceTypeCount
    34      };
    36     /** Create a PDF resource dictionary.
    37      *  The full set of ProcSet entries is automatically created for backwards
    38      *  compatibility, as recommended by the PDF spec.
    39      */
    40     SkPDFResourceDict();
    42     /** Add the value SkPDFObject as a reference to the resource dictionary
    43      *  with the give type and key.
    44      *  The relevant sub-dicts will be automatically generated, and the
    45      *  resource will be named by concatenating a type-specific prefix and
    46      *  the input key.
    47      *  This object will be part of the resource list when requested later.
    48      *  @param type  The type of resource being entered, like
    49      *    kPattern_ResourceType or kExtGState_ResourceType.
    50      *  @param key   The resource key, should be unique within its type.
    51      *  @param value The resource itself.
    52      *  @return The value argument is returned.
    53      */
    54     SkPDFObject* insertResourceAsReference(SkPDFResourceType type, int key,
    55                                            SkPDFObject* value);
    57     /**
    58      * Gets resources inserted into this dictionary as a reference.
    59      *
    60      * @param knownResourceObjects Set containing currently known resources.
    61      *     Resources in the dict and this set will not be added to the output.
    62      * @param newResourceObjects   Output set to which non-preexisting resources
    63      *     will be added.
    64      * @param recursive            Whether or not to add resources of resources.
    65      */
    66     void getReferencedResources(
    67             const SkTSet<SkPDFObject*>& knownResourceObjects,
    68             SkTSet<SkPDFObject*>* newResourceObjects,
    69             bool recursive) const;
    71     /**
    72      * Returns the name for the resource that will be generated by the resource
    73      * dict.
    74      *
    75      *  @param type  The type of resource being entered, like
    76      *    kPattern_ResourceType or kExtGState_ResourceType.
    77      *  @param key   The resource key, should be unique within its type.
    78      */
    79     static SkString getResourceName(SkPDFResourceType type, int key);
    81 private:
    82     /** Add the value to the dictionary with the given key.  Refs value.
    83      *  The relevant sub-dicts will be automatically generated, and the
    84      *  resource will be named by concatenating a type-specific prefix and
    85      *  the input key.
    86      *  The object will NOT be part of the resource list when requested later.
    87      *  @param type  The type of resource being entered.
    88      *  @param key   The resource key, should be unique within its type.
    89      *  @param value The resource itself.
    90      *  @return The value argument is returned.
    91      */
    92     SkPDFObject* insertResource(SkPDFResourceType type, int key,
    93                                 SkPDFObject* value);
    95     SkTSet<SkPDFObject*> fResources;
    97     SkTDArray<SkPDFDict*> fTypes;
    98     typedef SkPDFDict INHERITED;
    99 };
   101 #endif

mercurial