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

Side by Side Diff: chrome/browser/chromeos/gdata/operations_base.cc

Issue 10818017: contacts: Add GDataContactsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/struct/class/ in forward declaration (caught by clang) Created 8 years, 4 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 | « chrome/browser/chromeos/gdata/gdata_system_service.cc ('k') | chrome/chrome_browser.gypi » ('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 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/chromeos/gdata/operations_base.h" 5 #include "chrome/browser/chromeos/gdata/operations_base.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 28 matching lines...) Expand all
39 const char kGDataVersionHeader[] = "GData-Version: 3.0"; 39 const char kGDataVersionHeader[] = "GData-Version: 3.0";
40 40
41 // Maximum number of attempts for re-authentication per operation. 41 // Maximum number of attempts for re-authentication per operation.
42 const int kMaxReAuthenticateAttemptsPerOperation = 1; 42 const int kMaxReAuthenticateAttemptsPerOperation = 1;
43 43
44 // OAuth scope for the documents API. 44 // OAuth scope for the documents API.
45 const char kDocsListScope[] = "https://docs.google.com/feeds/"; 45 const char kDocsListScope[] = "https://docs.google.com/feeds/";
46 const char kSpreadsheetsScope[] = "https://spreadsheets.google.com/feeds/"; 46 const char kSpreadsheetsScope[] = "https://spreadsheets.google.com/feeds/";
47 const char kUserContentScope[] = "https://docs.googleusercontent.com/"; 47 const char kUserContentScope[] = "https://docs.googleusercontent.com/";
48 48
49 // OAuth scope for the Contacts API.
50 const char kContactsScope[] = "https://www.google.com/m8/feeds/";
51
49 // OAuth scope for Drive API. 52 // OAuth scope for Drive API.
50 const char kDriveAppsScope[] = "https://www.googleapis.com/auth/drive.apps"; 53 const char kDriveAppsScope[] = "https://www.googleapis.com/auth/drive.apps";
51 54
52 } // namespace 55 } // namespace
53 56
54 namespace gdata { 57 namespace gdata {
55 58
56 //================================ AuthOperation =============================== 59 //================================ AuthOperation ===============================
57 60
58 AuthOperation::AuthOperation(GDataOperationRegistry* registry, 61 AuthOperation::AuthOperation(GDataOperationRegistry* registry,
59 Profile* profile, 62 Profile* profile,
60 const AuthStatusCallback& callback, 63 const AuthStatusCallback& callback,
61 const std::string& refresh_token) 64 const std::string& refresh_token)
62 : GDataOperationRegistry::Operation(registry), 65 : GDataOperationRegistry::Operation(registry),
63 profile_(profile), refresh_token_(refresh_token), callback_(callback) { 66 profile_(profile), refresh_token_(refresh_token), callback_(callback) {
64 } 67 }
65 68
66 AuthOperation::~AuthOperation() {} 69 AuthOperation::~AuthOperation() {}
67 70
68 void AuthOperation::Start() { 71 void AuthOperation::Start() {
69 DCHECK(!refresh_token_.empty()); 72 DCHECK(!refresh_token_.empty());
70 std::vector<std::string> scopes; 73 std::vector<std::string> scopes;
71 scopes.push_back(kDocsListScope); 74 scopes.push_back(kDocsListScope);
72 scopes.push_back(kSpreadsheetsScope); 75 scopes.push_back(kSpreadsheetsScope);
73 scopes.push_back(kUserContentScope); 76 scopes.push_back(kUserContentScope);
77 scopes.push_back(kContactsScope);
74 if (gdata::util::IsDriveV2ApiEnabled()) 78 if (gdata::util::IsDriveV2ApiEnabled())
75 scopes.push_back(kDriveAppsScope); 79 scopes.push_back(kDriveAppsScope);
76 oauth2_access_token_fetcher_.reset(new OAuth2AccessTokenFetcher( 80 oauth2_access_token_fetcher_.reset(new OAuth2AccessTokenFetcher(
77 this, g_browser_process->system_request_context())); 81 this, g_browser_process->system_request_context()));
78 NotifyStart(); 82 NotifyStart();
79 oauth2_access_token_fetcher_->Start( 83 oauth2_access_token_fetcher_->Start(
80 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), 84 GaiaUrls::GetInstance()->oauth2_chrome_client_id(),
81 GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), 85 GaiaUrls::GetInstance()->oauth2_chrome_client_secret(),
82 refresh_token_, 86 refresh_token_,
83 scopes); 87 scopes);
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 << ", code: " 386 << ", code: "
383 << error_code 387 << error_code
384 << ", data:\n" 388 << ", data:\n"
385 << data; 389 << data;
386 return NULL; 390 return NULL;
387 } 391 }
388 return root_value.release(); 392 return root_value.release();
389 } 393 }
390 394
391 } // namespace gdata 395 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_system_service.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698