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 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h" | 5 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/search/search.h" | 10 #include "chrome/browser/search/search.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 SessionCrashedInfoBarDelegate::~SessionCrashedInfoBarDelegate() { | 50 SessionCrashedInfoBarDelegate::~SessionCrashedInfoBarDelegate() { |
51 // If the info bar wasn't accepted, it was either dismissed or expired. In | 51 // If the info bar wasn't accepted, it was either dismissed or expired. In |
52 // that case, session restore won't happen. | 52 // that case, session restore won't happen. |
53 if (!accepted_) { | 53 if (!accepted_) { |
54 content::BrowserContext::GetDefaultStoragePartition(profile_)-> | 54 content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
55 GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); | 55 GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
| 59 infobars::InfoBarDelegate::InfoBarIdentifier |
| 60 SessionCrashedInfoBarDelegate::GetIdentifier() const { |
| 61 return SESSION_CRASHED_INFOBAR_DELEGATE; |
| 62 } |
| 63 |
59 int SessionCrashedInfoBarDelegate::GetIconId() const { | 64 int SessionCrashedInfoBarDelegate::GetIconId() const { |
60 return IDR_INFOBAR_RESTORE_SESSION; | 65 return IDR_INFOBAR_RESTORE_SESSION; |
61 } | 66 } |
62 | 67 |
63 gfx::VectorIconId SessionCrashedInfoBarDelegate::GetVectorIconId() const { | 68 gfx::VectorIconId SessionCrashedInfoBarDelegate::GetVectorIconId() const { |
64 #if defined(OS_MACOSX) | 69 #if defined(OS_MACOSX) |
65 return gfx::VectorIconId::VECTOR_ICON_NONE; | 70 return gfx::VectorIconId::VECTOR_ICON_NONE; |
66 #else | 71 #else |
67 return gfx::VectorIconId::SAD_TAB; | 72 return gfx::VectorIconId::SAD_TAB; |
68 #endif | 73 #endif |
(...skipping 13 matching lines...) Expand all Loading... |
82 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON); | 87 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON); |
83 } | 88 } |
84 | 89 |
85 bool SessionCrashedInfoBarDelegate::Accept() { | 90 bool SessionCrashedInfoBarDelegate::Accept() { |
86 Browser* browser = chrome::FindBrowserWithWebContents( | 91 Browser* browser = chrome::FindBrowserWithWebContents( |
87 InfoBarService::WebContentsFromInfoBar(infobar())); | 92 InfoBarService::WebContentsFromInfoBar(infobar())); |
88 SessionRestore::RestoreSessionAfterCrash(browser); | 93 SessionRestore::RestoreSessionAfterCrash(browser); |
89 accepted_ = true; | 94 accepted_ = true; |
90 return true; | 95 return true; |
91 } | 96 } |
OLD | NEW |