| 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" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
| 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "chrome/grit/chromium_strings.h" |
| 16 #include "chrome/grit/generated_resources.h" |
| 15 #include "components/infobars/core/infobar.h" | 17 #include "components/infobars/core/infobar.h" |
| 16 #include "content/public/browser/dom_storage_context.h" | 18 #include "content/public/browser/dom_storage_context.h" |
| 17 #include "content/public/browser/storage_partition.h" | 19 #include "content/public/browser/storage_partition.h" |
| 18 #include "grit/chromium_strings.h" | |
| 19 #include "grit/generated_resources.h" | |
| 20 #include "grit/theme_resources.h" | 20 #include "grit/theme_resources.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 22 | 22 |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 void SessionCrashedInfoBarDelegate::Create(Browser* browser) { | 25 void SessionCrashedInfoBarDelegate::Create(Browser* browser) { |
| 26 // Assume that if the user is launching incognito they were previously running | 26 // Assume that if the user is launching incognito they were previously running |
| 27 // incognito so that we have nothing to restore from. | 27 // incognito so that we have nothing to restore from. |
| 28 // Also, in ChromeBot tests, there might be a race. This code appears to be | 28 // Also, in ChromeBot tests, there might be a race. This code appears to be |
| 29 // called during shutdown when there is no active WebContents. | 29 // called during shutdown when there is no active WebContents. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON); | 71 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool SessionCrashedInfoBarDelegate::Accept() { | 74 bool SessionCrashedInfoBarDelegate::Accept() { |
| 75 Browser* browser = chrome::FindBrowserWithWebContents( | 75 Browser* browser = chrome::FindBrowserWithWebContents( |
| 76 InfoBarService::WebContentsFromInfoBar(infobar())); | 76 InfoBarService::WebContentsFromInfoBar(infobar())); |
| 77 SessionRestore::RestoreSessionAfterCrash(browser); | 77 SessionRestore::RestoreSessionAfterCrash(browser); |
| 78 accepted_ = true; | 78 accepted_ = true; |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| OLD | NEW |