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

Unified Diff: polymer_1.0.4/bower_components/platinum-push-messaging/demo/index.html

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: polymer_1.0.4/bower_components/platinum-push-messaging/demo/index.html
diff --git a/polymer_1.0.4/bower_components/platinum-push-messaging/demo/index.html b/polymer_1.0.4/bower_components/platinum-push-messaging/demo/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..1d8ed2537c8d3bbb171c17f63c2abaa736756e69
--- /dev/null
+++ b/polymer_1.0.4/bower_components/platinum-push-messaging/demo/index.html
@@ -0,0 +1,130 @@
+<!--
+Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+-->
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>&lt;platinum-push-messaging&gt; Demo</title>
+ <script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
+ <link rel="import" href="../../paper-styles/paper-styles.html">
+ <link rel="import" href="../../paper-styles/classes/global.html">
+ <link rel="import" href="../../paper-item/paper-item.html">
+ <link rel="import" href="../../paper-material/paper-material.html">
+ <link rel="import" href="../../paper-toggle-button/paper-toggle-button.html">
+ <link rel="import" href="../platinum-push-messaging.html">
+ <link rel="manifest" href="manifest.json">
+
+ <style>
+ .warning {
+ border: 3px solid red;
+ max-width: 500px;
+ margin: 50px auto;
+ padding: 30px;
+ }
+
+ paper-material {
+ padding: 10px;
+ }
+ </style>
+ </head>
+
+ <body>
+ <platinum-push-messaging
+ title="You received a push message!"
+ message="Yay! Now you can play around customizing it"
+ >
+ </platinum-push-messaging>
+
+ <div id="unsupported" style="display: none;" class="warning">
+ Sorry, your browser doesn't support push notifications.
+ </div>
+
+ <div id="supported">
+ <paper-material elevation="1" style="margin: 20px auto; background-color: white; max-width: 800px;">
+
+ <paper-item>
+ <paper-item-body two-line class="layout vertical">
+ <div>You can sign up for push messaging with the demo as-is. However, if you want to test it and actually send a real push message you will need to provide your own details. Open up the manifest.json file and change the gcm_sender_id to your own, and then re-enable messaging to get a new subscription ID.</div>
+
+ <div>See <a href="http://updates.html5rocks.com/2015/03/push-notificatons-on-the-open-web#make-a-project-on-the-google-developer-console">the HTML5Rocks guide to push notifications</a> for details on signing up for the necessary key and sender ID.</div>
+ </paper-item-body>
+ </paper-item>
+
+ <br/>
+
+ <paper-item>
+ <paper-item-body two-line class="layout vertical">
+ <div>
+ Enable push messaging
+ </div>
+ <div>
+ <paper-toggle-button id="enable-push" toggles disabled></paper-toggle-button>
+ </div>
+ </paper-item-body>
+ </paper-item>
+ <paper-item>
+ <paper-item-body two-line class="layout vertical">
+ <div>
+ Current subscription
+ </div>
+ <div>
+ <pre class="paper-font-code1" style="overflow: auto; margin: 5px;" id="subscription"></pre>
+ </div>
+ </paper-item-body>
+ </paper-item>
+ <paper-item id="send-instructions">
+ <paper-item-body two-line class="layout vertical">
+ <div>
+ Send a push (Mac/Unix)
+ </div>
+ <div>
+ <pre class="paper-font-code1" style="overflow: auto; margin: 5px;">curl https://android.googleapis.com/gcm/send -d "registration_id=<span id="registration-id"></span>" --header "Authorization: key=[YOUR_PUBLIC_API_KEY]"</pre>
+ </div>
+ </paper-item-body>
+ </paper-item>
+ </paper-material>
+ </div>
+
+ <script>
+ document.addEventListener('WebComponentsReady', function() {
+ var ppm = document.querySelector('platinum-push-messaging');
+ var toggle = document.getElementById('enable-push');
+ var subscription = document.getElementById('subscription');
+ var registrationId = document.getElementById('registration-id');
+ var sendInstructions = document.getElementById('send-instructions');
+
+ toggle.disabled = !ppm.supported;
+
+ if (!ppm.supported) {
+ document.getElementById('supported').style.display = 'none';
+ document.getElementById('unsupported').style.display = '';
+ }
+
+ toggle.addEventListener('change', function() {
+ if (toggle.checked) {
+ ppm.enable();
+ } else {
+ ppm.disable();
+ }
+ });
+
+ ppm.addEventListener('subscription-changed', function(event) {
+ subscription.textContent = JSON.stringify(ppm.subscription || undefined, null, 2);
+ registrationId.textContent = ppm.subscription ? ppm.subscription.subscriptionId : '';
+ });
+
+ ppm.addEventListener('enabled-changed', function(event) {
+ toggle.checked = ppm.enabled;
+ sendInstructions.style.display = ppm.enabled ? '' : 'none';
+ });
+ });
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698