Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splited p3a from crash report option from first run dialog #7978

Merged
merged 1 commit into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/brave_generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -1093,16 +1093,15 @@ up to 6x faster on major news sites.
Reset Brave Rewards data...
</message>
<!--First-run dialog messages -->
<message name="IDS_FR_ENABLE_LOGGING_BRAVE" desc="Label for checkbox to ask whether to send usage stats to brave">
Help improve Brave by sending crash reports and
completely anonymised, private product analytics.
<message name="IDS_FR_ENABLE_LOGGING_BRAVE" desc="Label for checkbox to ask whether to send crash reports to brave">
Help improve Brave by automatically sending crash reports
</message>
<message name="IDS_FR_CUSTOMIZE_DEFAULT_BROWSER_BRAVE" desc="Default browser checkbox label">
Set Brave as your default browser
</message>
<if expr="is_macosx">
<message name="IDS_FIRSTRUN_DLG_MAC_OPTIONS_SEND_USAGE_STATS_LABEL_BRAVE" desc="Label for checkbox to ask whether to send usage stats to Google">
Help improve <ph name="PRODUCT_NAME">$1<ex>Brave</ex></ph> by sending crash reports and completely anonymised, private product analytics.
<message name="IDS_FIRSTRUN_DLG_MAC_OPTIONS_SEND_USAGE_STATS_LABEL_BRAVE" desc="Label for checkbox to ask whether to send crash reports to brave">
Help improve <ph name="PRODUCT_NAME">$1<ex>Brave</ex></ph> by automatically sending crash reports
</message>
</if>
</messages>
Expand Down
16 changes: 16 additions & 0 deletions browser/first_run/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2021 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/.

source_set("unit_tests") {
testonly = true
if (!is_android) {
sources = [ "first_run_unittest.cc" ]

deps = [
"//chrome/browser",
"//testing/gtest",
]
}
}
11 changes: 11 additions & 0 deletions browser/first_run/first_run_unittest.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* Copyright (c) 2021 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 "chrome/browser/first_run/first_run.h"
#include "testing/gtest/include/gtest/gtest.h"

TEST(FirstRunTest, BasicTest) {
EXPECT_TRUE(first_run::IsMetricsReportingOptIn());
}
19 changes: 19 additions & 0 deletions chromium_src/chrome/browser/first_run/first_run.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Copyright (c) 2021 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/. */

#define IsMetricsReportingOptIn IsMetricsReportingOptIn_UnUsed
#include "../../../../../chrome/browser/first_run/first_run.cc"
#undef IsMetricsReportingOptIn

namespace first_run {

// This is only used for determine whether crash report checkbox in the first
// run dialog is checked or not by default. See the comments of this upstream
// function. Returning true means crash report is unchecked by default.
bool IsMetricsReportingOptIn() {
return true;
}

} // namespace first_run
55 changes: 0 additions & 55 deletions chromium_src/chrome/browser/ui/cocoa/first_run_dialog.mm

This file was deleted.

18 changes: 0 additions & 18 deletions chromium_src/chrome/browser/ui/views/first_run_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,15 @@
#include "brave/grit/brave_generated_resources.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "ui/views/controls/button/checkbox.h"

namespace views {
// Override to call SetMultiLine().
// The label of crash report checkbox should be formatted to 2 lines.
// Otherwise, dialog width is too long.
class MultiLineCheckBox : public views::Checkbox {
public:
explicit MultiLineCheckBox(const base::string16& label) : Checkbox(label) {
SetMultiLine(true);
}
~MultiLineCheckBox() override = default;
MultiLineCheckBox(const MultiLineCheckBox&) = delete;
MultiLineCheckBox& operator=(const MultiLineCheckBox&) = delete;
};
} // namespace views

// Replaced string here instead of by running 'npm run chromium_rebase_l10n'
// because same string is used from other IDS_XXX..
#undef IDS_FR_ENABLE_LOGGING
#undef IDS_FR_CUSTOMIZE_DEFAULT_BROWSER
#define IDS_FR_ENABLE_LOGGING IDS_FR_ENABLE_LOGGING_BRAVE
#define IDS_FR_CUSTOMIZE_DEFAULT_BROWSER IDS_FR_CUSTOMIZE_DEFAULT_BROWSER_BRAVE
#define Checkbox MultiLineCheckBox

#include "../../../../../../chrome/browser/ui/views/first_run_dialog.cc"

#undef IDS_FR_ENABLE_LOGGING
#undef IDS_FR_CUSTOMIZE_DEFAULT_BROWSER
#undef Checkbox
1 change: 1 addition & 0 deletions test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ test("brave_unit_tests") {
"//brave/browser/browsing_data",
"//brave/browser/content_settings:unit_tests",
"//brave/browser/download",
"//brave/browser/first_run:unit_tests",
"//brave/browser/metrics/test:brave_metrics_unit_tests",
"//brave/browser/net",
"//brave/browser/new_tab:unittest",
Expand Down