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

Unified Diff: ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h

Issue 2587023002: Upstream Chrome on iOS source code [8/11]. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h
diff --git a/ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h b/ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f10bca15d738e6b19520f295e3afb40116d0cdd
--- /dev/null
+++ b/ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h
@@ -0,0 +1,67 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_UI_SYNC_SYNC_ERROR_INFOBAR_DELEGATE_H_
+#define IOS_CHROME_BROWSER_UI_SYNC_SYNC_ERROR_INFOBAR_DELEGATE_H_
+
+#include <memory>
+
+#include "base/mac/scoped_nsobject.h"
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "components/infobars/core/confirm_infobar_delegate.h"
+#include "components/sync/driver/sync_service_observer.h"
+#include "ios/chrome/browser/sync/sync_setup_service.h"
+#include "ui/gfx/image/image.h"
+
+@class GenericChromeCommand;
+
+namespace gfx {
+class Image;
+}
+
+namespace infobars {
+class InfoBarManager;
+}
+
+namespace ios {
+class ChromeBrowserState;
+}
+
+// Shows a sync error in an infobar.
+class SyncErrorInfoBarDelegate : public ConfirmInfoBarDelegate,
+ public syncer::SyncServiceObserver {
+ public:
+ explicit SyncErrorInfoBarDelegate(ios::ChromeBrowserState* browser_state);
+ ~SyncErrorInfoBarDelegate() override;
+
+ // Creates a sync error infobar and adds it to |infobar_manager|.
+ static bool Create(infobars::InfoBarManager* infobar_manager,
+ ios::ChromeBrowserState* browser_state);
+
+ // InfoBarDelegate implementation.
+ InfoBarIdentifier GetIdentifier() const override;
+
+ // ConfirmInfoBarDelegate implementation.
+ base::string16 GetMessageText() const override;
+ int GetButtons() const override;
+ base::string16 GetButtonLabel(InfoBarButton button) const override;
+ gfx::Image GetIcon() const override;
+ bool Accept() override;
+
+ // ProfileSyncServiceObserver implementation.
+ void OnStateChanged() override;
+
+ private:
+ gfx::Image icon_;
+ ios::ChromeBrowserState* browser_state_;
+ SyncSetupService::SyncServiceState error_state_;
+ base::string16 message_;
+ base::string16 button_text_;
+ base::scoped_nsobject<GenericChromeCommand> command_;
+
+ DISALLOW_COPY_AND_ASSIGN(SyncErrorInfoBarDelegate);
+};
+
+#endif // IOS_CHROME_BROWSER_UI_SYNC_SYNC_ERROR_INFOBAR_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698