-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
personalization: highlight selected preset backlight color
Add KeyboardBacklightObserver interface to notify the JS side the selected backlight color. This only highlights the selected preset color options currently. The capability to select and highlight wallpaper extracted color will be done in a subsequent CL. BUG=b/227374197 TEST=browser_tests --gtest_filter="*PersonalizationAppKeyboardBacklight*" TEST=unit_tests --gtest_filter="*PersonalizationAppKeyboardBacklightProviderImpl*" Cq-Include-Trybots: luci.chrome.try:linux-chromeos-chrome Change-Id: I7ffe5e37443a6304242dbe1648941608a79a313f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3614652 Reviewed-by: Sam McNally <sammc@chromium.org> Reviewed-by: Jeffrey Young <cowmoo@chromium.org> Commit-Queue: Jason Thai <jasontt@chromium.org> Cr-Commit-Position: refs/heads/main@{#1001333}
- Loading branch information
Jason Thai
authored and
Chromium LUCI CQ
committed
May 10, 2022
1 parent
4d69c0f
commit 97fdff7
Showing
12 changed files
with
223 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...i/personalization_app/resources/trusted/keyboard_backlight/keyboard_backlight_observer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import {BacklightColor, KeyboardBacklightObserverInterface, KeyboardBacklightObserverReceiver, KeyboardBacklightProviderInterface} from '../personalization_app.mojom-webui.js'; | ||
import {PersonalizationStore} from '../personalization_store.js'; | ||
|
||
import {setBacklightColorAction} from './keyboard_backlight_actions.js'; | ||
import {getKeyboardBacklightProvider} from './keyboard_backlight_interface_provider.js'; | ||
|
||
/** @fileoverview listens for updates on keyboard backlight settings changes. */ | ||
|
||
let instance: KeyboardBacklightObserver|null = null; | ||
|
||
/** | ||
* Observes keyboard backlight changes and saves updates to | ||
* PersonalizationStore. | ||
*/ | ||
export class KeyboardBacklightObserver implements | ||
KeyboardBacklightObserverInterface { | ||
static initKeyboardBacklightObserverIfNeeded(): void { | ||
if (!instance) { | ||
instance = new KeyboardBacklightObserver(); | ||
} | ||
} | ||
|
||
static shutdown() { | ||
if (instance) { | ||
instance.receiver_.$.close(); | ||
instance = null; | ||
} | ||
} | ||
|
||
receiver_: KeyboardBacklightObserverReceiver = | ||
this.initReceiver_(getKeyboardBacklightProvider()); | ||
|
||
private initReceiver_(KeyboardBacklightProvider: | ||
KeyboardBacklightProviderInterface): | ||
KeyboardBacklightObserverReceiver { | ||
const receiver = new KeyboardBacklightObserverReceiver(this); | ||
KeyboardBacklightProvider.setKeyboardBacklightObserver( | ||
receiver.$.bindNewPipeAndPassRemote()); | ||
return receiver; | ||
} | ||
|
||
onBacklightColorChanged(backlightColor: BacklightColor): void { | ||
const store = PersonalizationStore.getInstance(); | ||
store.dispatch(setBacklightColorAction(backlightColor)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.