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