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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc

Issue 881403003: Rename gdata_errorcode.h to drive_api_error_codes.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos in BUILD.gn Created 5 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
OLDNEW
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_drive.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 9 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" 10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h"
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 848
849 // Retrieve the cached auth token (if available), otherwise the AuthService 849 // Retrieve the cached auth token (if available), otherwise the AuthService
850 // instance will try to refetch it. 850 // instance will try to refetch it.
851 drive_service->RequestAccessToken( 851 drive_service->RequestAccessToken(
852 base::Bind(&FileManagerPrivateRequestAccessTokenFunction:: 852 base::Bind(&FileManagerPrivateRequestAccessTokenFunction::
853 OnAccessTokenFetched, this)); 853 OnAccessTokenFetched, this));
854 return true; 854 return true;
855 } 855 }
856 856
857 void FileManagerPrivateRequestAccessTokenFunction::OnAccessTokenFetched( 857 void FileManagerPrivateRequestAccessTokenFunction::OnAccessTokenFetched(
858 google_apis::GDataErrorCode code, 858 google_apis::DriveApiErrorCode code,
859 const std::string& access_token) { 859 const std::string& access_token) {
860 SetResult(new base::StringValue(access_token)); 860 SetResult(new base::StringValue(access_token));
861 SendResponse(true); 861 SendResponse(true);
862 } 862 }
863 863
864 bool FileManagerPrivateGetShareUrlFunction::RunAsync() { 864 bool FileManagerPrivateGetShareUrlFunction::RunAsync() {
865 using extensions::api::file_manager_private::GetShareUrl::Params; 865 using extensions::api::file_manager_private::GetShareUrl::Params;
866 const scoped_ptr<Params> params(Params::Create(*args_)); 866 const scoped_ptr<Params> params(Params::Create(*args_));
867 EXTENSION_FUNCTION_VALIDATE(params); 867 EXTENSION_FUNCTION_VALIDATE(params);
868 868
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 auth_service_.reset( 1020 auth_service_.reset(
1021 new google_apis::AuthService(oauth2_token_service, 1021 new google_apis::AuthService(oauth2_token_service,
1022 account_id, 1022 account_id,
1023 GetProfile()->GetRequestContext(), 1023 GetProfile()->GetRequestContext(),
1024 scopes)); 1024 scopes));
1025 auth_service_->StartAuthentication(base::Bind( 1025 auth_service_->StartAuthentication(base::Bind(
1026 &FileManagerPrivateGetDownloadUrlFunction::OnTokenFetched, this)); 1026 &FileManagerPrivateGetDownloadUrlFunction::OnTokenFetched, this));
1027 } 1027 }
1028 1028
1029 void FileManagerPrivateGetDownloadUrlFunction::OnTokenFetched( 1029 void FileManagerPrivateGetDownloadUrlFunction::OnTokenFetched(
1030 google_apis::GDataErrorCode code, 1030 google_apis::DriveApiErrorCode code,
1031 const std::string& access_token) { 1031 const std::string& access_token) {
1032 if (code != google_apis::HTTP_SUCCESS) { 1032 if (code != google_apis::HTTP_SUCCESS) {
1033 SetError("Not able to fetch the token."); 1033 SetError("Not able to fetch the token.");
1034 SetResult(new base::StringValue("")); // Intentionally returns a blank. 1034 SetResult(new base::StringValue("")); // Intentionally returns a blank.
1035 SendResponse(false); 1035 SendResponse(false);
1036 return; 1036 return;
1037 } 1037 }
1038 1038
1039 const std::string url = download_url_ + "?access_token=" + access_token; 1039 const std::string url = download_url_ + "?access_token=" + access_token;
1040 SetResult(new base::StringValue(url)); 1040 SetResult(new base::StringValue(url));
1041 1041
1042 SendResponse(true); 1042 SendResponse(true);
1043 } 1043 }
1044 1044
1045 } // namespace extensions 1045 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698