Skip to content

Commit

Permalink
Updates extensions store link language on the extensions page. Adds
Browse files Browse the repository at this point in the history
link to the store even if there are installed extensions.

Fixes brave/brave-browser#2497
Fixes brave/brave-browser#1013
  • Loading branch information
mkarolin committed Jan 8, 2019
1 parent 997388a commit 655f19c
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/brave_generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,19 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U
<message name="IDS_SETTINGS_MANAGE_EXTENSIONS_LABEL" desc="The label of manage extensions link in settings">
Manage Extensions
</message>
<!-- Extensions page strings -->
<message name="IDS_MD_EXTENSIONS_BRAVE_MORE_EXTENSIONS" desc="The message shown to the user on the Extensions settings page under the list of installed extensions.">
<ph name="BEGIN_LINK">&lt;a target="_blank" href="https://chrome.google.com/webstore/category/extensions"&gt;</ph>Looking for even more extensions?<ph name="END_LINK">&lt;/a&gt;<ex>&lt;/a&gt;</ex></ph>
</message>
<message name="IDS_MD_EXTENSIONS_BRAVE_ITEM_SOURCE_WEBSTORE" desc="The text to indicate that an extension is from the Web Extensions Store.">
Web Extensions Store
</message>
<message name="IDS_MD_EXTENSIONS_BRAVE_ITEM_CHROME_WEB_STORE" desc="Label for button to visit the Web Extensions Store.">
View in Web Extensions Store
</message>
<message name="IDS_MD_EXTENSIONS_BRAVE_NO_INSTALLED_ITEMS" desc="The message shown to the user on the Extensions settings page when there are no extensions or apps installed.">
You don't have any extensions yet. Would you like to <ph name="BEGIN_LINK">&lt;a target="_blank" href="https://chrome.google.com/webstore/category/extensions"&gt;</ph>install some<ph name="END_LINK">&lt;/a&gt;<ex>&lt;/a&gt;</ex></ph>?
</message>
</messages>
<includes>
<include name="IDR_BRAVE_TAG_SERVICES_POLYFILL" file="resources/js/tag_services_polyfill.js" type="BINDATA" />
Expand Down
43 changes: 43 additions & 0 deletions chromium_src/chrome/browser/ui/webui/extensions/extensions_ui.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* 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/grit/brave_generated_resources.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_ui_data_source.h"

// These are defined in generated_resources.h, but since we are including it
// here the original extensions_ui.cc shouldn't include it again and the
// redefined values will be used.
#undef IDS_MD_EXTENSIONS_ITEM_CHROME_WEB_STORE
#define IDS_MD_EXTENSIONS_ITEM_CHROME_WEB_STORE \
IDS_MD_EXTENSIONS_BRAVE_ITEM_CHROME_WEB_STORE
#undef IDS_MD_EXTENSIONS_ITEM_SOURCE_WEBSTORE
#define IDS_MD_EXTENSIONS_ITEM_SOURCE_WEBSTORE \
IDS_MD_EXTENSIONS_BRAVE_ITEM_SOURCE_WEBSTORE
#undef IDS_MD_EXTENSIONS_NO_INSTALLED_ITEMS
#define IDS_MD_EXTENSIONS_NO_INSTALLED_ITEMS \
IDS_MD_EXTENSIONS_BRAVE_NO_INSTALLED_ITEMS

// Forward declarations needed due to extensions_ui.cc being patched with this
// function name.
namespace extensions {
namespace {
void BraveAddLocalizedStrings(content::WebUIDataSource* html_source);
} // namespace
} // namespace extensions

#include "../../../../../../chrome/browser/ui/webui/extensions/extensions_ui.cc"

namespace extensions {

namespace {

void BraveAddLocalizedStrings(content::WebUIDataSource* html_source) {
html_source->AddLocalizedString("moreExtensions",
IDS_MD_EXTENSIONS_BRAVE_MORE_EXTENSIONS);
}

} // namespace

} // namespace extensions
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/chrome/browser/resources/md_extensions/item_list.html b/chrome/browser/resources/md_extensions/item_list.html
index 90244de120cf8fda71002f535810619b1e8aeb3e..84450aca34abf7b55e1289b8716b81d5323e6ec0 100644
--- a/chrome/browser/resources/md_extensions/item_list.html
+++ b/chrome/browser/resources/md_extensions/item_list.html
@@ -106,6 +106,13 @@
</template>
</div>
</div>
+ <div id="more-items" class="empty-list-message" style="margin-top: 32px;"
+ hidden$="[[shouldShowEmptyItemsMessage_(
+ apps.length, extensions.length)]]">
+ <span>
+ $i18nRaw{moreExtensions}
+ </span>
+ </div>
</div>
</div>
</template>
13 changes: 13 additions & 0 deletions patches/chrome-browser-ui-webui-extensions-extensions_ui.cc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc
index 1b7560672a3608c7331799ce516d63066bf4d068..c3480b2cdcdf6950a6a8c136f3a8dabde5e4a615 100644
--- a/chrome/browser/ui/webui/extensions/extensions_ui.cc
+++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -285,6 +285,8 @@ content::WebUIDataSource* CreateMdExtensionsSource(bool in_dev_mode) {
AddLocalizedStringsBulk(source, localized_strings,
base::size(localized_strings));

+ BraveAddLocalizedStrings(source);
+
source->AddString("errorLinesNotShownSingular",
l10n_util::GetPluralStringFUTF16(
IDS_MD_EXTENSIONS_ERROR_LINES_NOT_SHOWN, 1));

0 comments on commit 655f19c

Please sign in to comment.