Commit 88b5ae14 authored by Esmael El-Moslimany's avatar Esmael El-Moslimany Committed by Commit Bot

MD Extensions: use common page not available for guest ui

Bug: 841509
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Idf57751875b2ffe762476b33f9b0af66f3ea76c8
Reviewed-on: https://chromium-review.googlesource.com/1054609Reviewed-by: default avatarcalamity <calamity@chromium.org>
Commit-Queue: Esmael El-Moslimany <aee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558234}
parent b2eb8c94
......@@ -48,8 +48,8 @@
<message name="IDS_MD_EXTENSIONS_ACCESSIBILITY_ERROR_MULTI_LINE" desc="Accessibility message to indicate the lines that an error spans. The lines of code will be read to the user. The place holders will be numbers.">
Error from line <ph name="ERROR_LINE_START">$1</ph> to <ph name="ERROR_LINE_END">$2</ph>
</message>
<message name="IDS_MD_EXTENSIONS_GUEST_MODE" desc="The text displayed when viewing the page under guest-mode to indicate that guests cannot use this feature.">
Extension management is not available to Guest users. Please sign in to manage extensions.
<message name="IDS_MD_EXTENSIONS_GUEST_MODE_TITLE" desc="The text displayed when viewing the page under guest-mode to indicate that guests cannot use this feature.">
Extension management
</message>
<message name="IDS_MD_EXTENSIONS_ITEM_ID" desc="The text for the label next to the extension id.">
&lt;span&gt;ID: &lt;/span&gt;<ph name="EXTENSION_ID">$1<ex>cfhdojbkjhnklbpkdaibdccddilifddb</ex></ph>
......
......@@ -59,9 +59,6 @@
</style>
<div id="container">
<div id="content-wrapper">
<div class="empty-list-message" hidden="[[!isGuest]]">
$i18n{guestModeMessage}
</div>
<div id="no-items" class="empty-list-message"
hidden$="[[!shouldShowEmptyItemsMessage_(
apps.length, extensions.length)]]">
......
......@@ -23,8 +23,6 @@ cr.define('extensions', function() {
value: false,
},
isGuest: Boolean,
filter: {
type: String,
},
......@@ -81,13 +79,12 @@ cr.define('extensions', function() {
/** @private */
shouldShowEmptyItemsMessage_: function() {
return !this.isGuest && this.apps.length === 0 &&
this.extensions.length === 0;
return this.apps.length === 0 && this.extensions.length === 0;
},
/** @private */
shouldShowEmptySearchMessage_: function() {
return !this.isGuest && !this.shouldShowEmptyItemsMessage_() &&
return !this.shouldShowEmptyItemsMessage_() &&
this.shownAppsCount_ === 0 && this.shownExtensionsCount_ === 0;
},
......
......@@ -56,8 +56,7 @@
</style>
<extensions-drop-overlay drag-enabled="[[inDevMode]]">
</extensions-drop-overlay>
<extensions-toolbar is-guest="[[isGuest_]]"
in-dev-mode="[[inDevMode]]"
<extensions-toolbar in-dev-mode="[[inDevMode]]"
can-load-unpacked="[[canLoadUnpacked]]"
is-supervised="[[isSupervised_]]"
dev-mode-controlled-by-policy="[[devModeControlledByPolicy]]"
......@@ -81,10 +80,10 @@
</cr-drawer>
</template>
<extensions-view-manager id="viewManager" role="main">
<extensions-item-list id="items-list" is-guest="[[isGuest_]]"
delegate="[[delegate]]" in-dev-mode="[[inDevMode]]"
filter="[[filter]]" hidden$="[[!didInitPage_]]" slot="view"
apps="[[apps_]]" extensions="[[extensions_]]"
<extensions-item-list id="items-list" delegate="[[delegate]]"
in-dev-mode="[[inDevMode]]" filter="[[filter]]"
hidden$="[[!didInitPage_]]" slot="view" apps="[[apps_]]"
extensions="[[extensions_]]"
on-show-install-warnings="onShowInstallWarnings_">
</extensions-item-list>
<cr-lazy-render id="details-view">
......
......@@ -46,13 +46,6 @@ cr.define('extensions', function() {
},
},
isGuest_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('isGuest');
},
},
inDevMode: {
type: Boolean,
value: () => loadTimeData.getBoolean('inDevMode'),
......@@ -165,11 +158,6 @@ cr.define('extensions', function() {
/** @override */
ready: function() {
if (loadTimeData.getBoolean('isGuest')) {
this.initPage_();
return;
}
let service = extensions.Service.getInstance();
let onProfileStateChanged = profileInfo => {
......
......@@ -75,16 +75,14 @@ cr.define('extensions', function() {
}
/**
* If you're not a guest, going to /configureCommands and /shortcuts should
* land you on /shortcuts. These are the only two supported routes, so all
* other cases (guest or not) will redirect you to root path if not already
* on it.
* Going to /configureCommands and /shortcuts should land you on /shortcuts.
* These are the only two supported routes, so all other cases will redirect
* you to root path if not already on it.
* @private
*/
processRoute_() {
if (!loadTimeData.getBoolean('isGuest') &&
(this.currentPath_ == '/configureCommands' ||
this.currentPath_ == '/shortcuts')) {
if (this.currentPath_ == '/configureCommands' ||
this.currentPath_ == '/shortcuts') {
window.history.replaceState(
undefined /* stateObject */, '', '/shortcuts');
} else if (this.currentPath_ !== '/') {
......
......@@ -97,9 +97,9 @@
search-prompt="$i18n{search}"
clear-label="$i18n{clearSearch}"
menu-label="$i18n{mainMenu}"
show-menu="[[!isGuest]]" show-search="[[!isGuest]]"
show-menu="true"
narrow-threshold="1000">
<div class="more-actions" hidden$="[[isGuest]]">
<div class="more-actions">
<span id="devModeLabel">$i18n{toolbarDevMode}</span>
<cr-tooltip-icon hidden$="[[!devModeControlledByPolicy]]"
tooltip-text="$i18n{controlledSettingPolicy}"
......
......@@ -43,8 +43,6 @@ cr.define('extensions', function() {
isSupervised: Boolean,
isGuest: Boolean,
// <if expr="chromeos">
kioskEnabled: Boolean,
// </if>
......
......@@ -414,7 +414,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
if (profile->IsGuestSession() &&
(url.host_piece() == chrome::kChromeUIBookmarksHost ||
url.host_piece() == chrome::kChromeUIHistoryHost)) {
url.host_piece() == chrome::kChromeUIHistoryHost ||
url.host_piece() == chrome::kChromeUIExtensionsHost)) {
return &NewWebUI<PageNotAvailableForGuestUI>;
}
// Bookmarks are part of NTP on Android.
......
......@@ -39,7 +39,6 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h"
#include "chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.h"
#include "components/user_manager/user_manager.h"
#endif
namespace extensions {
......@@ -163,7 +162,6 @@ content::WebUIDataSource* CreateMdExtensionsSource(bool in_dev_mode) {
IDS_MD_EXTENSIONS_SIDEBAR_OPEN_CHROME_WEB_STORE);
source->AddLocalizedString("keyboardShortcuts",
IDS_MD_EXTENSIONS_SIDEBAR_KEYBOARD_SHORTCUTS);
source->AddLocalizedString("guestModeMessage", IDS_MD_EXTENSIONS_GUEST_MODE);
source->AddLocalizedString("incognitoInfoWarning",
IDS_EXTENSIONS_INCOGNITO_WARNING);
source->AddLocalizedString("itemId", IDS_MD_EXTENSIONS_ITEM_ID);
......@@ -386,15 +384,6 @@ ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
source = CreateMdExtensionsSource(*in_dev_mode_);
source->AddBoolean(
"isGuest",
#if defined(OS_CHROMEOS)
user_manager::UserManager::Get()->IsLoggedInAsGuest() ||
user_manager::UserManager::Get()->IsLoggedInAsPublicAccount());
#else
profile->IsOffTheRecord());
#endif
#if defined(OS_CHROMEOS)
auto kiosk_app_handler = std::make_unique<chromeos::KioskAppsHandler>(
chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(
......
......@@ -26,6 +26,8 @@ content::WebUIDataSource* CreateHTMLSource(Profile* profile,
page_title = l10n_util::GetStringUTF16(IDS_MD_BOOKMARK_MANAGER_TITLE);
else if (host_name == chrome::kChromeUIHistoryHost)
page_title = l10n_util::GetStringUTF16(IDS_HISTORY_TITLE);
else if (host_name == chrome::kChromeUIExtensionsHost)
page_title = l10n_util::GetStringUTF16(IDS_MD_EXTENSIONS_GUEST_MODE_TITLE);
else
page_title = base::UTF8ToUTF16(host_name);
......
......@@ -180,7 +180,6 @@ cr.define('extension_navigation_helper_tests', function() {
removeEndSlash(newUrl || url));
}
loadTimeData.overrideValues({isGuest: false});
testIfRedirected('chrome://extensions');
testIfRedirected('chrome://extensions/');
testIfRedirected('chrome://extensions/shortcuts');
......@@ -192,11 +191,6 @@ cr.define('extension_navigation_helper_tests', function() {
testIfRedirected(
'chrome://extensions/configureCommands',
'chrome://extensions/shortcuts');
loadTimeData.overrideValues({isGuest: true});
testIfRedirected('chrome://extensions/');
testIfRedirected('chrome://extensions/shortcuts', 'chrome://extensions');
testIfRedirected('chrome://extensions/fake-route', 'chrome://extensions');
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment