summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/md_extensions/toolbar.html
blob: 67ab5ed89e878108f20bb982638c8ec19ac43a6e (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<link rel="import" href="chrome://resources/html/polymer.html">

<link rel="import" href="chrome://resources/cr_elements/cr_toast/cr_toast.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_tooltip_icon.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-announcer/iron-a11y-announcer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="icons.html">

<dom-module id="extensions-toolbar">
  <template>
    <style include="cr-hidden-style paper-button-style">
      :host {
        /* The constant is the height of the tallest control. */
        --button-row-height: calc(var(--margin-bottom) + 36px);
        --drawer-transition: 0.3s cubic-bezier(.25, .1, .25, 1);
        --margin-bottom: 4px;
        --toolbar-color: var(--md-toolbar-color);
      }

      cr-toolbar {
        background: var(--toolbar-color);
      }

      /* This toggle needs special styling because it's on blue background. */
      cr-toolbar cr-toggle {
        --cr-toggle-checked-bar-color: white;
        --cr-toggle-checked-button-color: white;
        --cr-toggle-checked-ink-color: white;
        --cr-toggle-unchecked-ink-color: white;
      }

      cr-tooltip-icon {
        -webkit-margin-end: 20px;
      }

      #devDrawer[expanded] #buttonStrip {
        top: 0;
      }

      #devDrawer {
        height: 0;
        overflow: hidden;
        position: relative;
        transition: height var(--drawer-transition);
      }

      #devDrawer[expanded] {
        height: var(--button-row-height);
      }

      #buttonStrip {
        -webkit-margin-end: auto;
        -webkit-margin-start: auto;
        background: var(--toolbar-color);
        margin-bottom: var(--margin-bottom);
        position: absolute;
        text-align: center;
        top: calc(var(--button-row-height) * -1);
        transition: top var(--drawer-transition);
        /* Prevent selection of the blank space between buttons. */
        user-select: none;
        width: 100%;
      }

      #buttonStrip paper-button {
        -webkit-margin-end: 16px;
        color: white;
        /* Increase contrast compared to default values. */
        --paper-button-flat-keyboard-focus: {
          background: rgba(0, 0, 0, .3);
        };
      }

      .more-actions {
        align-items: center;
        display: flex;
        justify-content: flex-end;
      }

      .more-actions span {
        -webkit-margin-end: 16px;
      }

      cr-toast > div {
        color: #fff;
        display: flex;
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    </style>
    <cr-toolbar page-name="$i18n{toolbarTitle}"
        search-prompt="$i18n{search}"
        clear-label="$i18n{clearSearch}"
        menu-label="$i18n{mainMenu}"
        show-menu="[[!isGuest]]" show-search="[[!isGuest]]"
        narrow-threshold="1000">
      <div class="more-actions" hidden$="[[isGuest]]">
        <span id="devModeLabel">$i18n{toolbarDevMode}</span>
        <cr-tooltip-icon hidden$="[[!devModeControlledByPolicy]]"
            tooltip-text="$i18n{controlledSettingPolicy}"
            icon-class="cr20:domain"
            icon-aria-label="$i18n{controlledSettingPolicy}">
        </cr-tooltip-icon>
        <cr-toggle id="devMode" on-change="onDevModeToggleChange_"
            disabled="[[shouldDisableDevMode_(
                devModeControlledByPolicy, isSupervised)]]"
            checked="[[inDevMode]]" aria-labelledby="devModeLabel">
        </cr-toggle>
      </div>
    </cr-toolbar>
    <div id="devDrawer" expanded$="[[expanded_]]">
      <div id="buttonStrip">
        <paper-button hidden$="[[!canLoadUnpacked]]" id="loadUnpacked"
            on-click="onLoadUnpackedTap_">
          $i18n{toolbarLoadUnpacked}
        </paper-button>
        <paper-button id="packExtensions" on-click="onPackTap_">
          $i18n{toolbarPack}
        </paper-button>
        <paper-button id="updateNow" on-click="onUpdateNowTap_"
            title="$i18n{toolbarUpdateNowTooltip}">
          $i18n{toolbarUpdateNow}
        </paper-button>
        <cr-toast>
          <div>[[toastLabel_]]</div>
        </cr-toast>
<if expr="chromeos">
        <paper-button id="kioskExtensions" on-click="onKioskTap_"
            hidden$="[[!kioskEnabled]]">
          $i18n{manageKioskApp}
        </paper-button>
</if>
      </div>
    </div>
  </template>
  <script src="toolbar.js"></script>
</dom-module>