Skip to content

Commit

Permalink
Revert 286247 "mojo: Port chrome://identity-internals to mojo We..."
Browse files Browse the repository at this point in the history
Likely culprit to:
http://build.chromium.org/p/chromium.mac/builders/Mac%2010.6%20Tests%20%28dbg%29%282%29/builds/53876

> mojo: Port chrome://identity-internals to mojo Web UI.
> 
> BUG=391095
> NOPRESUBMIT=true
> R=fgorski@chromium.org, jam@chromium.org, jschuh@chromium.org, sky@chromium.org
> 
> Review URL: https://codereview.chromium.org/365513002

TBR=erg@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286279 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dcaiafa@google.com committed Jul 29, 2014
1 parent a27feb2 commit 2b57840
Show file tree
Hide file tree
Showing 30 changed files with 407 additions and 576 deletions.
4 changes: 0 additions & 4 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -620,23 +620,19 @@ grit("resources") {
]

omnibox_mojom_file = "$root_gen_dir/chrome/browser/ui/webui/omnibox/omnibox.mojom.js"
identity_internals_mojom_file = "$root_gen_dir/chrome/browser/ui/webui/identity_internals/identity_internals.mojom.js"

grit_flags = [
"-E", "about_credits_file=" +
rebase_path(about_credits_file, root_build_dir),
"-E", "additional_modules_list_file=" +
rebase_path(additional_modules_list_file, root_build_dir),
"-E", "identity_internals_mojom_file=" +
rebase_path(identity_internals_mojom_file, root_build_dir),
"-E", "omnibox_mojom_file=" +
rebase_path(omnibox_mojom_file, root_build_dir),
]

deps = [
":about_credits",
":chrome_internal_resources_gen",
"//chrome/browser/ui/webui/identity_internals:mojo_bindings",
"//chrome/browser/ui/webui/omnibox:mojo_bindings",
]
}
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/browser_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@
<include name="IDR_IDENTITY_INTERNALS_HTML" file="resources\identity_internals.html" type="BINDATA" />
<include name="IDR_IDENTITY_INTERNALS_CSS" file="resources\identity_internals.css" type="BINDATA" />
<include name="IDR_IDENTITY_INTERNALS_JS" file="resources\identity_internals.js" type="BINDATA" />
<include name="IDR_IDENTITY_INTERNALS_MOJO_JS" file="${identity_internals_mojom_file}" use_base_dir="false" type="BINDATA"/>
</if>
<if expr="chromeos">
<include name="IDR_NETWORK_UI_HTML" file="resources\chromeos\network_ui\network_ui.html" type="BINDATA" />
Expand Down
75 changes: 39 additions & 36 deletions chrome/browser/resources/identity_internals.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

define('main', [
'mojo/public/js/bindings/connection',
'chrome/browser/ui/webui/identity_internals/identity_internals.mojom',
], function(connector, browser) {
cr.define('identity_internals', function() {
'use strict';

var connection;
var page;

/**
* Creates an identity token item.
* @param {!Object} tokenInfo Object containing token information.
Expand All @@ -30,20 +24,20 @@ define('main', [
/** @override */
decorate: function() {
this.textContent = '';
this.id = this.data_.access_token;
this.id = this.data_.accessToken;

var table = this.ownerDocument.createElement('table');
var tbody = this.ownerDocument.createElement('tbody');
tbody.appendChild(this.createEntry_(
'accessToken', this.data_.access_token, 'access-token'));
'accessToken', this.data_.accessToken, 'access-token'));
tbody.appendChild(this.createEntry_(
'extensionName', this.data_.extension_name, 'extension-name'));
'extensionName', this.data_.extensionName, 'extension-name'));
tbody.appendChild(this.createEntry_(
'extensionId', this.data_.extension_id, 'extension-id'));
'extensionId', this.data_.extensionId, 'extension-id'));
tbody.appendChild(this.createEntry_(
'tokenStatus', this.data_.token_status, 'token-status'));
'tokenStatus', this.data_.status, 'token-status'));
tbody.appendChild(this.createEntry_(
'expirationTime', this.data_.expiration_time, 'expiration-time'));
'expirationTime', this.data_.expirationTime, 'expiration-time'));
tbody.appendChild(this.createEntryForScopes_());
table.appendChild(tbody);
var tfoot = this.ownerDocument.createElement('tfoot');
Expand Down Expand Up @@ -119,13 +113,8 @@ define('main', [
var revokeButton = this.ownerDocument.createElement('button');
revokeButton.classList.add('revoke-button');
revokeButton.addEventListener('click', function() {
var accessToken = this.data_.access_token;
page.browser_.revokeToken(this.data_.extension_id,
accessToken).then(function() {
tokenList_.removeTokenNode_(accessToken);
if (window.revokeTokenTest)
window.revokeTokenTest();
});
chrome.send('identityInternalsRevokeToken',
[this.data_.extensionId, this.data_.accessToken]);
}.bind(this));
revokeButton.textContent = loadTimeData.getString('revoke');
return revokeButton;
Expand Down Expand Up @@ -167,7 +156,7 @@ define('main', [
removeTokenNode_: function(accessToken) {
var tokenIndex;
for (var index = 0; index < this.data_.length; index++) {
if (this.data_[index].access_token == accessToken) {
if (this.data_[index].accessToken == accessToken) {
tokenIndex = index;
break;
}
Expand All @@ -186,28 +175,42 @@ define('main', [

var tokenList_;

function InternalsPageImpl(browser) {
this.browser_ = browser;
page = this;

/**
* Initializes the UI by asking the contoller for list of identity tokens.
*/
function initialize() {
chrome.send('identityInternalsGetTokens');
tokenList_ = $('token-list');
tokenList_.data_ = [];
tokenList_.__proto__ = TokenList.prototype;
tokenList_.decorate();
}

page.browser_.getTokens().then(function(results) {
tokenList_.data_ = results.tokens;
tokenList_.showTokenNodes_();
});
/**
* Callback function accepting a list of tokens to be displayed.
* @param {!Token[]} tokens A list of tokens to be displayed
*/
function returnTokens(tokens) {
tokenList_.data_ = tokens;
tokenList_.showTokenNodes_();
}

InternalsPageImpl.prototype =
Object.create(browser.InternalsPageStub.prototype);
/**
* Callback function that removes a token from UI once it has been revoked.
* @param {!Array.<string>} accessTokens Array with a single element, which is
* an access token to be removed.
*/
function tokenRevokeDone(accessTokens) {
assert(accessTokens.length > 0);
tokenList_.removeTokenNode_(accessTokens[0]);
}

return function(handle) {
connection = new connector.Connection(
handle,
InternalsPageImpl,
browser.IdentityInternalsHandlerMojoProxy);
// Return an object with all of the exports.
return {
initialize: initialize,
returnTokens: returnTokens,
tokenRevokeDone: tokenRevokeDone,
};
});

document.addEventListener('DOMContentLoaded', identity_internals.initialize);
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "chrome/browser/ui/webui/gcm_internals_ui.h"
#include "chrome/browser/ui/webui/help/help_ui.h"
#include "chrome/browser/ui/webui/history_ui.h"
#include "chrome/browser/ui/webui/identity_internals/identity_internals_ui.h"
#include "chrome/browser/ui/webui/identity_internals_ui.h"
#include "chrome/browser/ui/webui/inspect_ui.h"
#include "chrome/browser/ui/webui/instant_ui.h"
#include "chrome/browser/ui/webui/invalidations_ui.h"
Expand Down
12 changes: 0 additions & 12 deletions chrome/browser/ui/webui/identity_internals/BUILD.gn

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2b57840

Please sign in to comment.