Sat, 03 Jan 2015 20:18:00 +0100
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 2012 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 SkAnnotation_DEFINED |
michael@0 | 9 | #define SkAnnotation_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | #include "SkRefCnt.h" |
michael@0 | 12 | #include "SkString.h" |
michael@0 | 13 | |
michael@0 | 14 | class SkData; |
michael@0 | 15 | class SkReadBuffer; |
michael@0 | 16 | class SkWriteBuffer; |
michael@0 | 17 | class SkStream; |
michael@0 | 18 | class SkWStream; |
michael@0 | 19 | struct SkPoint; |
michael@0 | 20 | |
michael@0 | 21 | /** |
michael@0 | 22 | * Experimental class for annotating draws. Do not use directly yet. |
michael@0 | 23 | * Use helper functions at the bottom of this file for now. |
michael@0 | 24 | */ |
michael@0 | 25 | class SkAnnotation : public SkRefCnt { |
michael@0 | 26 | public: |
michael@0 | 27 | virtual ~SkAnnotation(); |
michael@0 | 28 | |
michael@0 | 29 | static SkAnnotation* Create(const char key[], SkData* value) { |
michael@0 | 30 | return SkNEW_ARGS(SkAnnotation, (key, value)); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | static SkAnnotation* Create(SkReadBuffer& buffer) { |
michael@0 | 34 | return SkNEW_ARGS(SkAnnotation, (buffer)); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * Return the data for the specified key, or NULL. |
michael@0 | 39 | */ |
michael@0 | 40 | SkData* find(const char key[]) const; |
michael@0 | 41 | |
michael@0 | 42 | void writeToBuffer(SkWriteBuffer&) const; |
michael@0 | 43 | |
michael@0 | 44 | private: |
michael@0 | 45 | SkAnnotation(const char key[], SkData* value); |
michael@0 | 46 | SkAnnotation(SkReadBuffer&); |
michael@0 | 47 | |
michael@0 | 48 | SkString fKey; |
michael@0 | 49 | SkData* fData; |
michael@0 | 50 | |
michael@0 | 51 | typedef SkRefCnt INHERITED; |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | /** |
michael@0 | 55 | * Experimental collection of predefined Keys into the Annotation dictionary |
michael@0 | 56 | */ |
michael@0 | 57 | class SkAnnotationKeys { |
michael@0 | 58 | public: |
michael@0 | 59 | /** |
michael@0 | 60 | * Returns the canonical key whose payload is a URL |
michael@0 | 61 | */ |
michael@0 | 62 | static const char* URL_Key(); |
michael@0 | 63 | |
michael@0 | 64 | /** |
michael@0 | 65 | * Returns the canonical key whose payload is the name of a destination to |
michael@0 | 66 | * be defined. |
michael@0 | 67 | */ |
michael@0 | 68 | static const char* Define_Named_Dest_Key(); |
michael@0 | 69 | |
michael@0 | 70 | /** |
michael@0 | 71 | * Returns the canonical key whose payload is the name of a destination to |
michael@0 | 72 | * be linked to. |
michael@0 | 73 | */ |
michael@0 | 74 | static const char* Link_Named_Dest_Key(); |
michael@0 | 75 | }; |
michael@0 | 76 | |
michael@0 | 77 | /////////////////////////////////////////////////////////////////////////////// |
michael@0 | 78 | // |
michael@0 | 79 | // Experimental helper functions to use Annotations |
michael@0 | 80 | // |
michael@0 | 81 | |
michael@0 | 82 | struct SkRect; |
michael@0 | 83 | class SkCanvas; |
michael@0 | 84 | |
michael@0 | 85 | /** |
michael@0 | 86 | * Experimental! |
michael@0 | 87 | * |
michael@0 | 88 | * Annotate the canvas by associating the specified URL with the |
michael@0 | 89 | * specified rectangle (in local coordinates, just like drawRect). If the |
michael@0 | 90 | * backend of this canvas does not support annotations, this call is |
michael@0 | 91 | * safely ignored. |
michael@0 | 92 | * |
michael@0 | 93 | * The caller is responsible for managing its ownership of the SkData. |
michael@0 | 94 | */ |
michael@0 | 95 | SK_API void SkAnnotateRectWithURL(SkCanvas*, const SkRect&, SkData*); |
michael@0 | 96 | |
michael@0 | 97 | /** |
michael@0 | 98 | * Experimental! |
michael@0 | 99 | * |
michael@0 | 100 | * Annotate the canvas by associating a name with the specified point. |
michael@0 | 101 | * |
michael@0 | 102 | * If the backend of this canvas does not support annotations, this call is |
michael@0 | 103 | * safely ignored. |
michael@0 | 104 | * |
michael@0 | 105 | * The caller is responsible for managing its ownership of the SkData. |
michael@0 | 106 | */ |
michael@0 | 107 | SK_API void SkAnnotateNamedDestination(SkCanvas*, const SkPoint&, SkData*); |
michael@0 | 108 | |
michael@0 | 109 | /** |
michael@0 | 110 | * Experimental! |
michael@0 | 111 | * |
michael@0 | 112 | * Annotate the canvas by making the specified rectangle link to a named |
michael@0 | 113 | * destination. |
michael@0 | 114 | * |
michael@0 | 115 | * If the backend of this canvas does not support annotations, this call is |
michael@0 | 116 | * safely ignored. |
michael@0 | 117 | * |
michael@0 | 118 | * The caller is responsible for managing its ownership of the SkData. |
michael@0 | 119 | */ |
michael@0 | 120 | SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*); |
michael@0 | 121 | |
michael@0 | 122 | |
michael@0 | 123 | #endif |