-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
182 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
--- a/chrome/browser/chrome_browser_main.cc | ||
+++ b/chrome/browser/chrome_browser_main.cc | ||
@@ -985,6 +985,7 @@ int ChromeBrowserMainParts::PreCreateThr | ||
if (first_run::IsChromeFirstRun()) { | ||
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kApp) && | ||
!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppId)) { | ||
+ browser_creator_->AddFirstRunTabs({GURL("chrome://ungoogled-first-run")}); | ||
browser_creator_->AddFirstRunTabs(master_prefs_->new_tabs); | ||
} | ||
|
||
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc | ||
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc | ||
@@ -65,6 +65,7 @@ | ||
#include "chrome/browser/ui/webui/suggest_internals/suggest_internals_ui.h" | ||
#include "chrome/browser/ui/webui/sync_internals/sync_internals_ui.h" | ||
#include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" | ||
+#include "chrome/browser/ui/webui/ungoogled_first_run.h" | ||
#include "chrome/browser/ui/webui/usb_internals/usb_internals_ui.h" | ||
#include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" | ||
#include "chrome/browser/ui/webui/version/version_ui.h" | ||
@@ -1251,6 +1252,8 @@ WebUIFactoryFunction GetWebUIFactoryFunc | ||
} | ||
#endif | ||
|
||
+ if (url.host() == "ungoogled-first-run") return &NewWebUI<UngoogledFirstRun>; | ||
+ | ||
return nullptr; | ||
} | ||
|
||
--- /dev/null | ||
+++ b/chrome/browser/ui/webui/ungoogled_first_run.h | ||
@@ -0,0 +1,149 @@ | ||
+#ifndef CHROME_BROWSER_UI_WEBUI_UNGOOGLED_FIRST_RUN_H_ | ||
+#define CHROME_BROWSER_UI_WEBUI_UNGOOGLED_FIRST_RUN_H_ | ||
+ | ||
+#include "base/memory/ref_counted_memory.h" | ||
+#include "chrome/browser/profiles/profile.h" | ||
+#include "content/public/browser/url_data_source.h" | ||
+#include "content/public/browser/web_ui.h" | ||
+#include "content/public/browser/web_ui_controller.h" | ||
+#include "services/network/public/mojom/content_security_policy.mojom.h" | ||
+ | ||
+class UFRDataSource : public content::URLDataSource { | ||
+ public: | ||
+ UFRDataSource() {} | ||
+ UFRDataSource(const UFRDataSource&) = delete; | ||
+ UFRDataSource& operator=(const UFRDataSource&) = delete; | ||
+ std::string GetSource() { return "ungoogled-first-run"; } | ||
+ std::string GetMimeType(const GURL& url) { return "text/html"; } | ||
+ std::string GetContentSecurityPolicy(network::mojom::CSPDirectiveName directive) { | ||
+ if (directive == network::mojom::CSPDirectiveName::ScriptSrc) | ||
+ return "script-src 'unsafe-inline'"; | ||
+ return std::string(); | ||
+ } | ||
+ void StartDataRequest(const GURL& url, | ||
+ const content::WebContents::Getter& wc_getter, | ||
+ GotDataCallback callback) { | ||
+ std::string source = R"( | ||
+<html> | ||
+ <head> | ||
+ <title>ungoogled-chromium first run page</title> | ||
+ <style> | ||
+ @import url(chrome://resources/css/text_defaults_md.css); | ||
+ html{color:#202124; background:white; line-height:1.25em} | ||
+ a{color:#1967d2} | ||
+ h1{margin:0} | ||
+ ul,ol{padding-left:2em} | ||
+ code{background:rgba(0 0 0 / .2); padding:0 0.5em; border-radius:0.25em} | ||
+ summary{cursor:pointer} | ||
+ .section{background:white; width:60em; margin:4em auto; padding:1em 0; border-radius:.5em; | ||
+ box-shadow:0 .063em .125em 0 #c4c5c6, 0 .125em .375em .125em #e2e3e3} | ||
+ .row{padding:1em 2em} | ||
+ .row:not(:first-child){border-top:.063em solid #f0f0f0} | ||
+ @media(prefers-color-scheme:dark){ | ||
+ html{color:#e8eaed; background:#202124} | ||
+ a{color:#8ab4f8} | ||
+ .section{background:#292a2d; | ||
+ box-shadow:0 .063em .125em 0 #161719, 0 .125em .375em .125em #1b1c1f} | ||
+ .row:not(:first-child){border-top:.063em solid #3f4042} | ||
+ } | ||
+ </style> | ||
+ <base target="_blank"> | ||
+ </head> | ||
+ <body> | ||
+ <div class=section> | ||
+ <div class=row><h1>How-To</h1></div> | ||
+ <div class=row><details><summary><b>Install and auto update extensions</b></summary><br> | ||
+ <a href="https://github.com/NeverDecaf">NeverDecaf</a> has created an extension to make this process easy: | ||
+ <ol> | ||
+ <li>Set <a href="chrome://flags/#extension-mime-request-handling">extension-mime-request-handling</a> | ||
+ to <code>Always prompt for install</code> and relaunch.</li> | ||
+ <li>Then click on the latest <code>Chromium.Web.Store.crx</code> link on | ||
+ <a href="https://github.com/NeverDecaf/chromium-web-store/releases">the extension's Releases page</a>.</li> | ||
+ </ol> | ||
+ Please check out the <a href="https://github.com/NeverDecaf/chromium-web-store">chromium-web-store</a> | ||
+ repo for further details and alternate installation methods.<br> | ||
+ More information can be found on the wiki if you wish to | ||
+ <a href="https://ungoogled-software.github.io/ungoogled-chromium-wiki/faq#downloading-the-crx-file"> | ||
+ install extensions manually</a>.</details> | ||
+ </div> | ||
+ <div class=row><details><summary><b>Keep login and session data</b></summary><br> | ||
+ By default ungoogled-chromium has <code>Clear cookies and site data when you close all windows</code> enabled.<br> | ||
+ This option can be changed in | ||
+ <a href="chrome://settings/cookies?search=Clear+cookies+and+site+data+when+you+close+all+windows"> | ||
+ chrome://settings/cookies</a>. | ||
+ </div> | ||
+ <div class=row><details><summary><b>Enable spellcheck</b></summary> | ||
+ <ol> | ||
+ <li>Go to <a href="https://chromium.googlesource.com/chromium/deps/hunspell_dictionaries/+/main"> | ||
+ https://chromium.googlesource.com/chromium/deps/hunspell_dictionaries/+/main</a></li> | ||
+ <li>Find a bdic file for the language you want and click on it. | ||
+ You will see a mostly empty page aside from "X-byte binary file"</li> | ||
+ <li>On the bottom right corner, click "txt". The direct link for en-US-10-1.bdic is: | ||
+ <a href="https://chromium.googlesource.com/chromium/deps/hunspell_dictionaries/+/main/en-US-10-1.bdic?format=TEXT"> | ||
+ https://chromium.googlesource.com/chromium/deps/hunspell_dictionaries/+/main/en-US-10-1.bdic?format=TEXT</a></li> | ||
+ <li>This is a base64-encoded file that needs to be decoded. Use the button below to select the .txt file you saved | ||
+ and save/move the resulting bdic file to your Dictionaries directory. Default locations: | ||
+ <ul> | ||
+ <li>Linux: <code>~/.config/chromium/Dictionaries/</code><br></li> | ||
+ <li>Mac: <code>~/Library/Application Support/Chromium/Dictionaries/</code><br></li> | ||
+ <li>Windows: <code>%LOCALAPPDATA%\Chromium\User Data\Dictionaries\</code><br></li> | ||
+ </ul> | ||
+ <input id="bdic" type="file" accept=".txt,text/plain" /> | ||
+ </li> | ||
+ <li>Toggle spell check in <a href="chrome://settings/languages">chrome://settings/languages</a>, | ||
+ or restart the browser for the dictionaries to take effect.</li> | ||
+ </ol></details> | ||
+ </div> | ||
+ <div class=row> | ||
+ <a href="https://ungoogled-software.github.io/ungoogled-chromium-wiki/faq"> | ||
+ Check out the FAQ on the wiki</a> for information on other common topics. | ||
+ </div> | ||
+ </div> | ||
+ <div class=section> | ||
+ <div class=row><h1>Extra Features</h1></div> | ||
+ <div class=row> | ||
+ Most features introduced by ungoogled-chromium are disabled by default and can be enabled in | ||
+ <a href="chrome://flags">chrome://flags</a> or as command-line switches.<br><br> | ||
+ Take a look at <a href="https://github.com/ungoogled-software/ungoogled-chromium/blob/master/docs/flags.md"> | ||
+ the flags documentation</a> to see what features you may find useful to enable. | ||
+ </div> | ||
+ </div> | ||
+ <div class=section> | ||
+ <div class=row><h1>ungoogled-chromium</h1></div> | ||
+ <div class=row> | ||
+ Visit our <a href="https://github.com/ungoogled-software/ungoogled-chromium/blob/master/SUPPORT.md"> | ||
+ support page</a> if you wish to report problems. | ||
+ </div> | ||
+ <div class=row> | ||
+ Are you a developer? Consider | ||
+ <a href="https://github.com/ungoogled-software/ungoogled-chromium/blob/master/docs/contributing.md"> | ||
+ contributing</a> to ungoogled-chromium! | ||
+ </div> | ||
+ </div> | ||
+ <script> | ||
+ document.getElementById("bdic").onchange = function(e){ | ||
+ var f = new FileReader; | ||
+ f.onload = function(){ | ||
+ var a = document.createElement("a"); | ||
+ a.setAttribute("href", "data:application/octet-stream;base64, " + f.result); | ||
+ a.setAttribute("download", e.target.files[0].name.replace(/\.[^/.]+$/, ".bdic")); | ||
+ a.click() | ||
+ }, f.readAsText(this.files[0])}; | ||
+ </script> | ||
+ </body> | ||
+</html> | ||
+)"; | ||
+ std::move(callback).Run(base::MakeRefCounted<base::RefCountedString>(std::move(source))); | ||
+ } | ||
+}; | ||
+ | ||
+class UngoogledFirstRun : public content::WebUIController { | ||
+ public: | ||
+ UngoogledFirstRun(content::WebUI* web_ui) : content::WebUIController(web_ui) { | ||
+ content::URLDataSource::Add(Profile::FromWebUI(web_ui), std::make_unique<UFRDataSource>()); | ||
+ } | ||
+ UngoogledFirstRun(const UngoogledFirstRun&) = delete; | ||
+ UngoogledFirstRun& operator=(const UngoogledFirstRun&) = delete; | ||
+}; | ||
+ | ||
+#endif // CHROME_BROWSER_UI_WEBUI_UNGOOGLED_FIRST_RUN_H_ |
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