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