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

mercurial