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.

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

mercurial