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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_INFOBAR_DELEGATE_H_
8 #include "base/gtest_prod_util.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
17 // A delegate for the InfoBar shown when the previous session has crashed.
18 class SessionCrashedInfoBarDelegate
: public ConfirmInfoBarDelegate
,
19 public content::NotificationObserver
{
21 // If |browser| is not incognito, creates a session crashed infobar delegate
22 // and adds it to the InfoBarService for |browser|.
23 static void Create(Browser
* browser
);
26 FRIEND_TEST_ALL_PREFIXES(SessionCrashedInfoBarDelegateUnitTest
,
27 DetachingTabWithCrashedInfoBar
);
28 #if defined(UNIT_TEST)
29 friend struct base::DefaultDeleter
<SessionCrashedInfoBarDelegate
>;
32 SessionCrashedInfoBarDelegate(InfoBarService
* infobar_service
,
34 virtual ~SessionCrashedInfoBarDelegate();
36 // ConfirmInfoBarDelegate:
37 virtual int GetIconID() const OVERRIDE
;
38 virtual string16
GetMessageText() const OVERRIDE
;
39 virtual int GetButtons() const OVERRIDE
;
40 virtual string16
GetButtonLabel(InfoBarButton button
) const OVERRIDE
;
41 virtual bool Accept() OVERRIDE
;
43 // content::NotificationObserver:
44 virtual void Observe(int type
,
45 const content::NotificationSource
& source
,
46 const content::NotificationDetails
& details
) OVERRIDE
;
48 content::NotificationRegistrar registrar_
;
50 bool removed_notification_received_
;
53 DISALLOW_COPY_AND_ASSIGN(SessionCrashedInfoBarDelegate
);
56 #endif // CHROME_BROWSER_UI_STARTUP_SESSION_CRASHED_INFOBAR_DELEGATE_H_