Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: lib/src/google-signin/google-signin.html

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <link rel="import" href="../polymer/polymer.html"> 1 <link rel="import" href="../polymer/polymer.html">
2 <link rel="import" href="google-signin-aware.html"> 2 <link rel="import" href="google-signin-aware.html">
3 <link rel="import" href="../iron-icon/iron-icon.html"> 3 <link rel="import" href="../iron-icon/iron-icon.html">
4 <link rel="import" href="../iron-icons/iron-icons.html"> 4 <link rel="import" href="../iron-icons/iron-icons.html">
5 <link rel="import" href="../font-roboto/roboto.html"> 5 <link rel="import" href="../font-roboto/roboto.html">
6 <link rel="import" href="../google-apis/google-js-api.html"> 6 <link rel="import" href="../google-apis/google-js-api.html">
7 <link rel="import" href="../paper-ripple/paper-ripple.html"> 7 <link rel="import" href="../paper-ripple/paper-ripple.html">
8 <link rel="import" href="../paper-material/paper-material.html"> 8 <link rel="import" href="../paper-material/paper-material.html">
9 <link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html"> 9 <link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html">
10 <link rel="import" href="google-icons.html"> 10 <link rel="import" href="google-icons.html">
11 11
12 <dom-module id="google-signin"> 12 <dom-module id="google-signin">
13 <link rel="import" type="css" href="google-signin.css"> 13 <link rel="import" type="css" href="google-signin.css">
14 <template> 14 <template>
15 <google-signin-aware id="aware" 15 <google-signin-aware id="aware"
16 app-package-name="{{appPackageName}}" 16 app-package-name="{{appPackageName}}"
17 client-id="{{clientId}}" 17 client-id="{{clientId}}"
18 cookie-policy="{{cookiePolicy}}" 18 cookie-policy="{{cookiePolicy}}"
19 request-visible-actions="{{requestVisibleActions}}" 19 request-visible-actions="{{requestVisibleActions}}"
20 hosted-domain="{{hostedDomain}}"
21 offline="{{offline}}"
22 offline-always-prompt="{{offlineAlwaysPrompt}}"
20 scopes="{{scopes}}" 23 scopes="{{scopes}}"
21 signed-in="{{signedIn}}" 24 signed-in="{{signedIn}}"
22 is-authorized="{{isAuthorized}}" 25 is-authorized="{{isAuthorized}}"
23 need-additional-auth="{{needAdditionalAuth}}" 26 need-additional-auth="{{needAdditionalAuth}}"
24 has-plus-scopes="{{hasPlusScopes}}"></google-signin-aware> 27 has-plus-scopes="{{hasPlusScopes}}"></google-signin-aware>
25 <template is="dom-if" if="{{raised}}"> 28 <template is="dom-if" if="{{raised}}">
26 <paper-material id="shadow" class="fit" elevation="2" animated></paper-mat erial> 29 <paper-material id="shadow" class="fit" elevation="2" animated></paper-mat erial>
27 </template> 30 </template>
28 <div id="button" 31 <div id="button"
29 class$="[[_computeButtonClass(height, width, theme, signedIn, _brand, need AdditionalAuth)]]"> 32 class$="[[_computeButtonClass(height, width, theme, signedIn, _brand, need AdditionalAuth)]]">
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 140
138 The `scopes` attribute allows you to specify which scope permissions are require d 141 The `scopes` attribute allows you to specify which scope permissions are require d
139 (e.g do you want to allow interaction with the Google Drive API). Many APIs also 142 (e.g do you want to allow interaction with the Google Drive API). Many APIs also
140 need to be enabled in the Google Developers Console before you can use them. 143 need to be enabled in the Google Developers Console before you can use them.
141 144
142 The `requestVisibleActions` attribute is necessary if you want to write app 145 The `requestVisibleActions` attribute is necessary if you want to write app
143 activities (https://developers.google.com/+/web/app-activities/) on behalf of 146 activities (https://developers.google.com/+/web/app-activities/) on behalf of
144 the user. Please note that this attribute is only valid in combination with the 147 the user. Please note that this attribute is only valid in combination with the
145 plus.login scope (https://www.googleapis.com/auth/plus.login). 148 plus.login scope (https://www.googleapis.com/auth/plus.login).
146 149
150 The `offline` attribute allows you to get an auth code which your server can
151 redeem for an offline access token
152 (https://developers.google.com/identity/sign-in/web/server-side-flow).
153 You can also set `offline-always-prompt` instead of `offline` to ensure that you r app
154 will re-prompt the user for offline access and generate a working `refresh_token `
155 even if they have already granted offline access to your app in the past.
156
147 Use label properties to customize prompts. 157 Use label properties to customize prompts.
148 158
149 The button can be styled in using the `height`, `width`, and `theme` attributes. 159 The button can be styled in using the `height`, `width`, and `theme` attributes.
150 These attributes help you follow the Google+ Sign-In button branding guidelines 160 These attributes help you follow the Google+ Sign-In button branding guidelines
151 (https://developers.google.com/+/branding-guidelines). 161 (https://developers.google.com/+/branding-guidelines).
152 162
153 The `google-signin-success` event is triggered when a user successfully authenti cates 163 The `google-signin-success` event is triggered when a user successfully authenti cates
154 and `google-signed-out` is triggered when user signeds out. 164 and `google-signed-out` is triggered when user signs out.
155 You can also use `isAuthorized` attribute to observe user's authentication state . 165 You can also use `isAuthorized` attribute to observe user's authentication state .
156 166
157 Additional events, such as `google-signout-attempted` are 167 Additional events, such as `google-signout-attempted` are
158 triggered when the user attempts to sign-out and successfully signs out. 168 triggered when the user attempts to sign-out and successfully signs out.
159 169
170 When requesting offline access, the `google-signin-offline-success` event is
171 triggered when the user successfully consents with offline support.
172
160 The `google-signin-necessary` event is fired when scopes requested via 173 The `google-signin-necessary` event is fired when scopes requested via
161 google-signin-aware elements require additional user permissions. 174 google-signin-aware elements require additional user permissions.
162 175
163 #### Testing 176 #### Testing
164 177
165 By default, the demo accompanying this element is setup to work on localhost wit h 178 By default, the demo accompanying this element is setup to work on localhost wit h
166 port 8080. That said, you *should* update the `clientId` to your own one for 179 port 8080. That said, you *should* update the `clientId` to your own one for
167 any apps you're building. See the Google Developers Console 180 any apps you're building. See the Google Developers Console
168 (https://console.developers.google.com) for more info. 181 (https://console.developers.google.com) for more info.
169 182
(...skipping 20 matching lines...) Expand all
190 * @event google-signin-necessary 203 * @event google-signin-necessary
191 */ 204 */
192 205
193 /** 206 /**
194 * Fired when signed in, and scope has been authorized 207 * Fired when signed in, and scope has been authorized
195 * @param {Object} result Authorization result. 208 * @param {Object} result Authorization result.
196 * @event google-signin-aware-success 209 * @event google-signin-aware-success
197 */ 210 */
198 211
199 /** 212 /**
213 * Fired when an offline authorization is successful.
214 * @event google-signin-offline-success
215 * @param {Object} detail
216 * @param {string} detail.code The one-time authorization code from Google.
217 * Your application can exchange this for an `access_token` and `refresh _token`
218 */
219
220 /**
200 * Fired when this scope is not authorized 221 * Fired when this scope is not authorized
201 * @event google-signin-aware-signed-out 222 * @event google-signin-aware-signed-out
202 */ 223 */
203 properties: { 224 properties: {
204 /** 225 /**
205 * App package name for android over-the-air installs. 226 * App package name for android over-the-air installs.
206 * See the relevant [docs](https://developers.google.com/+/web/signin/an droid-app-installs) 227 * See the relevant [docs](https://developers.google.com/+/web/signin/an droid-app-installs)
207 */ 228 */
208 appPackageName: { 229 appPackageName: {
209 type: String, 230 type: String,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 */ 301 */
281 labelSignin: { 302 labelSignin: {
282 type: String, 303 type: String,
283 value: '' 304 value: ''
284 }, 305 },
285 306
286 _labelSignin: { 307 _labelSignin: {
287 type: String, 308 type: String,
288 computed: '_computeSigninLabel(labelSignin, width, _brand)' 309 computed: '_computeSigninLabel(labelSignin, width, _brand)'
289 }, 310 },
311
290 /** 312 /**
291 * An optional label for the sign-out button. 313 * An optional label for the sign-out button.
292 */ 314 */
293 labelSignout: { 315 labelSignout: {
294 type: String, 316 type: String,
295 value: 'Sign out' 317 value: 'Sign out'
296 }, 318 },
297 319
298 /** 320 /**
299 * If true, the button will be styled with a shadow. 321 * If true, the button will be styled with a shadow.
300 */ 322 */
301 raised: { 323 raised: {
302 type: Boolean, 324 type: Boolean,
303 value: false 325 value: false
304 }, 326 },
305 327
306 /** 328 /**
307 * The app activity types you want to write on behalf of the user 329 * The app activity types you want to write on behalf of the user
308 * (e.g http://schemas.google.com/AddActivity) 330 * (e.g http://schemas.google.com/AddActivity)
309 */ 331 */
310 requestVisibleActions: { 332 requestVisibleActions: {
311 type: String, 333 type: String,
312 value: '' 334 value: ''
313 }, 335 },
314 336
315 /** 337 /**
338 * The Google Apps domain to which users must belong to sign in.
339 * See the relevant [docs](https://developers.google.com/identity/sign-i n/web/reference) for more information.
340 */
341 hostedDomain: {
342 type: String,
343 value: ''
344 },
345
346 /**
347 * Allows for offline `access_token` retrieval during the signin process .
348 */
349 offline: {
350 type: Boolean,
351 value: false
352 },
353
354 /**
355 * Forces a re-prompt, even if the user has already granted offline
356 * access to your application in the past. You only need one of
357 * `offline` and `offlineAlwaysPrompt`.
358 */
359 offlineAlwaysPrompt: {
360 type: Boolean,
361 value: false
362 },
363
364 /**
316 * The scopes to provide access to (e.g https://www.googleapis.com/auth/ drive) 365 * The scopes to provide access to (e.g https://www.googleapis.com/auth/ drive)
317 * and should be space-delimited. 366 * and should be space-delimited.
318 */ 367 */
319 scopes: { 368 scopes: {
320 type: String, 369 type: String,
321 value: '' 370 value: ''
322 }, 371 },
323 372
324 /** 373 /**
325 * The theme to use for the button. 374 * The theme to use for the button.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 530
482 _signOutKeyPress: function (e) { 531 _signOutKeyPress: function (e) {
483 if (e.which == 13 || e.keyCode == 13 || e.which == 32 || e.keyCode == 32 ) { 532 if (e.which == 13 || e.keyCode == 13 || e.which == 32 || e.keyCode == 32 ) {
484 e.preventDefault(); 533 e.preventDefault();
485 this.signOut(); 534 this.signOut();
486 } 535 }
487 } 536 }
488 }); 537 });
489 }()); 538 }());
490 </script> 539 </script>
OLDNEW
« no previous file with comments | « lib/src/google-map/google-map-search.html ('k') | lib/src/google-signin/google-signin-aware.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698