blob: f549f22e2556bcbf3b9ac90bfd855a5682a1bb13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Copyright 2018 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 A helper object used by the welcome page to interact with
* the browser.
*/
cr.define('welcome', function() {
/** @interface */
class WelcomeBrowserProxy {
/** @param {?string} redirectUrl the URL to go to, after signing in. */
handleActivateSignIn(redirectUrl) {}
handleUserDecline() {}
/** @param {boolean=} replace */
goToNewTabPage(replace) {}
/** @param {string} url */
goToURL(url) {}
}
/** @implements {welcome.WelcomeBrowserProxy} */
class WelcomeBrowserProxyImpl {
/** @override */
handleActivateSignIn(redirectUrl) {
chrome.send('handleActivateSignIn', redirectUrl ? [redirectUrl] : []);
}
/** @override */
handleUserDecline() {
chrome.send('handleUserDecline');
}
/** @override */
goToNewTabPage(replace) {
if (replace) {
window.location.replace('chrome://newtab');
} else {
window.location.assign('chrome://newtab');
}
}
/** @override */
goToURL(url) {
window.location.assign(url);
}
}
cr.addSingletonGetter(WelcomeBrowserProxyImpl);
return {
WelcomeBrowserProxy: WelcomeBrowserProxy,
WelcomeBrowserProxyImpl: WelcomeBrowserProxyImpl,
};
});
|