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_PROMPT_H_ | 5 #ifndef CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_PROMPT_H_ |
6 #define CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_PROMPT_H_ | 6 #define CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_PROMPT_H_ |
7 | 7 |
| 8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 9 #include "content/public/browser/notification_observer.h" |
| 10 #include "content/public/browser/notification_registrar.h" |
| 11 |
8 class Browser; | 12 class Browser; |
9 | 13 |
10 namespace chrome { | 14 // A delegate for the InfoBar shown when the previous session has crashed. |
| 15 class SessionCrashedInfoBarDelegate : public ConfirmInfoBarDelegate, |
| 16 public content::NotificationObserver { |
| 17 public: |
| 18 // If |browser| is not incognito, creates a session crashed delegate and adds |
| 19 // it to the InfoBarService for |browser|. |
| 20 static void Create(Browser* browser); |
11 | 21 |
12 // Shows the session crashed prompt for |browser| if required. | 22 private: |
13 void ShowSessionCrashedPrompt(Browser* browser); | 23 SessionCrashedInfoBarDelegate(InfoBarService* infobar_service, |
| 24 Browser* browser); |
| 25 virtual ~SessionCrashedInfoBarDelegate(); |
14 | 26 |
15 } // namespace chrome | 27 // ConfirmInfoBarDelegate: |
| 28 virtual gfx::Image* GetIcon() const OVERRIDE; |
| 29 virtual string16 GetMessageText() const OVERRIDE; |
| 30 virtual int GetButtons() const OVERRIDE; |
| 31 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 32 virtual bool Accept() OVERRIDE; |
| 33 |
| 34 // content::NotificationObserver: |
| 35 virtual void Observe(int type, |
| 36 const content::NotificationSource& source, |
| 37 const content::NotificationDetails& details) OVERRIDE; |
| 38 |
| 39 content::NotificationRegistrar registrar_; |
| 40 bool accepted_; |
| 41 bool removed_notification_received_; |
| 42 Browser* browser_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(SessionCrashedInfoBarDelegate); |
| 45 }; |
16 | 46 |
17 #endif // CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_PROMPT_H_ | 47 #endif // CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_PROMPT_H_ |
OLD | NEW |