power: Refactor brightness scale code into a CcBrightnessScale class
This reduces some redundancy between the screen brightness and keyboard brightness code.
Such refactoring is a prerequisite for including a keyboard backlight control in the Keyboard panel, as has been proposed. But hopefully this makes the code a bit neater and more managable even without that.