OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_SYNC_SYNC_ERROR_INFOBAR_DELEGATE_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_SYNC_SYNC_ERROR_INFOBAR_DELEGATE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/mac/scoped_nsobject.h" |
| 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" |
| 13 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 14 #include "components/sync/driver/sync_service_observer.h" |
| 15 #include "ios/chrome/browser/sync/sync_setup_service.h" |
| 16 #include "ui/gfx/image/image.h" |
| 17 |
| 18 @class GenericChromeCommand; |
| 19 |
| 20 namespace gfx { |
| 21 class Image; |
| 22 } |
| 23 |
| 24 namespace infobars { |
| 25 class InfoBarManager; |
| 26 } |
| 27 |
| 28 namespace ios { |
| 29 class ChromeBrowserState; |
| 30 } |
| 31 |
| 32 // Shows a sync error in an infobar. |
| 33 class SyncErrorInfoBarDelegate : public ConfirmInfoBarDelegate, |
| 34 public syncer::SyncServiceObserver { |
| 35 public: |
| 36 explicit SyncErrorInfoBarDelegate(ios::ChromeBrowserState* browser_state); |
| 37 ~SyncErrorInfoBarDelegate() override; |
| 38 |
| 39 // Creates a sync error infobar and adds it to |infobar_manager|. |
| 40 static bool Create(infobars::InfoBarManager* infobar_manager, |
| 41 ios::ChromeBrowserState* browser_state); |
| 42 |
| 43 // InfoBarDelegate implementation. |
| 44 InfoBarIdentifier GetIdentifier() const override; |
| 45 |
| 46 // ConfirmInfoBarDelegate implementation. |
| 47 base::string16 GetMessageText() const override; |
| 48 int GetButtons() const override; |
| 49 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 50 gfx::Image GetIcon() const override; |
| 51 bool Accept() override; |
| 52 |
| 53 // ProfileSyncServiceObserver implementation. |
| 54 void OnStateChanged() override; |
| 55 |
| 56 private: |
| 57 gfx::Image icon_; |
| 58 ios::ChromeBrowserState* browser_state_; |
| 59 SyncSetupService::SyncServiceState error_state_; |
| 60 base::string16 message_; |
| 61 base::string16 button_text_; |
| 62 base::scoped_nsobject<GenericChromeCommand> command_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(SyncErrorInfoBarDelegate); |
| 65 }; |
| 66 |
| 67 #endif // IOS_CHROME_BROWSER_UI_SYNC_SYNC_ERROR_INFOBAR_DELEGATE_H_ |
OLD | NEW |