Extract ArcTermsOfServiceNegotiator implementation.
This extracts Terms-Of-Service agreement handling into
a standalone class.
BUG=657687
BUG=b/31079732
TEST=Ran on test device. Ran bots.
Committed: https://crrev.com/3b196d322a4a334c17879af6b2f7bbe284eedb1c
Cr-Commit-Position: refs/heads/master@{#435910}
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/280257)
https://codereview.chromium.org/2534883002/diff/1/chrome/browser/chromeos/arc/arc_session_manager.cc File chrome/browser/chromeos/arc/arc_session_manager.cc (right): https://codereview.chromium.org/2534883002/diff/1/chrome/browser/chromeos/arc/arc_session_manager.cc#newcode521 chrome/browser/chromeos/arc/arc_session_manager.cc:521: !IsArcKioskMode()) { I had a *very* hard time parsing ...
Thank you for review. PTAL. https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos/arc/arc_session_manager.cc File chrome/browser/chromeos/arc/arc_session_manager.cc (right): https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos/arc/arc_session_manager.cc#newcode520 chrome/browser/chromeos/arc/arc_session_manager.cc:520: // then it should ...
Thank you for review. PTAL.
https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos...
File chrome/browser/chromeos/arc/arc_session_manager.cc (right):
https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos...
chrome/browser/chromeos/arc/arc_session_manager.cc:520: // then it should have
been done in OOBE phase.
On 2016/11/29 18:18:12, Luis Héctor Chávez wrote:
> ah! now I understand this part.
>
> "If Sign-in is not yet completed, then management checking will be performed
in
> the OOBE phase."
>
> IIUC, we never perform management checking (from the Chrome side) on first
> sign-in, which means that management checking will be done later, either in
> Android or next boot on Chrome.
Chatted with khmel@ offline.
It was not, but it was planned.
However, this check hit an edge case (2) of the comment in new code), and there
were no good way to split them.
So, instead, we agreed to check Android management status even OOBE case here.
Also, I found that it is necessary to check kArcSignIn flag first, for backward
compatibility.
Revised the code.
https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos...
chrome/browser/chromeos/arc/arc_session_manager.cc:679: void
ArcSessionManager::OnTermsOfServiceNegotiated(bool agreed) {
On 2016/11/29 18:18:12, Luis Héctor Chávez wrote:
> nit: let's standardize on "accepted" since you're then storing this in a pref
> called prefs::kArcTermsAccepted.
Done for ArcTermsOfServiceNegotiator and above layers.
I left OnTermsAgreed as is, because the button is "AGREE" for now.
I'm happy to change them, too (either changing ArcSupportHost /
arc_support/background.js and/or UI itself) if necessary, but then let me work
on in a separate CL.
https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos...
File chrome/browser/chromeos/arc/extensions/fake_arc_support.h (right):
https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos...
chrome/browser/chromeos/arc/extensions/fake_arc_support.h:53: ArcSupportHost*
support_host_;
On 2016/11/29 18:18:12, Luis Héctor Chávez wrote:
> nit: ArcSupportHost* const support_host_;
Done.
https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos...
File chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h
(right):
https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos...
chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h:36: using
AgreementCallback = base::Callback<void(bool agreed)>;
On 2016/11/29 18:18:12, Luis Héctor Chávez wrote:
> same here, s/agreed/accepted/. Maybe also rename AgreementCallback to
> NegotiationCallback or something like that.
Done.
https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos...
File
chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc
(right):
https://codereview.chromium.org/2534883002/diff/40001/chrome/browser/chromeos...
chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc:89:
// Initialize the preference value.
On 2016/11/29 18:18:12, Luis Héctor Chávez wrote:
> IIUC L89-L99 can be safely moved to SetUp() to avoid duplicated boilerplate.
You
> can also expose |status| through a method.
Moved L89 - L92, but let me keep L93-, because;
1) these invocation is a part of the main test scenario, rather than a part of
testing env set up.
2) We bind |status| local variable. Although, it can be a field of the
ArcTermsOfServiceNegotiatorTest class, but IMHO, this style looks less
boilerplate. WDYT?
lgtm with one final nit. https://codereview.chromium.org/2534883002/diff/100001/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc File chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc (right): https://codereview.chromium.org/2534883002/diff/100001/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc#newcode95 chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc:95: negotiator()->StartNegotiation(base::Bind( last attempt :P ...
lgtm with one final nit.
https://codereview.chromium.org/2534883002/diff/100001/chrome/browser/chromeo...
File
chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc
(right):
https://codereview.chromium.org/2534883002/diff/100001/chrome/browser/chromeo...
chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc:95:
negotiator()->StartNegotiation(base::Bind(
last attempt :P
if you really don't want to move |status| as a member, can you at least move the
boilerplate base::Bind() to a function and instead do:
namespace {
void UpdateStatusCallback(Status* status) {
return base::Bind(
[](Status* status, bool agreed) {
*status = agreed ? Status::AGREED : Status::CANCELLED;
}, &status));
}
} //namespace
...
Status status = Status::PENDING;
negotiator()->StartNegotiation(UpdateStatusCallback(&status));
hidehiko
Thank you for review. Submitting. https://codereview.chromium.org/2534883002/diff/100001/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc File chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc (right): https://codereview.chromium.org/2534883002/diff/100001/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc#newcode95 chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc:95: negotiator()->StartNegotiation(base::Bind( On 2016/12/01 17:24:14, ...
Thank you for review. Submitting.
https://codereview.chromium.org/2534883002/diff/100001/chrome/browser/chromeo...
File
chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc
(right):
https://codereview.chromium.org/2534883002/diff/100001/chrome/browser/chromeo...
chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc:95:
negotiator()->StartNegotiation(base::Bind(
On 2016/12/01 17:24:14, Luis Héctor Chávez wrote:
> last attempt :P
>
> if you really don't want to move |status| as a member, can you at least move
the
> boilerplate base::Bind() to a function and instead do:
>
> namespace {
> void UpdateStatusCallback(Status* status) {
> return base::Bind(
> [](Status* status, bool agreed) {
> *status = agreed ? Status::AGREED : Status::CANCELLED;
> }, &status));
> }
> } //namespace
>
> ...
>
> Status status = Status::PENDING;
> negotiator()->StartNegotiation(UpdateStatusCallback(&status));
SGTM. Done. Thank you for suggestion.
https://codereview.chromium.org/2534883002/diff/140001/chrome/browser/chromeo...
File
chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc
(right):
https://codereview.chromium.org/2534883002/diff/140001/chrome/browser/chromeo...
chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator_unittest.cc:76:
ACCEPTED,
Note: one more forgotten AGREED. Fixed.
Description was changed from ========== Extract ArcTermsOfServiceNegotiator implementation. This extracts Terms-Of-Service agreement handling into a ...
Description was changed from
==========
Extract ArcTermsOfServiceNegotiator implementation.
This extracts Terms-Of-Service agreement handling into
a standalone class.
BUG=657687
BUG=b/31079732
TEST=Ran on test device. Ran bots.
==========
to
==========
Extract ArcTermsOfServiceNegotiator implementation.
This extracts Terms-Of-Service agreement handling into
a standalone class.
BUG=657687
BUG=b/31079732
TEST=Ran on test device. Ran bots.
Committed: https://crrev.com/3b196d322a4a334c17879af6b2f7bbe284eedb1c
Cr-Commit-Position: refs/heads/master@{#435910}
==========
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/3b196d322a4a334c17879af6b2f7bbe284eedb1c Cr-Commit-Position: refs/heads/master@{#435910}
Issue 2534883002: Extract ArcTermsOfServiceNegotiator implementation.
(Closed)
Created 4 years ago by hidehiko
Modified 4 years ago
Reviewers: Luis Héctor Chávez, bartfab (slow), peletskyi, Sergey Poromov
Base URL:
Comments: 49