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

Side by Side Diff: utils/pub/oauth2.dart

Issue 12262056: Clean up some warnings and deprecated calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/log.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library oauth2; 5 library oauth2;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:uri'; 9 import 'dart:uri';
10 10
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 /// Loads the user's OAuth2 credentials from the in-memory cache or the 111 /// Loads the user's OAuth2 credentials from the in-memory cache or the
112 /// filesystem if possible. If the credentials can't be loaded for any reason, 112 /// filesystem if possible. If the credentials can't be loaded for any reason,
113 /// the returned [Future] will complete to null. 113 /// the returned [Future] will complete to null.
114 Credentials _loadCredentials(SystemCache cache) { 114 Credentials _loadCredentials(SystemCache cache) {
115 log.fine('Loading OAuth2 credentials.'); 115 log.fine('Loading OAuth2 credentials.');
116 116
117 try { 117 try {
118 if (_credentials != null) return _credentials; 118 if (_credentials != null) return _credentials;
119 119
120 var path = _credentialsFile(cache); 120 var path = _credentialsFile(cache);
121 if (!fileExists(path)) return; 121 if (!fileExists(path)) return null;
122 122
123 var credentials = new Credentials.fromJson(readTextFile(path)); 123 var credentials = new Credentials.fromJson(readTextFile(path));
124 if (credentials.isExpired && !credentials.canRefresh) { 124 if (credentials.isExpired && !credentials.canRefresh) {
125 log.error("Pub's authorization to upload packages has expired and " 125 log.error("Pub's authorization to upload packages has expired and "
126 "can't be automatically refreshed."); 126 "can't be automatically refreshed.");
127 return null; // null means re-authorize. 127 return null; // null means re-authorize.
128 } 128 }
129 129
130 return credentials; 130 return credentials;
131 } catch (e) { 131 } catch (e) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 'Pub needs your authorization to upload packages on your behalf.\n' 196 'Pub needs your authorization to upload packages on your behalf.\n'
197 'In a web browser, go to $authUrl\n' 197 'In a web browser, go to $authUrl\n'
198 'Then click "Allow access".\n\n' 198 'Then click "Allow access".\n\n'
199 'Waiting for your authorization...'); 199 'Waiting for your authorization...');
200 200
201 return completer.future.then((client) { 201 return completer.future.then((client) {
202 log.message('Successfully authorized.\n'); 202 log.message('Successfully authorized.\n');
203 return client; 203 return client;
204 }); 204 });
205 } 205 }
OLDNEW
« no previous file with comments | « utils/pub/log.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698