| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 8 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 11 #include "content/public/browser/notification_observer.h" | |
| 12 #include "content/public/browser/notification_registrar.h" | |
| 13 | 9 |
| 14 class Browser; | 10 class Browser; |
| 15 class Profile; | 11 class Profile; |
| 16 | 12 |
| 17 // A delegate for the InfoBar shown when the previous session has crashed. | 13 // A delegate for the InfoBar shown when the previous session has crashed. |
| 18 class SessionCrashedInfoBarDelegate : public ConfirmInfoBarDelegate, | 14 class SessionCrashedInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 19 public content::NotificationObserver { | |
| 20 public: | 15 public: |
| 21 // If |browser| is not incognito, creates a session crashed infobar delegate | 16 // If |browser| is not incognito, creates a session crashed infobar and |
| 22 // and adds it to the InfoBarService for |browser|. | 17 // delegate and adds the infobar to the InfoBarService for |browser|. |
| 23 static void Create(Browser* browser); | 18 static void Create(Browser* browser); |
| 24 | 19 |
| 25 private: | 20 private: |
| 26 FRIEND_TEST_ALL_PREFIXES(SessionCrashedInfoBarDelegateUnitTest, | 21 explicit SessionCrashedInfoBarDelegate(Profile* profile); |
| 27 DetachingTabWithCrashedInfoBar); | |
| 28 #if defined(UNIT_TEST) | |
| 29 friend struct base::DefaultDeleter<SessionCrashedInfoBarDelegate>; | |
| 30 #endif | |
| 31 | |
| 32 SessionCrashedInfoBarDelegate(InfoBarService* infobar_service, | |
| 33 Profile* profile); | |
| 34 virtual ~SessionCrashedInfoBarDelegate(); | 22 virtual ~SessionCrashedInfoBarDelegate(); |
| 35 | 23 |
| 36 // ConfirmInfoBarDelegate: | 24 // ConfirmInfoBarDelegate: |
| 37 virtual int GetIconID() const OVERRIDE; | 25 virtual int GetIconID() const OVERRIDE; |
| 38 virtual string16 GetMessageText() const OVERRIDE; | 26 virtual string16 GetMessageText() const OVERRIDE; |
| 39 virtual int GetButtons() const OVERRIDE; | 27 virtual int GetButtons() const OVERRIDE; |
| 40 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 28 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 41 virtual bool Accept() OVERRIDE; | 29 virtual bool Accept() OVERRIDE; |
| 42 | 30 |
| 43 // content::NotificationObserver: | |
| 44 virtual void Observe(int type, | |
| 45 const content::NotificationSource& source, | |
| 46 const content::NotificationDetails& details) OVERRIDE; | |
| 47 | |
| 48 content::NotificationRegistrar registrar_; | |
| 49 bool accepted_; | 31 bool accepted_; |
| 50 bool removed_notification_received_; | |
| 51 Profile* profile_; | 32 Profile* profile_; |
| 52 | 33 |
| 53 DISALLOW_COPY_AND_ASSIGN(SessionCrashedInfoBarDelegate); | 34 DISALLOW_COPY_AND_ASSIGN(SessionCrashedInfoBarDelegate); |
| 54 }; | 35 }; |
| 55 | 36 |
| 56 #endif // CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_INFOBAR_DELEGATE_H_ | 37 #endif // CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_INFOBAR_DELEGATE_H_ |
| OLD | NEW |