Skip to content

Commit

Permalink
Improve licensing notice (fixes brave/brave-browser#6605)
Browse files Browse the repository at this point in the history
This add a link to the license, build instructions as well as the
corresponding source code.
  • Loading branch information
fmarier committed Oct 31, 2019
1 parent 763fc7e commit 8409f9e
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/brave_generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,11 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U
<message name="IDS_BRAVE_CRYPTO_WALLETS_SETUP" desc="Use Crypto Wallets">
SETUP
</message>
<!-- Brave's copyright statement -->
<message name="IDS_BRAVE_VERSION_UI_LICENSE" desc="The label below the copyright message, containing the URLs.">
Brave is made available to you under the <ph name="BEGIN_LINK_MPL">&lt;a target="_blank" href="$1"&gt;</ph>Mozilla Public License 2.0<ph name="END_LINK_MPL">&lt;/a&gt;</ph> (MPL) and includes <ph name="BEGIN_LINK_OSS">&lt;a target="_blank" href="$2"&gt;</ph>open source software<ph name="END_LINK_OSS">&lt;/a&gt;</ph> under a variety of other licenses.
You can read <ph name="BEGIN_LINK_BUILD_INSTRUCTIONS">&lt;a target="_blank" href="$3"&gt;</ph>instructions on how to download and build for yourself<ph name="END_LINK_BUILD_INSTRUCTIONS">&lt;/a&gt;</ph> the specific <ph name="BEGIN_LINK_SOURCE_CODE">&lt;a target="_blank" href="$4"&gt;</ph>source code used to create this copy<ph name="END_LINK_SOURCE_CODE">&lt;/a&gt;</ph>.
</message>
</messages>
<includes>
<include name="IDR_BRAVE_GOOGLE_ANALYTICS_POLYFILL" file="resources/js/google_analytics_polyfill.js" type="BINDATA" />
Expand Down
7 changes: 6 additions & 1 deletion browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ source_set("ui") {
"webui/brave_settings_ui.h",
"webui/navigation_bar_data_provider.cc",
"webui/navigation_bar_data_provider.h",
"webui/settings/brave_about_handler.cc",
"webui/settings/brave_about_handler.h",
"webui/settings/brave_privacy_handler.cc",
"webui/settings/brave_privacy_handler.h",
"webui/settings/default_brave_shields_handler.cc",
Expand Down Expand Up @@ -184,7 +186,10 @@ source_set("ui") {
}

if (!is_android) {
deps += [ "//brave/app:brave_generated_resources_grit" ]
deps += [
"//brave/app:brave_generated_resources_grit",
"//brave/browser:version_info",
]
}

if (enable_extensions && toolkit_views) {
Expand Down
43 changes: 43 additions & 0 deletions browser/ui/webui/settings/brave_about_handler.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* Copyright (c) 2019 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/. */

#include "brave/browser/ui/webui/settings/brave_about_handler.h"

#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "brave/browser/version_info.h"
#include "brave/grit/brave_generated_resources.h"
#include "chrome/browser/ui/webui/settings/about_handler.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_ui_data_source.h"
#include "ui/base/l10n/l10n_util.h"

namespace {

const char kBraveBuildInstructionsUrl[] =
"https://github.com/brave/brave-browser/wiki";
const char kBraveLicenseUrl[] = "https://mozilla.org/MPL/2.0/";
const char kBraveReleaseTagPrefix[] =
"https://github.com/brave/brave-browser/releases/tag/v";

} // namespace

namespace settings {

AboutHandler* BraveAboutHandler::Create(content::WebUIDataSource* html_source,
Profile* profile) {
AboutHandler* handler = AboutHandler::Create(html_source, profile);
base::string16 license = l10n_util::GetStringFUTF16(
IDS_BRAVE_VERSION_UI_LICENSE, base::ASCIIToUTF16(kBraveLicenseUrl),
base::ASCIIToUTF16(chrome::kChromeUICreditsURL),
base::ASCIIToUTF16(kBraveBuildInstructionsUrl),
base::ASCIIToUTF16(kBraveReleaseTagPrefix) +
base::UTF8ToUTF16(
version_info::GetBraveVersionWithoutChromiumMajorVersion()));
html_source->AddString("aboutProductLicense", license);
return handler;
}

} // namespace settings
27 changes: 27 additions & 0 deletions browser/ui/webui/settings/brave_about_handler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Copyright (c) 2019 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/. */

#ifndef BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_ABOUT_HANDLER_H_
#define BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_ABOUT_HANDLER_H_

class Profile;

namespace content {
class WebUIDataSource;
}

namespace settings {

class AboutHandler;

class BraveAboutHandler {
public:
static AboutHandler* Create(content::WebUIDataSource* html_source,
Profile* profile);
};

} // namespace settings

#endif // BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_ABOUT_HANDLER_H_
11 changes: 11 additions & 0 deletions chromium_src/chrome/browser/ui/webui/settings/settings_ui.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* Copyright (c) 2019 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/. */

#include "brave/browser/ui/webui/settings/brave_about_handler.h"
#include "chrome/browser/ui/webui/settings/about_handler.h"

#define AboutHandler BraveAboutHandler
#include "../../../../../../../chrome/browser/ui/webui/settings/settings_ui.cc"
#undef AboutHandler

0 comments on commit 8409f9e

Please sign in to comment.