Commit 2f51134a authored by garykac's avatar garykac Committed by Commit bot

[Chromoting] Remove hangout consent dialog.

We're updating our build to ensure that all html files are auto
generated and jscompiled. This html file is being removed now (rather
than updated to be jscompiled) because we intend to remove the
It2MeHelpeeChannel code in the near future.

BUG=

Review URL: https://codereview.chromium.org/979483002

Cr-Commit-Position: refs/heads/master@{#318992}
parent c52617fe
......@@ -291,7 +291,6 @@
'webapp/crd/js/background.js',
'webapp/crd/js/client_session.js',
'webapp/crd/js/error.js',
'webapp/crd/js/hangout_consent_dialog.js',
'webapp/crd/js/host_installer.js',
'webapp/crd/js/host_session.js',
'webapp/crd/js/identity.js',
......@@ -322,8 +321,6 @@
'<@(remoting_webapp_background_js_files)',
# JS files for message_window.html
'webapp/base/js/message_window.js',
# JS files for dialog_hangout_consent.html
'webapp/crd/js/hangout_consent_dialog_main.js',
# JS files for wcs_sandbox.html.
# Use r_w_js_wcs_sandbox_files instead of r_w_wcs_sandbox_html_js_files
# so that we don't double include error.js and plugin_settings.js.
......@@ -367,8 +364,6 @@
'webapp/base/resources/open_sans.woff',
'webapp/base/resources/spinner.gif',
'webapp/crd/html/butter_bar.css',
'webapp/crd/html/dialog_hangout_consent.html',
'webapp/crd/html/dialog_hangout_consent.css',
'webapp/crd/html/toolbar.css',
'webapp/crd/html/menu_button.css',
'webapp/crd/html/window_frame.css',
......
/* Copyright 2014 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
html, div, span, body, ul, li {
border: 0;
margin: 0;
padding: 0;
font-family: "Arial", "Helvetica", sans-serif;
font-weight: normal;
/* Allows the user to move the window by dragging its content. */
-webkit-app-region: drag;
}
.header {
height: 46px;
background: #1c91c0;
padding: 15px;
}
.header .title {
color: white;
float: left;
font-size: 24px;
line-height: 46px;
padding-left: 15px;
}
.header .logo {
float: left;
height: 46px;
width: 46px;
background: url('chromoting48.webp');
}
.content {
text-align: center;
margin: auto;
width: 70%;
}
.content .message {
padding: 30px;
font-size: 20px;
}
.content ul {
list-style: none;
border-width: 0px 0px 1px 0px;
border-style: solid;
border-color: #f0f0f0;
}
.content li {
border-width: 1px 0px 0px 0px;
border-style: solid;
border-color: #f0f0f0;
padding: 15px;
text-align: left;
font-size: 14px;
}
.button {
padding: 0px 20px;
border: 1px solid #f0f0f0;
border-radius: 5px;
font-size: 14px;
font-weight: bold;
line-height: 36px;
color: #737373;
-webkit-app-region: no-drag;
}
.footer {
padding-top: 30px;
padding-bottom: 30px;
/* Clear the float of its children. */
overflow: auto;
width: 100%
}
.button.default {
background: #427fed;
color: white;
}
.button:hover {
border-color: #cecece;
}
.button.default:active {
background: #2c56b1;
}
.ok-button {
float: right;
margin-left: 10px;
}
.cancel-button {
float: right;
}
<!doctype html>
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="dialog_hangout_consent.css">
<script type="text/javascript" src="base.js"></script>
<script type="text/javascript" src="hangout_consent_dialog_main.js"></script>
<script type="text/javascript" src="ipc.js"></script>
<script type="text/javascript" src="l10n.js"></script>
<script type="text/javascript" src="typecheck.js"></script>
</head>
<body>
<div class="header">
<div class="logo"></div>
<div class="title" i18n-content="MODE_IT2ME"></div>
</div>
<div class="content">
<div class="message" i18n-content="HANGOUTS_CONFIRM_DIALOG_MESSAGE_1"></div>
<ul>
<li i18n-content="HANGOUTS_CONFIRM_DIALOG_MESSAGE_2"></li>
<li i18n-content="HANGOUTS_CONFIRM_DIALOG_MESSAGE_3"></li>
<li i18n-content="DESCRIPTION_AUTHORIZE" class='auth-message'></li>
</ul>
<div class="footer">
<div class="button default ok-button" i18n-content="HANGOUTS_CONFIRM_DIALOG_ACCEPT"></div>
<div class="button cancel-button" i18n-content="HANGOUTS_CONFIRM_DIALOG_DECLINE"></div>
</div>
</div>
</body>
</html>
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/** @suppress {duplicate} */
var remoting = remoting || {};
(function() {
'use strict';
var instance_ = null;
/**
* Shows a dialog to ask for the user's permission to accept remote assistance
* from a Hangout participant.
*
* @constructor
* @private
*/
remoting.HangoutConsentDialog = function() {
/**
* @type {base.Deferred}
* @private
*/
this.onConsentResponseDeferred_ = null;
/** @private */
this.requestToken_ = base.generateXsrfToken();
base.Ipc.getInstance().register('remoting.HangoutConsentDialog.confirm',
this.onConfirmResponse_.bind(this));
};
/**
* @param {boolean} confirm Whether the user authorized the it2me connection
* @param {string} responseToken
* @private
*/
remoting.HangoutConsentDialog.prototype.onConfirmResponse_ = function(
confirm, responseToken) {
if (responseToken !== this.requestToken_) {
return;
}
if (confirm) {
this.onConsentResponseDeferred_.resolve();
} else {
this.onConsentResponseDeferred_.reject(
new Error(remoting.Error.CANCELLED));
}
this.onConsentResponseDeferred_ = null;
};
/**
* @param {boolean} authorized If true, the consent dialog will hide the
* authorization section.
* @param {Bounds=} opt_parentBounds If present, the consent dialog will be
* centered within |opt_parentBounds|.
* @return {Promise} A Promise that will resolve when permission is granted or
* reject if the user cancels.
*/
remoting.HangoutConsentDialog.prototype.show = function(authorized,
opt_parentBounds) {
if (!this.onConsentResponseDeferred_) {
var DIALOG_WIDTH = 750;
var DIALOG_HEIGHT = 480;
var createOptions = {
frame: 'none',
resizable: false,
outerBounds: { width: DIALOG_WIDTH, height: DIALOG_HEIGHT }
};
var params = {
token: this.requestToken_,
authorized: Boolean(authorized)
};
var url = base.urlJoin('dialog_hangout_consent.html', params);
if (opt_parentBounds) {
// Center the dialog on the parent bounds.
var rect = opt_parentBounds;
createOptions.outerBounds.top =
Math.round(rect.top + rect.height / 2 - DIALOG_HEIGHT / 2);
createOptions.outerBounds.left =
Math.round(rect.left + rect.width / 2 - DIALOG_WIDTH / 2);
}
this.onConsentResponseDeferred_ = new base.Deferred();
chrome.app.window.create(url, createOptions);
}
return this.onConsentResponseDeferred_.promise();
};
/** @return {remoting.HangoutConsentDialog} */
remoting.HangoutConsentDialog.getInstance = function() {
if (!instance_) {
instance_ = new remoting.HangoutConsentDialog();
}
return instance_;
};
}());
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview
* The entry point for dialog_hangout_consent.html.
*/
/** @suppress {duplicate} */
var remoting = remoting || {};
(function() {
'use strict';
/**
* @constructor
* @param {HTMLElement} rootElement
* @param {string} requestToken
* @param {boolean} authorized Whether the user is authorized or not.
*/
var ConsentDialog = function(rootElement, requestToken, authorized) {
/** @private */
this.okButton_ = rootElement.querySelector('.ok-button');
/** @private */
this.cancelButton_ = rootElement.querySelector('.cancel-button');
/** @private */
this.authSection_ = rootElement.querySelector('.auth-message');
/** @private */
this.requestToken_ = requestToken;
if (authorized) {
this.authSection_.hidden = true;
}
this.okButton_.addEventListener('click', this.onButton_.bind(this, true));
this.cancelButton_.addEventListener('click',this.onButton_.bind(this, false));
base.resizeWindowToContent();
};
/**
* @param {boolean} confirm
* @private
*/
ConsentDialog.prototype.onButton_ = function(confirm) {
base.Ipc.invoke('remoting.HangoutConsentDialog.confirm', confirm,
this.requestToken_);
chrome.app.window.current().close();
};
function onDomContentLoaded() {
var params = base.getUrlParameters();
var authorized = getBooleanAttr(params, 'authorized', false);
var token = getStringAttr(params, 'token');
l10n.localize();
var confirmDialog = new ConsentDialog(document.body, token, authorized);
}
window.addEventListener('load', onDomContentLoaded);
}());
......@@ -323,12 +323,7 @@ remoting.It2MeHelpeeChannel.prototype.showConfirmDialogV2_ = function(bounds) {
var getToken =
base.Promise.as(chrome.identity.getAuthToken, [{interactive: false}]);
return getToken.then(
/** @param {string} token */
function(token) {
return remoting.HangoutConsentDialog.getInstance().show(Boolean(token),
bounds);
});
return getToken;
};
/**
......
......@@ -126,11 +126,6 @@ QUnit.asyncTest('connect() should return access code',
function() {
// Stubs authentication.
sinon.stub(base, 'isAppsV2').returns(true);
sinon.stub(remoting.HangoutConsentDialog, 'getInstance').returns({
show : function() {
return Promise.resolve();
}
});
sinon.stub(chrome.identity, 'getAuthToken')
.callsArgWith(1, 'token');
sinon.stub(remoting.identity, 'getToken')
......
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