Index: chrome/browser/ui/sync/one_click_signin_helper.h |
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.h b/chrome/browser/ui/sync/one_click_signin_helper.h |
index 9bc0eab8cce866b40f464535bef18bf5aabb9576..8e12f591a6541bffd73c7cb4fe9465d715c9e0f8 100644 |
--- a/chrome/browser/ui/sync/one_click_signin_helper.h |
+++ b/chrome/browser/ui/sync/one_click_signin_helper.h |
@@ -50,6 +50,12 @@ class OneClickSigninHelper |
IGNORE_REQUEST |
}; |
+ // Argument to CanOffer(). |
+ enum CanOfferFor { |
+ CAN_OFFER_FOR_ALL, |
+ CAN_OFFER_FOR_INTERSTITAL_ONLY, |
+ }; |
+ |
virtual ~OneClickSigninHelper(); |
// Called only by tests to associate information with a given request. |
@@ -57,14 +63,23 @@ class OneClickSigninHelper |
const std::string& email); |
// Returns true if the one-click signin feature can be offered at this time. |
- // It can be offered if the contents is not in an incognito window. If |
- // |check_connected| is true, then the profile is checked to see if it's |
+ // If |email| is not empty, then the profile is checked to see if it's |
// already connected to a google account or if the user has already rejected |
// one-click sign-in with this email, in which cases a one click signin |
// should not be offered. |
+ // |
+ // If |can_offer_for| is |CAN_OFFER_FOR_INTERSTITAL_ONLY|, then only do the |
+ // checks that would affect the interstitial page. Otherwise, do the checks |
+ // that would affect the interstitial and the explicit sign ins. |
+ // |
+ // Returns in |error_message_id| an explanation as a string resource ID for |
+ // why one-clicked cannot be offered. |error_message_id| is valid only if |
+ // the return value is false. If no explanation is needed, |error_message_id| |
+ // may be null. |
static bool CanOffer(content::WebContents* web_contents, |
+ CanOfferFor can_offer_for, |
const std::string& email, |
- bool check_connected); |
+ int* error_message_id); |
// Returns true if the one-click signin feature can be offered at this time. |
// It can be offered if the io_data is not in an incognito window and if the |
@@ -127,6 +142,11 @@ class OneClickSigninHelper |
int child_id, |
int route_id); |
+ void RedirectToNTP(); |
+ |
+ // Clear all data member of the helper, except for the error. |
+ void CleanTransientState(); |
+ |
// content::WebContentsObserver overrides. |
virtual void DidNavigateAnyFrame( |
const content::LoadCommittedDetails& details, |
@@ -145,6 +165,8 @@ class OneClickSigninHelper |
std::string password_; |
AutoAccept auto_accept_; |
SyncPromoUI::Source source_; |
+ std::string error_message_; |
+ |
scoped_ptr<SigninTracker> signin_tracker_; |
DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); |