Skip to content
This repository has been archived by the owner on Feb 6, 2021. It is now read-only.

Commit

Permalink
[Windows] Upload EyeProtect v1.0.0 for Chromium v77.0.3865.90 (Stable)
Browse files Browse the repository at this point in the history
久 等 了
  • Loading branch information
fengberd committed Oct 4, 2019
1 parent b9deb08 commit 9729573
Show file tree
Hide file tree
Showing 5 changed files with 1,957 additions and 0 deletions.
@@ -0,0 +1,157 @@
From aea2b4adea8392e93d0826daea36bf467531ebe2 Mon Sep 17 00:00:00 2001
From: fengberd <admin@berd.moe>
Date: Thu, 3 Oct 2019 23:30:57 +0800
Subject: [PATCH 1/5] [Eye Protect] Added eye-protect flag

---
chrome/browser/about_flags.cc | 3 +++
chrome/browser/chromeos/login/chrome_restart_request.cc | 1 +
chrome/browser/flag-metadata.json | 7 +++++++
chrome/browser/flag_descriptions.cc | 4 ++++
chrome/browser/flag_descriptions.h | 3 +++
ui/base/material_design/material_design_controller.cc | 2 ++
ui/base/material_design/material_design_controller.h | 4 ++++
ui/base/ui_base_switches.cc | 2 ++
ui/base/ui_base_switches.h | 2 ++
9 files changed, 28 insertions(+)

diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 245672956715..fea2ff80793c 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1452,6 +1452,9 @@ const FeatureEntry kFeatureEntries[] = {
{"top-chrome-touch-ui", flag_descriptions::kTopChromeTouchUiName,
flag_descriptions::kTopChromeTouchUiDescription, kOsDesktop,
MULTI_VALUE_TYPE(kTopChromeTouchUiChoices)},
+ {"eye-protection", flag_descriptions::kEyeProtectionName,
+ flag_descriptions::kEyeProtectionDescription, kOsDesktop,
+ SINGLE_VALUE_TYPE(switches::kEyeProtection)},
#if !defined(OS_ANDROID)
{"new-tab-loading-animation", flag_descriptions::kNewTabLoadingAnimation,
flag_descriptions::kNewTabLoadingAnimationDescription, kOsDesktop,
diff --git a/chrome/browser/chromeos/login/chrome_restart_request.cc b/chrome/browser/chromeos/login/chrome_restart_request.cc
index 8144d9e83c53..3bb096f4995c 100644
--- a/chrome/browser/chromeos/login/chrome_restart_request.cc
+++ b/chrome/browser/chromeos/login/chrome_restart_request.cc
@@ -143,6 +143,7 @@ void DeriveCommandLine(const GURL& start_url,
::switches::kTouchDevices,
::switches::kTouchEventFeatureDetection,
::switches::kTopChromeTouchUi,
+ ::switches::kEyeProtection,
::switches::kTraceToConsole,
::switches::kUIDisablePartialSwap,
#if defined(USE_CRAS)
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index 3c264eb12461..3af9dee73bf3 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -3263,4 +3263,11 @@

// This is an alphabetized list; please do your part to keep it organized by
// inserting your entry in alphabetical order.
+
+ ,
+ { // I dont care cuz this wont be commited to chromium project :/
+ "name": "eye-protection",
+ "owners": [ "admin@berd.moe" ],
+ "expiry_milestone": -1
+ }
]
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 4321b01dd270..265ed17fc3ec 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -1903,6 +1903,10 @@ const char kTopChromeTouchUiName[] = "Touch UI Layout";
const char kTopChromeTouchUiDescription[] =
"Enables touch UI layout in the browser's top chrome.";

+const char kEyeProtectionName[] = "Eye Protection";
+const char kEyeProtectionDescription[] =
+ "Protect your eyes from being hurt by Material Disaster 2";
+
const char kThreadedScrollingName[] = "Threaded scrolling";
const char kThreadedScrollingDescription[] =
"Threaded handling of scroll-related input events. Disabling this will "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index ebca9b5eba2e..2431c0f3d5d6 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -1131,6 +1131,9 @@ extern const char kTintGlCompositedContentDescription[];
extern const char kTopChromeTouchUiName[];
extern const char kTopChromeTouchUiDescription[];

+extern const char kEyeProtectionName[];
+extern const char kEyeProtectionDescription[];
+
extern const char kThreadedScrollingName[];
extern const char kThreadedScrollingDescription[];

diff --git a/ui/base/material_design/material_design_controller.cc b/ui/base/material_design/material_design_controller.cc
index 97e42d5478b0..ac9462b70a96 100644
--- a/ui/base/material_design/material_design_controller.cc
+++ b/ui/base/material_design/material_design_controller.cc
@@ -51,11 +51,13 @@ void TabletModeWatcherWinProc(HWND hwnd,
#endif // defined(OS_WIN)

bool MaterialDesignController::touch_ui_ = false;
+bool MaterialDesignController::eye_protection_ = false;
bool MaterialDesignController::automatic_touch_ui_ = false;

// static
void MaterialDesignController::Initialize() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ eye_protection_ = command_line->HasSwitch(switches::kEyeProtection);
const std::string switch_value =
command_line->GetSwitchValueASCII(switches::kTopChromeTouchUi);
bool touch = switch_value == switches::kTopChromeTouchUiEnabled;
diff --git a/ui/base/material_design/material_design_controller.h b/ui/base/material_design/material_design_controller.h
index 1e27b70bcfdb..97a22c492969 100644
--- a/ui/base/material_design/material_design_controller.h
+++ b/ui/base/material_design/material_design_controller.h
@@ -33,6 +33,8 @@ class UI_BASE_EXPORT MaterialDesignController {
// Initializes touch UI state based on command-line flags.
static void Initialize();

+ static bool eye_protection() { return eye_protection_; }
+
static bool touch_ui() { return touch_ui_; }

// Exposed for TabletModeClient on ChromeOS + ash.
@@ -56,6 +58,8 @@ class UI_BASE_EXPORT MaterialDesignController {
// Whether the UI layout should be touch-optimized.
static bool touch_ui_;

+ static bool eye_protection_;
+
// Whether |touch_ui_| should toggle on and off depending on the tablet state.
static bool automatic_touch_ui_;

diff --git a/ui/base/ui_base_switches.cc b/ui/base/ui_base_switches.cc
index 16b6bbdcf116..78c752ba339b 100644
--- a/ui/base/ui_base_switches.cc
+++ b/ui/base/ui_base_switches.cc
@@ -65,6 +65,8 @@ const char kTopChromeTouchUiAuto[] = "auto";
const char kTopChromeTouchUiDisabled[] = "disabled";
const char kTopChromeTouchUiEnabled[] = "enabled";

+const char kEyeProtection[] = "eye-protection";
+
// Disable partial swap which is needed for some OpenGL drivers / emulators.
const char kUIDisablePartialSwap[] = "ui-disable-partial-swap";

diff --git a/ui/base/ui_base_switches.h b/ui/base/ui_base_switches.h
index 9f5f2c48c880..14da299fb436 100644
--- a/ui/base/ui_base_switches.h
+++ b/ui/base/ui_base_switches.h
@@ -39,6 +39,8 @@ UI_BASE_EXPORT extern const char kTopChromeTouchUiDisabled[];
UI_BASE_EXPORT extern const char kTopChromeTouchUiEnabled[];
UI_BASE_EXPORT extern const char kUIDisablePartialSwap[];

+UI_BASE_EXPORT extern const char kEyeProtection[];
+
// Test related.
UI_BASE_EXPORT extern const char kDisallowNonExactResourceReuse[];
UI_BASE_EXPORT extern const char kMangleLocalizedStrings[];
--
2.21.0.windows.1

0 comments on commit 9729573

Please sign in to comment.