Bug 1270832 - Activate standard c++ library hardening r=glandium
[gecko.git] / widget / RemoteLookAndFeel.h
blob918f3392ec3092f7dc1545b68881d79bab112c7a
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef mozilla_widget_RemoteLookAndFeel_h__
9 #define mozilla_widget_RemoteLookAndFeel_h__
11 #include "mozilla/widget/nsXPLookAndFeel.h"
12 #include "mozilla/widget/LookAndFeelTypes.h"
14 namespace mozilla::widget {
16 /**
17 * A LookAndFeel implementation whose native values are provided by the
18 * parent process.
20 class RemoteLookAndFeel final : public nsXPLookAndFeel {
21 public:
22 explicit RemoteLookAndFeel(FullLookAndFeel&& aTables);
24 virtual ~RemoteLookAndFeel();
26 void NativeInit() override {}
28 nsresult NativeGetInt(IntID, int32_t& aResult) override;
29 nsresult NativeGetFloat(FloatID, float& aResult) override;
30 nsresult NativeGetColor(ColorID, ColorScheme, nscolor& aResult) override;
31 bool NativeGetFont(FontID aID, nsString& aFontName,
32 gfxFontStyle& aFontStyle) override;
34 char16_t GetPasswordCharacterImpl() override;
35 bool GetEchoPasswordImpl() override;
37 // Sets the LookAndFeel data to be used by this content process' singleton
38 // RemoteLookAndFeel object.
39 void SetDataImpl(FullLookAndFeel&& aTables) override;
41 // Extracts the data from the platform's default LookAndFeel implementation.
43 // This is called in the parent process to obtain the data to send down to
44 // content processes when they are created (and when the OS theme changes).
46 // Note that the pointer returned from here is only valid until the next time
47 // ClearCachedData is called.
48 static const FullLookAndFeel* ExtractData();
50 // Clears any cached extracted data from the platform's default LookAndFeel
51 // implementation.
53 // This is called in the parent process when the default LookAndFeel is
54 // refreshed, to invalidate sCachedLookAndFeelData.
55 static void ClearCachedData();
57 private:
58 LookAndFeelTables mTables;
61 } // namespace mozilla::widget
63 #endif // mozilla_widget_RemoteLookAndFeel_h__