summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/sync
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-03 01:36:22 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-03 01:36:22 +0000
commit49c71ac612c2ef64bea0adbbc20ec7c4199f87a8 (patch)
tree482a0f2ca1b2129df67211749abf50e00b39a72e /chrome/browser/ui/sync
parent66d20c69fff1fa17d481f8a21cfe7772cb7cf4a7 (diff)
downloadchromium_src-49c71ac612c2ef64bea0adbbc20ec7c4199f87a8.zip
chromium_src-49c71ac612c2ef64bea0adbbc20ec7c4199f87a8.tar.gz
chromium_src-49c71ac612c2ef64bea0adbbc20ec7c4199f87a8.tar.bz2
Formatting cleanup. Should be no code change.
* Don't define complex functions inline * Use DISALLOW_COPY_AND_ASSIGN where appropriate * Make consistent the headers on sections of a class declaration or .cc file * Use two newlines between major sections of a .cc file BUG=none TEST=none R=sky@chromium.org Review URL: https://codereview.chromium.org/14619002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198027 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/sync')
-rw-r--r--chrome/browser/ui/sync/one_click_signin_helper.cc110
1 files changed, 69 insertions, 41 deletions
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc
index fe4f5b2..37e589f 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc
@@ -77,6 +77,8 @@
namespace {
+// StartSyncArgs --------------------------------------------------------------
+
// Arguments used with StartSync function. base::Bind() cannot support too
// many args for performance reasons, so they are packaged up into a struct.
struct StartSyncArgs {
@@ -86,15 +88,7 @@ struct StartSyncArgs {
const std::string& session_index,
const std::string& email,
const std::string& password,
- bool force_same_tab_navigation)
- : profile(profile),
- browser(browser),
- auto_accept(auto_accept),
- session_index(session_index),
- email(email),
- password(password),
- force_same_tab_navigation(force_same_tab_navigation) {
- }
+ bool force_same_tab_navigation);
Profile* profile;
Browser* browser;
@@ -105,6 +99,25 @@ struct StartSyncArgs {
bool force_same_tab_navigation;
};
+StartSyncArgs::StartSyncArgs(Profile* profile,
+ Browser* browser,
+ OneClickSigninHelper::AutoAccept auto_accept,
+ const std::string& session_index,
+ const std::string& email,
+ const std::string& password,
+ bool force_same_tab_navigation)
+ : profile(profile),
+ browser(browser),
+ auto_accept(auto_accept),
+ session_index(session_index),
+ email(email),
+ password(password),
+ force_same_tab_navigation(force_same_tab_navigation) {
+}
+
+
+// Helpers --------------------------------------------------------------------
+
// Add a specific email to the list of emails rejected for one-click
// sign-in, for this profile.
void AddEmailToOneClickRejectedList(Profile* profile,
@@ -302,6 +315,9 @@ bool AreWeShowingSignin(GURL url, SyncPromoUI::Source source,
!email.empty());
}
+
+// ConfirmEmailDialogDelegate -------------------------------------------------
+
class ConfirmEmailDialogDelegate : public TabModalConfirmDialogDelegate {
public:
// Callback indicating action performed by the user. The argument to the
@@ -320,38 +336,13 @@ class ConfirmEmailDialogDelegate : public TabModalConfirmDialogDelegate {
const std::string& email,
Callback callback);
- // TabModalConfirmDialogDelegate implementation:
- virtual string16 GetTitle() OVERRIDE {
- return l10n_util::GetStringUTF16(
- IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_TITLE);
- }
-
- virtual string16 GetMessage() OVERRIDE {
- return l10n_util::GetStringFUTF16(
- IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_MESSAGE,
- UTF8ToUTF16(last_email_),
- UTF8ToUTF16(email_));
- }
-
- virtual string16 GetAcceptButtonTitle() OVERRIDE {
- return l10n_util::GetStringUTF16(
- IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_OK_BUTTON);
- }
-
- virtual string16 GetCancelButtonTitle() OVERRIDE {
- return l10n_util::GetStringUTF16(
- IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_CANCEL_BUTTON);
- }
-
- virtual void OnAccepted() OVERRIDE {
- base::ResetAndReturn(&callback_).Run(
- IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_OK_BUTTON);
- }
-
- virtual void OnCanceled() OVERRIDE {
- base::ResetAndReturn(&callback_).Run(
- IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_CANCEL_BUTTON);
- }
+ // TabModalConfirmDialogDelegate:
+ virtual string16 GetTitle() OVERRIDE;
+ virtual string16 GetMessage() OVERRIDE;
+ virtual string16 GetAcceptButtonTitle() OVERRIDE;
+ virtual string16 GetCancelButtonTitle() OVERRIDE;
+ virtual void OnAccepted() OVERRIDE;
+ virtual void OnCanceled() OVERRIDE;
std::string last_email_;
std::string email_;
@@ -382,6 +373,40 @@ ConfirmEmailDialogDelegate::ConfirmEmailDialogDelegate(
callback_(callback) {
}
+string16 ConfirmEmailDialogDelegate::GetTitle() {
+ return l10n_util::GetStringUTF16(
+ IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_TITLE);
+}
+
+string16 ConfirmEmailDialogDelegate::GetMessage() {
+ return l10n_util::GetStringFUTF16(
+ IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_MESSAGE,
+ UTF8ToUTF16(last_email_),
+ UTF8ToUTF16(email_));
+}
+
+string16 ConfirmEmailDialogDelegate::GetAcceptButtonTitle() {
+ return l10n_util::GetStringUTF16(
+ IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_OK_BUTTON);
+}
+
+string16 ConfirmEmailDialogDelegate::GetCancelButtonTitle() {
+ return l10n_util::GetStringUTF16(
+ IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_CANCEL_BUTTON);
+}
+
+void ConfirmEmailDialogDelegate::OnAccepted() {
+ base::ResetAndReturn(&callback_).Run(
+ IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_OK_BUTTON);
+}
+
+void ConfirmEmailDialogDelegate::OnCanceled() {
+ base::ResetAndReturn(&callback_).Run(
+ IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_CANCEL_BUTTON);
+}
+
+
+// CurrentHistoryCleaner ------------------------------------------------------
// Watch a webcontents and remove URL from the history once loading is complete.
// We have to delay the cleaning until the new URL has finished loading because
@@ -425,6 +450,9 @@ void CurrentHistoryCleaner::WebContentsDestroyed(
} // namespace
+
+// OneClickSigninHelper -------------------------------------------------------
+
// static
const int OneClickSigninHelper::kMaxNavigationsSince = 10;