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.
1 /*
2 * Copyright 2013 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 SkLua_DEFINED
9 #define SkLua_DEFINED
11 #include "SkClipStack.h"
12 #include "SkColor.h"
13 #include "SkScalar.h"
14 #include "SkString.h"
16 struct lua_State;
18 class SkCanvas;
19 class SkMatrix;
20 class SkPaint;
21 class SkPath;
22 struct SkRect;
23 class SkRRect;
25 #define SkScalarToLua(x) SkScalarToDouble(x)
26 #define SkLuaToScalar(x) SkDoubleToScalar(x)
28 class SkLua {
29 public:
30 static void Load(lua_State*);
32 SkLua(const char termCode[] = NULL); // creates a new L, will close it
33 SkLua(lua_State*); // uses L, will not close it
34 ~SkLua();
36 lua_State* get() const { return fL; }
37 lua_State* operator*() const { return fL; }
38 lua_State* operator->() const { return fL; }
40 bool runCode(const char code[]);
41 bool runCode(const void* code, size_t size);
43 void pushBool(bool, const char tableKey[] = NULL);
44 void pushString(const char[], const char tableKey[] = NULL);
45 void pushString(const char[], size_t len, const char tableKey[] = NULL);
46 void pushString(const SkString&, const char tableKey[] = NULL);
47 void pushArrayU16(const uint16_t[], int count, const char tableKey[] = NULL);
48 void pushColor(SkColor, const char tableKey[] = NULL);
49 void pushU32(uint32_t, const char tableKey[] = NULL);
50 void pushScalar(SkScalar, const char tableKey[] = NULL);
51 void pushRect(const SkRect&, const char tableKey[] = NULL);
52 void pushRRect(const SkRRect&, const char tableKey[] = NULL);
53 void pushMatrix(const SkMatrix&, const char tableKey[] = NULL);
54 void pushPaint(const SkPaint&, const char tableKey[] = NULL);
55 void pushPath(const SkPath&, const char tableKey[] = NULL);
56 void pushCanvas(SkCanvas*, const char tableKey[] = NULL);
57 void pushClipStack(const SkClipStack&, const char tableKey[] = NULL);
58 void pushClipStackElement(const SkClipStack::Element& element, const char tableKey[] = NULL);
60 // This SkCanvas lua methods is declared here to benefit from SkLua's friendship with SkCanvas.
61 static int lcanvas_getReducedClipStack(lua_State* L);
63 private:
64 lua_State* fL;
65 SkString fTermCode;
66 bool fWeOwnL;
67 };
69 #endif