Prepared for using different FirstRun dialog on Win

Modifed FirstRun dialog is used on macOS/Linux.
And we'll use our own FirstRun dialog on Win.
This commit is contained in:
Simon Hong
2022-03-20 23:01:46 +09:00
parent 157d6e3046
commit 7502849e77
6 changed files with 32 additions and 23 deletions
-3
View File
@@ -1656,9 +1656,6 @@ Are you sure you want to do this?
<message name="IDS_FIRSTRUN_DLG_COMPLETE_INSTALLATION_LABEL_BRAVE" desc="Label at top of Dialog noting what's going to happen">
To ensure the best privacy online, consider setting Brave as the default browser on your computer. With Brave as default, any web link you click will open with Brave's privacy protections.
</message>
<message name="IDS_FIRSTRUN_DIALOG_WINDOW_TITLE_BRAVE" desc="Window title of First Run dialog, displayed in title bar">
Welcome to Brave
</message>
<message name="IDS_SETTINGS_WALLET_NETWORKS_ITEM" desc="The label for opening wallet networks list">
Networks
</message>
+3 -3
View File
@@ -182,12 +182,12 @@ source_set("ui") {
"views/web_discovery_dialog_view.h",
]
# Enable FirstRun dialog on Win.
# Use different FirstRun dialog UI on Win.
# Upstream only includes it on mac/Linux.
if (is_win) {
sources += [
"//chrome/browser/ui/views/first_run_dialog.cc",
"//chrome/browser/ui/views/first_run_dialog.h",
"views/first_run_dialog_win.cc",
"views/first_run_dialog_win.h",
]
}
+16
View File
@@ -0,0 +1,16 @@
/* 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 http://mozilla.org/MPL/2.0/. */
#include "brave/browser/ui/views/first_run_dialog_win.h"
#include "chrome/browser/first_run/first_run_dialog.h"
namespace first_run {
void ShowFirstRunDialog(Profile* profile) {
// TODO(simonhong): Launch FirstRunDialogWin.
}
} // namespace first_run
+11
View File
@@ -0,0 +1,11 @@
/* 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 http://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_WIN_H_
#define BRAVE_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_WIN_H_
// TODO(simonhong): Implement FirstRunDialogWin.
#endif // BRAVE_BROWSER_UI_VIEWS_FIRST_RUN_DIALOG_WIN_H_
@@ -19,7 +19,6 @@ namespace first_run {
// Enable first run dialog on Win also.
// Upstream only uses it for macOS/Linux.
void ShowFirstRunDialog(Profile* profile);
void ShowFirstRunDialogViews(Profile* profile);
} // namespace first_run
@@ -8,7 +8,6 @@
#include <string>
#include "base/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "brave/grit/brave_generated_resources.h"
#include "build/build_config.h"
@@ -31,10 +30,6 @@
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_delegate.h"
#if BUILDFLAG(IS_WIN)
#include "brave/browser/brave_shell_integration.h"
#endif
namespace first_run {
void ShowFirstRunDialog(Profile* profile) {
@@ -77,7 +72,7 @@ FirstRunDialog::FirstRunDialog(base::RepeatingClosure learn_more_callback,
if (report_crashes_)
report_crashes_->GetChecked();
SetTitle(l10n_util::GetStringUTF16(IDS_FIRSTRUN_DIALOG_WINDOW_TITLE_BRAVE));
SetTitle(l10n_util::GetStringUTF16(IDS_FIRST_RUN_DIALOG_WINDOW_TITLE));
SetButtons(ui::DIALOG_BUTTON_OK);
SetExtraView(
std::make_unique<views::Link>(l10n_util::GetStringUTF16(IDS_LEARN_MORE)))
@@ -122,17 +117,8 @@ void FirstRunDialog::Done() {
bool FirstRunDialog::Accept() {
GetWidget()->Hide();
if (make_default_->GetChecked()) {
// shell_integration::SetAsDefaultBrowser() doesn't work on Windows 8+.
// Upstream will use DefaultBrowserWorker when it's available on all OSs.
// See the comments of shell_integration::SetAsDefaultBrowser().
#if BUILDFLAG(IS_WIN)
base::MakeRefCounted<shell_integration::BraveDefaultBrowserWorker>()
->StartSetAsDefault(base::NullCallback());
#else
if (make_default_->GetChecked())
shell_integration::SetAsDefaultBrowser();
#endif
}
Done();
return true;