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 @@ ...@@ -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."> <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> Error from line <ph name="ERROR_LINE_START">$1</ph> to <ph name="ERROR_LINE_END">$2</ph>
</message> </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."> <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 is not available to Guest users. Please sign in to manage extensions. Extension management
</message> </message>
<message name="IDS_MD_EXTENSIONS_ITEM_ID" desc="The text for the label next to the extension id."> <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> &lt;span&gt;ID: &lt;/span&gt;<ph name="EXTENSION_ID">$1<ex>cfhdojbkjhnklbpkdaibdccddilifddb</ex></ph>
......
...@@ -59,9 +59,6 @@ ...@@ -59,9 +59,6 @@
</style> </style>
<div id="container"> <div id="container">
<div id="content-wrapper"> <div id="content-wrapper">
<div class="empty-list-message" hidden="[[!isGuest]]">
$i18n{guestModeMessage}
</div>
<div id="no-items" class="empty-list-message" <div id="no-items" class="empty-list-message"
hidden$="[[!shouldShowEmptyItemsMessage_( hidden$="[[!shouldShowEmptyItemsMessage_(
apps.length, extensions.length)]]"> apps.length, extensions.length)]]">
......
...@@ -23,8 +23,6 @@ cr.define('extensions', function() { ...@@ -23,8 +23,6 @@ cr.define('extensions', function() {
value: false, value: false,
}, },
isGuest: Boolean,
filter: { filter: {
type: String, type: String,
}, },
...@@ -81,13 +79,12 @@ cr.define('extensions', function() { ...@@ -81,13 +79,12 @@ cr.define('extensions', function() {
/** @private */ /** @private */
shouldShowEmptyItemsMessage_: function() { shouldShowEmptyItemsMessage_: function() {
return !this.isGuest && this.apps.length === 0 && return this.apps.length === 0 && this.extensions.length === 0;
this.extensions.length === 0;
}, },
/** @private */ /** @private */
shouldShowEmptySearchMessage_: function() { shouldShowEmptySearchMessage_: function() {
return !this.isGuest && !this.shouldShowEmptyItemsMessage_() && return !this.shouldShowEmptyItemsMessage_() &&
this.shownAppsCount_ === 0 && this.shownExtensionsCount_ === 0; this.shownAppsCount_ === 0 && this.shownExtensionsCount_ === 0;
}, },
......
...@@ -56,8 +56,7 @@ ...@@ -56,8 +56,7 @@
</style> </style>
<extensions-drop-overlay drag-enabled="[[inDevMode]]"> <extensions-drop-overlay drag-enabled="[[inDevMode]]">
</extensions-drop-overlay> </extensions-drop-overlay>
<extensions-toolbar is-guest="[[isGuest_]]" <extensions-toolbar in-dev-mode="[[inDevMode]]"
in-dev-mode="[[inDevMode]]"
can-load-unpacked="[[canLoadUnpacked]]" can-load-unpacked="[[canLoadUnpacked]]"
is-supervised="[[isSupervised_]]" is-supervised="[[isSupervised_]]"
dev-mode-controlled-by-policy="[[devModeControlledByPolicy]]" dev-mode-controlled-by-policy="[[devModeControlledByPolicy]]"
...@@ -81,10 +80,10 @@ ...@@ -81,10 +80,10 @@
</cr-drawer> </cr-drawer>
</template> </template>
<extensions-view-manager id="viewManager" role="main"> <extensions-view-manager id="viewManager" role="main">
<extensions-item-list id="items-list" is-guest="[[isGuest_]]" <extensions-item-list id="items-list" delegate="[[delegate]]"
delegate="[[delegate]]" in-dev-mode="[[inDevMode]]" in-dev-mode="[[inDevMode]]" filter="[[filter]]"
filter="[[filter]]" hidden$="[[!didInitPage_]]" slot="view" hidden$="[[!didInitPage_]]" slot="view" apps="[[apps_]]"
apps="[[apps_]]" extensions="[[extensions_]]" extensions="[[extensions_]]"
on-show-install-warnings="onShowInstallWarnings_"> on-show-install-warnings="onShowInstallWarnings_">
</extensions-item-list> </extensions-item-list>
<cr-lazy-render id="details-view"> <cr-lazy-render id="details-view">
......
...@@ -46,13 +46,6 @@ cr.define('extensions', function() { ...@@ -46,13 +46,6 @@ cr.define('extensions', function() {
}, },
}, },
isGuest_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('isGuest');
},
},
inDevMode: { inDevMode: {
type: Boolean, type: Boolean,
value: () => loadTimeData.getBoolean('inDevMode'), value: () => loadTimeData.getBoolean('inDevMode'),
...@@ -165,11 +158,6 @@ cr.define('extensions', function() { ...@@ -165,11 +158,6 @@ cr.define('extensions', function() {
/** @override */ /** @override */
ready: function() { ready: function() {
if (loadTimeData.getBoolean('isGuest')) {
this.initPage_();
return;
}
let service = extensions.Service.getInstance(); let service = extensions.Service.getInstance();
let onProfileStateChanged = profileInfo => { let onProfileStateChanged = profileInfo => {
......
...@@ -75,16 +75,14 @@ cr.define('extensions', function() { ...@@ -75,16 +75,14 @@ cr.define('extensions', function() {
} }
/** /**
* If you're not a guest, going to /configureCommands and /shortcuts should * Going to /configureCommands and /shortcuts should land you on /shortcuts.
* land you on /shortcuts. These are the only two supported routes, so all * These are the only two supported routes, so all other cases will redirect
* other cases (guest or not) will redirect you to root path if not already * you to root path if not already on it.
* on it.
* @private * @private
*/ */
processRoute_() { processRoute_() {
if (!loadTimeData.getBoolean('isGuest') && if (this.currentPath_ == '/configureCommands' ||
(this.currentPath_ == '/configureCommands' || this.currentPath_ == '/shortcuts') {
this.currentPath_ == '/shortcuts')) {
window.history.replaceState( window.history.replaceState(
undefined /* stateObject */, '', '/shortcuts'); undefined /* stateObject */, '', '/shortcuts');
} else if (this.currentPath_ !== '/') { } else if (this.currentPath_ !== '/') {
......
...@@ -97,9 +97,9 @@ ...@@ -97,9 +97,9 @@
search-prompt="$i18n{search}" search-prompt="$i18n{search}"
clear-label="$i18n{clearSearch}" clear-label="$i18n{clearSearch}"
menu-label="$i18n{mainMenu}" menu-label="$i18n{mainMenu}"
show-menu="[[!isGuest]]" show-search="[[!isGuest]]" show-menu="true"
narrow-threshold="1000"> narrow-threshold="1000">
<div class="more-actions" hidden$="[[isGuest]]"> <div class="more-actions">
<span id="devModeLabel">$i18n{toolbarDevMode}</span> <span id="devModeLabel">$i18n{toolbarDevMode}</span>
<cr-tooltip-icon hidden$="[[!devModeControlledByPolicy]]" <cr-tooltip-icon hidden$="[[!devModeControlledByPolicy]]"
tooltip-text="$i18n{controlledSettingPolicy}" tooltip-text="$i18n{controlledSettingPolicy}"
......
...@@ -43,8 +43,6 @@ cr.define('extensions', function() { ...@@ -43,8 +43,6 @@ cr.define('extensions', function() {
isSupervised: Boolean, isSupervised: Boolean,
isGuest: Boolean,
// <if expr="chromeos"> // <if expr="chromeos">
kioskEnabled: Boolean, kioskEnabled: Boolean,
// </if> // </if>
......
...@@ -414,7 +414,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, ...@@ -414,7 +414,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
if (profile->IsGuestSession() && if (profile->IsGuestSession() &&
(url.host_piece() == chrome::kChromeUIBookmarksHost || (url.host_piece() == chrome::kChromeUIBookmarksHost ||
url.host_piece() == chrome::kChromeUIHistoryHost)) { url.host_piece() == chrome::kChromeUIHistoryHost ||
url.host_piece() == chrome::kChromeUIExtensionsHost)) {
return &NewWebUI<PageNotAvailableForGuestUI>; return &NewWebUI<PageNotAvailableForGuestUI>;
} }
// Bookmarks are part of NTP on Android. // Bookmarks are part of NTP on Android.
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h" #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h"
#include "chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.h" #include "chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.h"
#include "components/user_manager/user_manager.h"
#endif #endif
namespace extensions { namespace extensions {
...@@ -163,7 +162,6 @@ content::WebUIDataSource* CreateMdExtensionsSource(bool in_dev_mode) { ...@@ -163,7 +162,6 @@ content::WebUIDataSource* CreateMdExtensionsSource(bool in_dev_mode) {
IDS_MD_EXTENSIONS_SIDEBAR_OPEN_CHROME_WEB_STORE); IDS_MD_EXTENSIONS_SIDEBAR_OPEN_CHROME_WEB_STORE);
source->AddLocalizedString("keyboardShortcuts", source->AddLocalizedString("keyboardShortcuts",
IDS_MD_EXTENSIONS_SIDEBAR_KEYBOARD_SHORTCUTS); IDS_MD_EXTENSIONS_SIDEBAR_KEYBOARD_SHORTCUTS);
source->AddLocalizedString("guestModeMessage", IDS_MD_EXTENSIONS_GUEST_MODE);
source->AddLocalizedString("incognitoInfoWarning", source->AddLocalizedString("incognitoInfoWarning",
IDS_EXTENSIONS_INCOGNITO_WARNING); IDS_EXTENSIONS_INCOGNITO_WARNING);
source->AddLocalizedString("itemId", IDS_MD_EXTENSIONS_ITEM_ID); source->AddLocalizedString("itemId", IDS_MD_EXTENSIONS_ITEM_ID);
...@@ -386,15 +384,6 @@ ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) { ...@@ -386,15 +384,6 @@ ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
source = CreateMdExtensionsSource(*in_dev_mode_); 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) #if defined(OS_CHROMEOS)
auto kiosk_app_handler = std::make_unique<chromeos::KioskAppsHandler>( auto kiosk_app_handler = std::make_unique<chromeos::KioskAppsHandler>(
chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(
......
...@@ -26,6 +26,8 @@ content::WebUIDataSource* CreateHTMLSource(Profile* profile, ...@@ -26,6 +26,8 @@ content::WebUIDataSource* CreateHTMLSource(Profile* profile,
page_title = l10n_util::GetStringUTF16(IDS_MD_BOOKMARK_MANAGER_TITLE); page_title = l10n_util::GetStringUTF16(IDS_MD_BOOKMARK_MANAGER_TITLE);
else if (host_name == chrome::kChromeUIHistoryHost) else if (host_name == chrome::kChromeUIHistoryHost)
page_title = l10n_util::GetStringUTF16(IDS_HISTORY_TITLE); 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 else
page_title = base::UTF8ToUTF16(host_name); page_title = base::UTF8ToUTF16(host_name);
......
...@@ -180,7 +180,6 @@ cr.define('extension_navigation_helper_tests', function() { ...@@ -180,7 +180,6 @@ cr.define('extension_navigation_helper_tests', function() {
removeEndSlash(newUrl || url)); removeEndSlash(newUrl || url));
} }
loadTimeData.overrideValues({isGuest: false});
testIfRedirected('chrome://extensions'); testIfRedirected('chrome://extensions');
testIfRedirected('chrome://extensions/'); testIfRedirected('chrome://extensions/');
testIfRedirected('chrome://extensions/shortcuts'); testIfRedirected('chrome://extensions/shortcuts');
...@@ -192,11 +191,6 @@ cr.define('extension_navigation_helper_tests', function() { ...@@ -192,11 +191,6 @@ cr.define('extension_navigation_helper_tests', function() {
testIfRedirected( testIfRedirected(
'chrome://extensions/configureCommands', 'chrome://extensions/configureCommands',
'chrome://extensions/shortcuts'); '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