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

Issue 12647008: Refactor OAuth2TokenService to have profile- and device-based implementations. (Closed)

Created:
7 years, 9 months ago by David Roche
Modified:
7 years, 8 months ago
CC:
chromium-reviews, browser-components-watch_chromium.org, oshima+watch_chromium.org, stevenjb+watch_chromium.org, nkostylev+watch_chromium.org, davemoore+watch_chromium.org
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Refactor OAuth2TokenService to have profile- and device-based implementations. OAuth2TokenService was refactored into an abstract base class without dependencies on Profile and the TokenService's OAuth2 login refresh token. Added ProfileOAuth2TokenService as an implementation of OAuth2TokenService that requires a Profile and the user's login refresh token from TokenService. Migrated the existing OAuth2TokenServiceFactory and OAuth2TokenServiceRequest to Profile* varients that use this new class. Added DeviceOAuth2TokenService that serves up API access tokens for enterprise enrolled devices (via a robot account with an any-api refresh token). These tokens are global to all accounts on the device including Public Accounts, and hence don't depend on a particular profile's login credentials. BUG=164606 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=194796

Patch Set 1 #

Patch Set 2 : move function to minimize diff #

Total comments: 29

Patch Set 3 : Addressed review comments #

Patch Set 4 : fix rebase merge issue #

Patch Set 5 : Wired in new device-level encryption calls. #

Total comments: 2

Patch Set 6 : Moved DeviceOAuth2TokenService factory method to g_browser_process #

Total comments: 32

Patch Set 7 : Addressed final review comments #

Total comments: 2

Patch Set 8 : Reverted g_browser_process integration and re-instated factory, with added initialize/shutdown. #

Total comments: 19

Patch Set 9 : Addressed review comments. #

Patch Set 10 : Small tweak; handle double Shutdown calls robustly. #

Total comments: 6

Patch Set 11 : Addressed a few final review nits #

Total comments: 1

Patch Set 12 : Merged Android changes from https://codereview.chromium.org/12880014/ #

Patch Set 13 : rebase #

Patch Set 14 : Use default string constructor to be compliant with the changes in revision 193040 #

Patch Set 15 : fix compile error #

Patch Set 16 : Fix new tests on Android #

Patch Set 17 : Refactor Android integration into separate AndroidProfileOAuth2TokenService class. #

Patch Set 18 : rebase #

Patch Set 19 : rebase again #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1248 lines, -1141 lines) Patch
M chrome/browser/chromeos/chrome_browser_main_chromeos.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +6 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/settings/device_oauth2_token_service.h View 1 2 3 4 5 6 7 8 1 chunk +62 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/settings/device_oauth2_token_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +56 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +44 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +42 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +77 lines, -0 lines 0 comments Download
M chrome/browser/history/DEPS View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/history/web_history_service.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +6 lines, -5 lines 0 comments Download
M chrome/browser/prefs/browser_prefs.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +2 lines, -0 lines 0 comments Download
A chrome/browser/signin/android_profile_oauth2_token_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +51 lines, -0 lines 0 comments Download
A chrome/browser/signin/android_profile_oauth2_token_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +62 lines, -0 lines 0 comments Download
M chrome/browser/signin/oauth2_token_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 6 chunks +86 lines, -74 lines 0 comments Download
M chrome/browser/signin/oauth2_token_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 chunks +72 lines, -188 lines 0 comments Download
D chrome/browser/signin/oauth2_token_service_factory.h View 1 chunk +0 lines, -40 lines 0 comments Download
D chrome/browser/signin/oauth2_token_service_factory.cc View 1 chunk +0 lines, -38 lines 0 comments Download
D chrome/browser/signin/oauth2_token_service_request.h View 1 chunk +0 lines, -51 lines 0 comments Download
D chrome/browser/signin/oauth2_token_service_request.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -195 lines 0 comments Download
D chrome/browser/signin/oauth2_token_service_request_unittest.cc View 1 chunk +0 lines, -238 lines 0 comments Download
A chrome/browser/signin/oauth2_token_service_test_util.h View 1 2 3 4 5 6 1 chunk +38 lines, -0 lines 0 comments Download
A chrome/browser/signin/oauth2_token_service_test_util.cc View 1 2 3 4 5 6 1 chunk +40 lines, -0 lines 0 comments Download
M chrome/browser/signin/oauth2_token_service_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 18 chunks +96 lines, -174 lines 0 comments Download
A chrome/browser/signin/profile_oauth2_token_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +101 lines, -0 lines 0 comments Download
A chrome/browser/signin/profile_oauth2_token_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +131 lines, -0 lines 0 comments Download
A + chrome/browser/signin/profile_oauth2_token_service_factory.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +19 lines, -17 lines 0 comments Download
A + chrome/browser/signin/profile_oauth2_token_service_factory.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +23 lines, -11 lines 0 comments Download
A + chrome/browser/signin/profile_oauth2_token_service_request.h View 1 chunk +17 lines, -21 lines 0 comments Download
A + chrome/browser/signin/profile_oauth2_token_service_request.cc View 1 2 3 4 5 6 7 8 9 10 11 12 11 chunks +39 lines, -33 lines 0 comments Download
A + chrome/browser/signin/profile_oauth2_token_service_request_unittest.cc View 1 2 3 4 5 6 8 chunks +51 lines, -48 lines 0 comments Download
A chrome/browser/signin/profile_oauth2_token_service_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +97 lines, -0 lines 0 comments Download
M chrome/browser/signin/token_service_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -1 line 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +8 lines, -4 lines 0 comments Download
M chrome/chrome_browser_chromeos.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +6 lines, -2 lines 0 comments Download
M chrome/common/pref_names.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/pref_names.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 34 (0 generated)
David Roche
Andrew, here is the new CL. Looks like the trybots are still having issues with ...
7 years, 9 months ago (2013-03-16 22:33:48 UTC) #1
Andrew T Wilson (Slow)
LGTM after addressing nits/comments below. https://codereview.chromium.org/12647008/diff/2001/chrome/browser/chromeos/settings/device_oauth2_token_service.cc File chrome/browser/chromeos/settings/device_oauth2_token_service.cc (right): https://codereview.chromium.org/12647008/diff/2001/chrome/browser/chromeos/settings/device_oauth2_token_service.cc#newcode41 chrome/browser/chromeos/settings/device_oauth2_token_service.cc:41: g_browser_process->local_state()->SetString(kRobotAnyApiRefreshTokenPrefKey, Consider injecting the ...
7 years, 9 months ago (2013-03-19 19:58:43 UTC) #2
David Roche
Also addressed comments that mnissler made in CL 12759002. https://codereview.chromium.org/12647008/diff/2001/chrome/browser/chromeos/settings/device_oauth2_token_service.h File chrome/browser/chromeos/settings/device_oauth2_token_service.h (right): https://codereview.chromium.org/12647008/diff/2001/chrome/browser/chromeos/settings/device_oauth2_token_service.h#newcode34 chrome/browser/chromeos/settings/device_oauth2_token_service.h:34: ...
7 years, 9 months ago (2013-03-21 00:12:02 UTC) #3
Mattias Nissler (ping if slow)
https://codereview.chromium.org/12647008/diff/20001/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc File chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc (right): https://codereview.chromium.org/12647008/diff/20001/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc#newcode36 chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc:36: g_browser_process->system_request_context())); Ha, so the factory design is broken here ...
7 years, 9 months ago (2013-03-21 06:59:15 UTC) #4
David Roche
https://codereview.chromium.org/12647008/diff/20001/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc File chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc (right): https://codereview.chromium.org/12647008/diff/20001/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc#newcode36 chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc:36: g_browser_process->system_request_context())); On 2013/03/21 06:59:15, Mattias Nissler wrote: > Ha, ...
7 years, 9 months ago (2013-03-21 20:36:31 UTC) #5
David Roche
Moved DeviceOAuth2TokenService factory method to g_browser_process, per offline discussion. Mattias, PTAL.
7 years, 9 months ago (2013-03-26 01:42:23 UTC) #6
Mattias Nissler (ping if slow)
I'm mostly good with this, so LGTM pending the cleanups. https://codereview.chromium.org/12647008/diff/27001/chrome/browser/browser_process_impl.cc File chrome/browser/browser_process_impl.cc (right): https://codereview.chromium.org/12647008/diff/27001/chrome/browser/browser_process_impl.cc#newcode447 ...
7 years, 9 months ago (2013-03-26 12:04:32 UTC) #7
David Roche
https://codereview.chromium.org/12647008/diff/27001/chrome/browser/browser_process_impl.cc File chrome/browser/browser_process_impl.cc (right): https://codereview.chromium.org/12647008/diff/27001/chrome/browser/browser_process_impl.cc#newcode447 chrome/browser/browser_process_impl.cc:447: return NULL; On 2013/03/26 12:04:32, Mattias Nissler wrote: > ...
7 years, 9 months ago (2013-03-27 05:09:51 UTC) #8
David Roche
brettw: can you please do an OWNERS review for the chrome/browser/ and chrome/browser/history/ changes? Thanks!
7 years, 9 months ago (2013-03-27 21:41:16 UTC) #9
brettw
https://codereview.chromium.org/12647008/diff/8002/chrome/browser/browser_process.h File chrome/browser/browser_process.h (right): https://codereview.chromium.org/12647008/diff/8002/chrome/browser/browser_process.h#newcode121 chrome/browser/browser_process.h:121: virtual chromeos::DeviceOAuth2TokenService* device_oauth2_token_service() = 0; We're trying to kill ...
7 years, 9 months ago (2013-03-28 20:18:32 UTC) #10
Mattias Nissler (ping if slow)
On Mar 28, 2013 9:18 PM, <brettw@chromium.org> wrote: > > > https://codereview.chromium.org/12647008/diff/8002/chrome/browser/browser_process.h > File chrome/browser/browser_process.h ...
7 years, 9 months ago (2013-03-28 21:02:12 UTC) #11
brettw
I think the way we're going with the extensions service and other things is to ...
7 years, 9 months ago (2013-03-28 23:46:35 UTC) #12
David Roche
Brett, It doesn't look like the request context implements SupportsUserData. The dependencies that DeviceOAuth2TokenService has ...
7 years, 8 months ago (2013-04-02 00:04:08 UTC) #13
Mattias Nissler (ping if slow)
On 2013/04/02 00:04:08, David Roche wrote: > Brett, > > It doesn't look like the ...
7 years, 8 months ago (2013-04-02 13:17:19 UTC) #14
David Roche
Okay, I removed the g_browser_process integration per Brett's comments, and added a factory that is ...
7 years, 8 months ago (2013-04-03 01:20:28 UTC) #15
Mattias Nissler (ping if slow)
https://codereview.chromium.org/12647008/diff/47001/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc File chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc (right): https://codereview.chromium.org/12647008/diff/47001/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc#newcode28 chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc:28: return factory.GetImpl(); It seems like a simpler implementation could ...
7 years, 8 months ago (2013-04-03 11:33:16 UTC) #16
David Roche
https://codereview.chromium.org/12647008/diff/47001/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc File chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc (right): https://codereview.chromium.org/12647008/diff/47001/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc#newcode28 chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc:28: return factory.GetImpl(); On 2013/04/03 11:33:16, Mattias Nissler wrote: > ...
7 years, 8 months ago (2013-04-03 16:34:09 UTC) #17
Mattias Nissler (ping if slow)
LGTM w/ nits. https://codereview.chromium.org/12647008/diff/47001/chrome/browser/signin/oauth2_token_service.h File chrome/browser/signin/oauth2_token_service.h (right): https://codereview.chromium.org/12647008/diff/47001/chrome/browser/signin/oauth2_token_service.h#newcode97 chrome/browser/signin/oauth2_token_service.h:97: void Shutdown(); On 2013/04/03 16:34:09, David ...
7 years, 8 months ago (2013-04-04 13:11:11 UTC) #18
David Roche
brettw: I removed the g_browser_process method and created a separate factory class. Can you take ...
7 years, 8 months ago (2013-04-04 14:52:48 UTC) #19
brettw
LGTM, this integration looks better to me. (Previously, I got resource contexts and requests contexts ...
7 years, 8 months ago (2013-04-05 21:58:03 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/davidroche@chromium.org/12647008/86001
7 years, 8 months ago (2013-04-09 00:45:49 UTC) #21
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 8 months ago (2013-04-09 01:02:37 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/davidroche@chromium.org/12647008/120001
7 years, 8 months ago (2013-04-11 18:22:03 UTC) #23
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 8 months ago (2013-04-11 18:54:02 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/davidroche@chromium.org/12647008/140001
7 years, 8 months ago (2013-04-11 22:23:55 UTC) #25
commit-bot: I haz the power
The commit queue went berserk retrying too often for a seemingly flaky test. Builder is ...
7 years, 8 months ago (2013-04-12 03:05:49 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/davidroche@chromium.org/12647008/111034
7 years, 8 months ago (2013-04-12 04:01:35 UTC) #27
commit-bot: I haz the power
Retried try job too often on ios_rel_device for step(s) compile http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=ios_rel_device&number=40498
7 years, 8 months ago (2013-04-12 04:44:24 UTC) #28
David Roche
@dubroy: Patrick, you recently integrated Android support into OAuth2TokenService. I've refactored OAuth2TokenService to support profile-scoped ...
7 years, 8 months ago (2013-04-16 18:02:37 UTC) #29
Patrick Dubroy
Awesome! Thanks a lot for doing this. The changes I made for Android were definitely ...
7 years, 8 months ago (2013-04-16 18:20:44 UTC) #30
davidroche
Sure, I can wait a day to commit. Thanks! On Tue, Apr 16, 2013 at ...
7 years, 8 months ago (2013-04-16 18:27:44 UTC) #31
Patrick Dubroy
On 2013/04/16 18:27:44, davidroche_google.com wrote: > Sure, I can wait a day to commit. Thanks! ...
7 years, 8 months ago (2013-04-17 11:15:37 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/davidroche@chromium.org/12647008/188002
7 years, 8 months ago (2013-04-18 01:39:11 UTC) #33
commit-bot: I haz the power
7 years, 8 months ago (2013-04-18 06:02:20 UTC) #34
Message was sent while issue was closed.
Change committed as 194796

Powered by Google App Engine
This is Rietveld 408576698