Commit 18fefd64 authored by lshang's avatar lshang Committed by Commit bot

MD History: Hide sign in guide in guest mode

Hide sign in guide in guest mode and show 'no synced tabs'.

BUG=628102
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2171513004
Cr-Commit-Position: refs/heads/master@{#407009}
parent 6eb57fb7
......@@ -73,10 +73,12 @@
</template>
</div>
<div id="no-synced-tabs" class="centered-message"
hidden="[[!showNoSyncedMessage(signInState_, syncedDevices_.length)]]">
hidden="[[!showNoSyncedMessage(signInState_, syncedDevices_.length,
guestSession_)]]">
[[noSyncedTabsMessage(fetchingSyncedTabs_)]]
</div>
<div id="sign-in-guide" hidden$="[[signInState_]]">
<div id="sign-in-guide"
hidden="[[!showSignInGuide(signInState_, guestSession_)]]">
<div id="illustration"></div>
<div id="sign-in-promo">$i18n{signInPromo}</div>
<div id="sign-in-promo-desc">$i18n{signInPromoDesc}</div>
......
......@@ -44,6 +44,12 @@ Polymer({
value: loadTimeData.getBoolean('isUserSignedIn'),
},
/** @private */
guestSession_: {
type: Boolean,
value: loadTimeData.getBoolean('isGuestSession'),
},
/** @private */
fetchingSyncedTabs_: {
type: Boolean,
......@@ -108,12 +114,28 @@ Polymer({
* Decide whether or not should display no synced tabs message.
* @param {boolean} signInState
* @param {number} syncedDevicesLength
* @param {boolean} guestSession
* @return {boolean}
*/
showNoSyncedMessage: function(signInState, syncedDevicesLength) {
showNoSyncedMessage: function(
signInState, syncedDevicesLength, guestSession) {
if (guestSession)
return true;
return signInState && syncedDevicesLength == 0;
},
/**
* Shows the signin guide when the user is not signed in and not in a guest
* session.
* @param {boolean} signInState
* @param {boolean} guestSession
* @return {boolean}
*/
showSignInGuide: function(signInState, guestSession) {
return !signInState && !guestSession;
},
/**
* Decide what message should be displayed when user is logged in and there
* are no synced tabs.
......
......@@ -101,6 +101,8 @@ content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile) {
switches::kHistoryEnableGroupByDomain) || profile->IsSupervised();
source->AddBoolean("groupByDomain", group_by_domain);
source->AddBoolean("isGuestSession", profile->IsGuestSession());
SigninManagerBase* signin_manager =
SigninManagerFactory::GetForProfile(profile);
bool is_authenticated = signin_manager != nullptr &&
......
......@@ -253,9 +253,17 @@ cr.define('md_history.history_synced_tabs_test', function() {
});
});
test('hide sign in promo in guest mode', function() {
element.guestSession_ = true;
return flush().then(function() {
assertTrue(element.$['sign-in-guide'].hidden);
});
});
teardown(function() {
element.syncedDevices = [];
element.searchTerm = '';
element.guestSession_ = false;
});
});
}
......
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