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