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 | /* |
michael@0 | 3 | * Copyright 2006 The Android Open Source Project |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | #ifndef SkXMLWriter_DEFINED |
michael@0 | 11 | #define SkXMLWriter_DEFINED |
michael@0 | 12 | |
michael@0 | 13 | #include "SkTDArray.h" |
michael@0 | 14 | #include "SkString.h" |
michael@0 | 15 | #include "SkDOM.h" |
michael@0 | 16 | |
michael@0 | 17 | class SkWStream; |
michael@0 | 18 | class SkXMLParser; |
michael@0 | 19 | |
michael@0 | 20 | class SkXMLWriter { |
michael@0 | 21 | public: |
michael@0 | 22 | SkXMLWriter(bool doEscapeMarkup = true); |
michael@0 | 23 | virtual ~SkXMLWriter(); |
michael@0 | 24 | |
michael@0 | 25 | void addS32Attribute(const char name[], int32_t value); |
michael@0 | 26 | void addAttribute(const char name[], const char value[]); |
michael@0 | 27 | void addAttributeLen(const char name[], const char value[], size_t length); |
michael@0 | 28 | void addHexAttribute(const char name[], uint32_t value, int minDigits = 0); |
michael@0 | 29 | void addScalarAttribute(const char name[], SkScalar value); |
michael@0 | 30 | void endElement() { this->onEndElement(); } |
michael@0 | 31 | void startElement(const char elem[]); |
michael@0 | 32 | void startElementLen(const char elem[], size_t length); |
michael@0 | 33 | void writeDOM(const SkDOM&, const SkDOM::Node*, bool skipRoot); |
michael@0 | 34 | void flush(); |
michael@0 | 35 | virtual void writeHeader(); |
michael@0 | 36 | |
michael@0 | 37 | protected: |
michael@0 | 38 | virtual void onStartElementLen(const char elem[], size_t length) = 0; |
michael@0 | 39 | virtual void onAddAttributeLen(const char name[], const char value[], size_t length) = 0; |
michael@0 | 40 | virtual void onEndElement() = 0; |
michael@0 | 41 | |
michael@0 | 42 | struct Elem { |
michael@0 | 43 | SkString fName; |
michael@0 | 44 | bool fHasChildren; |
michael@0 | 45 | }; |
michael@0 | 46 | void doEnd(Elem* elem); |
michael@0 | 47 | bool doStart(const char name[], size_t length); |
michael@0 | 48 | Elem* getEnd(); |
michael@0 | 49 | const char* getHeader(); |
michael@0 | 50 | SkTDArray<Elem*> fElems; |
michael@0 | 51 | |
michael@0 | 52 | private: |
michael@0 | 53 | bool fDoEscapeMarkup; |
michael@0 | 54 | // illegal |
michael@0 | 55 | SkXMLWriter& operator=(const SkXMLWriter&); |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | class SkXMLStreamWriter : public SkXMLWriter { |
michael@0 | 59 | public: |
michael@0 | 60 | SkXMLStreamWriter(SkWStream*); |
michael@0 | 61 | virtual ~SkXMLStreamWriter(); |
michael@0 | 62 | virtual void writeHeader(); |
michael@0 | 63 | SkDEBUGCODE(static void UnitTest();) |
michael@0 | 64 | protected: |
michael@0 | 65 | virtual void onStartElementLen(const char elem[], size_t length); |
michael@0 | 66 | virtual void onEndElement(); |
michael@0 | 67 | virtual void onAddAttributeLen(const char name[], const char value[], size_t length); |
michael@0 | 68 | private: |
michael@0 | 69 | SkWStream& fStream; |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | class SkXMLParserWriter : public SkXMLWriter { |
michael@0 | 73 | public: |
michael@0 | 74 | SkXMLParserWriter(SkXMLParser*); |
michael@0 | 75 | virtual ~SkXMLParserWriter(); |
michael@0 | 76 | protected: |
michael@0 | 77 | virtual void onStartElementLen(const char elem[], size_t length); |
michael@0 | 78 | virtual void onEndElement(); |
michael@0 | 79 | virtual void onAddAttributeLen(const char name[], const char value[], size_t length); |
michael@0 | 80 | private: |
michael@0 | 81 | SkXMLParser& fParser; |
michael@0 | 82 | }; |
michael@0 | 83 | |
michael@0 | 84 | |
michael@0 | 85 | #endif |