OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_misc.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_misc.h" |
6 | 6 |
7 #include "ash/frame/frame_util.h" | 7 #include "ash/frame/frame_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 scopes)); | 337 scopes)); |
338 auth_service_->StartAuthentication(base::Bind( | 338 auth_service_->StartAuthentication(base::Bind( |
339 &FileManagerPrivateRequestWebStoreAccessTokenFunction:: | 339 &FileManagerPrivateRequestWebStoreAccessTokenFunction:: |
340 OnAccessTokenFetched, | 340 OnAccessTokenFetched, |
341 this)); | 341 this)); |
342 | 342 |
343 return true; | 343 return true; |
344 } | 344 } |
345 | 345 |
346 void FileManagerPrivateRequestWebStoreAccessTokenFunction::OnAccessTokenFetched( | 346 void FileManagerPrivateRequestWebStoreAccessTokenFunction::OnAccessTokenFetched( |
347 google_apis::GDataErrorCode code, | 347 google_apis::DriveApiErrorCode code, |
348 const std::string& access_token) { | 348 const std::string& access_token) { |
349 drive::EventLogger* logger = file_manager::util::GetLogger(GetProfile()); | 349 drive::EventLogger* logger = file_manager::util::GetLogger(GetProfile()); |
350 | 350 |
351 if (code == google_apis::HTTP_SUCCESS) { | 351 if (code == google_apis::HTTP_SUCCESS) { |
352 DCHECK(auth_service_->HasAccessToken()); | 352 DCHECK(auth_service_->HasAccessToken()); |
353 DCHECK(access_token == auth_service_->access_token()); | 353 DCHECK(access_token == auth_service_->access_token()); |
354 if (logger) | 354 if (logger) |
355 logger->Log(logging::LOG_INFO, "CWS OAuth token fetch succeeded."); | 355 logger->Log(logging::LOG_INFO, "CWS OAuth token fetch succeeded."); |
356 SetResult(new base::StringValue(access_token)); | 356 SetResult(new base::StringValue(access_token)); |
357 SendResponse(true); | 357 SendResponse(true); |
358 } else { | 358 } else { |
359 if (logger) { | 359 if (logger) { |
360 logger->Log(logging::LOG_ERROR, | 360 logger->Log(logging::LOG_ERROR, |
361 "CWS OAuth token fetch failed. (GDataErrorCode: %s)", | 361 "CWS OAuth token fetch failed. (DriveApiErrorCode: %s)", |
362 google_apis::GDataErrorCodeToString(code).c_str()); | 362 google_apis::DriveApiErrorCodeToString(code).c_str()); |
363 } | 363 } |
364 SetResult(base::Value::CreateNullValue()); | 364 SetResult(base::Value::CreateNullValue()); |
365 SendResponse(false); | 365 SendResponse(false); |
366 } | 366 } |
367 } | 367 } |
368 | 368 |
369 bool FileManagerPrivateGetProfilesFunction::RunSync() { | 369 bool FileManagerPrivateGetProfilesFunction::RunSync() { |
370 const std::vector<linked_ptr<api::file_manager_private::ProfileInfo> >& | 370 const std::vector<linked_ptr<api::file_manager_private::ProfileInfo> >& |
371 profiles = GetLoggedInProfileInfoList(); | 371 profiles = GetLoggedInProfileInfoList(); |
372 | 372 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 return true; | 498 return true; |
499 } | 499 } |
500 | 500 |
501 void FileManagerPrivateGetMimeTypeFunction::OnGetMimeType( | 501 void FileManagerPrivateGetMimeTypeFunction::OnGetMimeType( |
502 const std::string& mimeType) { | 502 const std::string& mimeType) { |
503 SetResult(new base::StringValue(mimeType)); | 503 SetResult(new base::StringValue(mimeType)); |
504 SendResponse(true); | 504 SendResponse(true); |
505 } | 505 } |
506 | 506 |
507 } // namespace extensions | 507 } // namespace extensions |
OLD | NEW |