| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/drive/gdata_wapi_service.h" | 5 #include "chrome/browser/drive/gdata_wapi_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/drive/drive_api_util.h" | 13 #include "chrome/browser/drive/drive_api_util.h" |
| 14 #include "chrome/browser/google_apis/auth_service.h" | 14 #include "chrome/browser/google_apis/auth_service.h" |
| 15 #include "chrome/browser/google_apis/drive_api_parser.h" | 15 #include "chrome/browser/google_apis/drive_api_parser.h" |
| 16 #include "chrome/browser/google_apis/gdata_errorcode.h" | 16 #include "chrome/browser/google_apis/gdata_errorcode.h" |
| 17 #include "chrome/browser/google_apis/gdata_wapi_parser.h" | 17 #include "chrome/browser/google_apis/gdata_wapi_parser.h" |
| 18 #include "chrome/browser/google_apis/gdata_wapi_requests.h" | 18 #include "chrome/browser/google_apis/gdata_wapi_requests.h" |
| 19 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" | 19 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
| 20 #include "chrome/browser/google_apis/request_sender.h" | 20 #include "chrome/browser/google_apis/request_sender.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "net/url_request/url_request_context_getter.h" |
| 22 | 23 |
| 23 using content::BrowserThread; | 24 using content::BrowserThread; |
| 24 using google_apis::AboutResource; | 25 using google_apis::AboutResource; |
| 25 using google_apis::AboutResourceCallback; | 26 using google_apis::AboutResourceCallback; |
| 26 using google_apis::AccountMetadata; | 27 using google_apis::AccountMetadata; |
| 27 using google_apis::AddResourceToDirectoryRequest; | 28 using google_apis::AddResourceToDirectoryRequest; |
| 28 using google_apis::AppList; | 29 using google_apis::AppList; |
| 29 using google_apis::AppListCallback; | 30 using google_apis::AppListCallback; |
| 30 using google_apis::AuthService; | 31 using google_apis::AuthService; |
| 31 using google_apis::AuthStatusCallback; | 32 using google_apis::AuthStatusCallback; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 154 |
| 154 std::vector<std::string> scopes; | 155 std::vector<std::string> scopes; |
| 155 scopes.push_back(util::kDocsListScope); | 156 scopes.push_back(util::kDocsListScope); |
| 156 scopes.push_back(kSpreadsheetsScope); | 157 scopes.push_back(kSpreadsheetsScope); |
| 157 scopes.push_back(kUserContentScope); | 158 scopes.push_back(kUserContentScope); |
| 158 // Drive App scope is required for even WAPI v3 apps access. | 159 // Drive App scope is required for even WAPI v3 apps access. |
| 159 scopes.push_back(util::kDriveAppsScope); | 160 scopes.push_back(util::kDriveAppsScope); |
| 160 sender_.reset(new RequestSender( | 161 sender_.reset(new RequestSender( |
| 161 new AuthService(oauth2_token_service_, | 162 new AuthService(oauth2_token_service_, |
| 162 account_id, | 163 account_id, |
| 163 url_request_context_getter_, | 164 url_request_context_getter_.get(), |
| 164 scopes), | 165 scopes), |
| 165 url_request_context_getter_, | 166 url_request_context_getter_.get(), |
| 166 blocking_task_runner_.get(), | 167 blocking_task_runner_.get(), |
| 167 custom_user_agent_)); | 168 custom_user_agent_)); |
| 168 | 169 |
| 169 sender_->auth_service()->AddObserver(this); | 170 sender_->auth_service()->AddObserver(this); |
| 170 } | 171 } |
| 171 | 172 |
| 172 void GDataWapiService::AddObserver(DriveServiceObserver* observer) { | 173 void GDataWapiService::AddObserver(DriveServiceObserver* observer) { |
| 173 observers_.AddObserver(observer); | 174 observers_.AddObserver(observer); |
| 174 } | 175 } |
| 175 | 176 |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 if (CanSendRequest()) { | 672 if (CanSendRequest()) { |
| 672 FOR_EACH_OBSERVER( | 673 FOR_EACH_OBSERVER( |
| 673 DriveServiceObserver, observers_, OnReadyToSendRequests()); | 674 DriveServiceObserver, observers_, OnReadyToSendRequests()); |
| 674 } else if (!HasRefreshToken()) { | 675 } else if (!HasRefreshToken()) { |
| 675 FOR_EACH_OBSERVER( | 676 FOR_EACH_OBSERVER( |
| 676 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); | 677 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); |
| 677 } | 678 } |
| 678 } | 679 } |
| 679 | 680 |
| 680 } // namespace drive | 681 } // namespace drive |
| OLD | NEW |