summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/settings/downloads_page/add_smb_share_dialog.js
blob: 195fa5df37637e71e584e651eb16a94443e97bda (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
// 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 'settings-add-smb-share-dialog' is a component for adding
 * an SMB Share.
 */
Polymer({
  is: 'settings-add-smb-share-dialog',

  properties: {
    /** @private {string} */
    mountUrl_: String,

    /** @private {string} */
    username_: String,

    /** @private {string} */
    password_: String,
  },

  /** @private {?settings.SmbBrowserProxy} */
  browserProxy_: null,

  /** @override */
  created: function() {
    this.browserProxy_ = settings.SmbBrowserProxyImpl.getInstance();
  },

  /** @override */
  attached: function() {
    this.$.dialog.showModal();
  },

  /** @private */
  cancel_: function() {
    this.$.dialog.cancel();
  },

  /** @private */
  onAddButtonTap_: function() {
    this.browserProxy_.smbMount(this.mountUrl_, this.username_, this.password_);
    this.$.dialog.close();
  },

  /**
   * @return {boolean}
   * @private
   */
  canAddShare_: function() {
    return !!this.mountUrl_;
  },
});