* TTS fixes. Added reading word highlight. Added state for inline play/pause button. Added description in the TTS list. Fixed paragraph highlight style. Pause TTS when changing toolbar state. Fixed colors to use leo::colors. Added progress animation for underline.
143 lines
2.8 KiB
Plaintext
143 lines
2.8 KiB
Plaintext
// Copyright (c) 2022 The Brave Authors. All rights reserved.
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
module speedreader.mojom;
|
|
|
|
interface ToolbarFactory {
|
|
CreateInterfaces(pending_receiver<ToolbarDataHandler> toolbar_data_handler,
|
|
pending_remote<ToolbarEventsHandler> toolbar_events_handler);
|
|
};
|
|
|
|
interface ToolbarDataHandler {
|
|
GetAppearanceSettings() =>(AppearanceSettings appearance_settings);
|
|
SetAppearanceSettings(AppearanceSettings appearance_settings);
|
|
|
|
GetTtsSettings() => (TtsSettings tts_settings);
|
|
SetTtsSettings(TtsSettings tts_settings);
|
|
|
|
ObserveThemeChange();
|
|
|
|
ShowTuneBubble(bool show);
|
|
|
|
ViewOriginal();
|
|
|
|
HideToolbar();
|
|
|
|
AiChat();
|
|
|
|
GetPlaybackState() => (PlaybackState playback_state);
|
|
|
|
Rewind();
|
|
Play();
|
|
Pause();
|
|
Stop();
|
|
Forward();
|
|
|
|
OnToolbarStateChanged(MainButtonType button);
|
|
};
|
|
|
|
interface ToolbarEventsHandler {
|
|
OnAppearanceSettingsChanged(AppearanceSettings appearance_settings);
|
|
OnTtsSettingsChanged(TtsSettings tts_settings);
|
|
OnBrowserThemeChanged(ToolbarColors colors);
|
|
OnTuneBubbleClosed();
|
|
|
|
SetPlaybackState(PlaybackState playback_state);
|
|
};
|
|
|
|
struct AppearanceSettings {
|
|
Theme theme = Theme.kNone;
|
|
FontSize fontSize = FontSize.k100;
|
|
FontFamily fontFamily = FontFamily.kSans;
|
|
ColumnWidth columnWidth = ColumnWidth.kNarrow;
|
|
};
|
|
|
|
struct TtsSettings {
|
|
string voice;
|
|
PlaybackSpeed speed = PlaybackSpeed.k100;
|
|
};
|
|
|
|
struct ToolbarColors {
|
|
uint32 background;
|
|
uint32 foreground;
|
|
uint32 border;
|
|
uint32 button_hover;
|
|
uint32 button_active;
|
|
uint32 button_border;
|
|
uint32 button_active_text;
|
|
};
|
|
|
|
enum MainButtonType {
|
|
None,
|
|
Tune,
|
|
Appearance,
|
|
TextToSpeech,
|
|
AI,
|
|
};
|
|
|
|
// Enum is used in prefs. Be careful when changing or extending.
|
|
enum Theme {
|
|
kNone = 0, // User doesn't select anything.
|
|
kLight = 1,
|
|
kSepia = 2,
|
|
kDark = 3,
|
|
};
|
|
|
|
// Enum is used in prefs. Be careful when changing or extending.
|
|
// Font size in percents.
|
|
enum FontSize {
|
|
k50 = 50,
|
|
k60 = 60,
|
|
k70 = 70,
|
|
k80 = 80,
|
|
k90 = 90,
|
|
k100 = 100,
|
|
k110 = 110,
|
|
k120 = 120,
|
|
k130 = 130,
|
|
k140 = 140,
|
|
k150 = 150,
|
|
};
|
|
|
|
// Enum is used in prefs. Be careful when changing or extending.
|
|
enum FontFamily {
|
|
kSans = 0,
|
|
kSerif = 1,
|
|
kMono = 2,
|
|
kDyslexic = 3,
|
|
};
|
|
|
|
// Enum is used in prefs. Be careful when changing or extending.
|
|
enum ColumnWidth {
|
|
kNarrow = 0,
|
|
kWide = 1,
|
|
};
|
|
|
|
// Enum is used in prefs. Be careful when changing or extending.
|
|
enum PlaybackSpeed {
|
|
k50 = 50,
|
|
k60 = 60,
|
|
k70 = 70,
|
|
k80 = 80,
|
|
k90 = 90,
|
|
k100 = 100,
|
|
k110 = 110,
|
|
k120 = 120,
|
|
k130 = 130,
|
|
k140 = 140,
|
|
k150 = 150,
|
|
k160 = 160,
|
|
k170 = 170,
|
|
k180 = 180,
|
|
k190 = 190,
|
|
k200 = 200,
|
|
};
|
|
|
|
enum PlaybackState {
|
|
kStopped = 1,
|
|
kPlayingThisPage = 2,
|
|
kPlayingAnotherPage = 3,
|
|
};
|