| 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_prompt.h" | 5 #include "chrome/browser/ui/startup/session_crashed_prompt.h" |
| 6 | 6 |
| 7 #include "chrome/browser/infobars/infobar_tab_helper.h" | 7 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/sessions/session_restore.h" | 9 #include "chrome/browser/sessions/session_restore.h" |
| 10 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 10 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
| 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "grit/chromium_strings.h" | 16 #include "grit/chromium_strings.h" |
| 17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "grit/theme_resources_standard.h" | 19 #include "grit/theme_resources_standard.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 namespace browser { | 94 namespace browser { |
| 95 | 95 |
| 96 void ShowSessionCrashedPrompt(Browser* browser) { | 96 void ShowSessionCrashedPrompt(Browser* browser) { |
| 97 // Assume that if the user is launching incognito they were previously | 97 // Assume that if the user is launching incognito they were previously |
| 98 // running incognito so that we have nothing to restore from. | 98 // running incognito so that we have nothing to restore from. |
| 99 if (browser->profile()->IsOffTheRecord()) | 99 if (browser->profile()->IsOffTheRecord()) |
| 100 return; | 100 return; |
| 101 | 101 |
| 102 // In ChromeBot tests, there might be a race. This line appears to get | 102 // In ChromeBot tests, there might be a race. This line appears to get |
| 103 // called during shutdown and |tab| can be NULL. | 103 // called during shutdown and |tab| can be NULL. |
| 104 TabContentsWrapper* tab = browser->GetSelectedTabContentsWrapper(); | 104 TabContents* tab = browser->GetActiveTabContents(); |
| 105 if (!tab) | 105 if (!tab) |
| 106 return; | 106 return; |
| 107 | 107 |
| 108 // Don't show the info-bar if there are already info-bars showing. | 108 // Don't show the info-bar if there are already info-bars showing. |
| 109 if (tab->infobar_tab_helper()->infobar_count() > 0) | 109 if (tab->infobar_tab_helper()->infobar_count() > 0) |
| 110 return; | 110 return; |
| 111 | 111 |
| 112 tab->infobar_tab_helper()->AddInfoBar( | 112 tab->infobar_tab_helper()->AddInfoBar( |
| 113 new SessionCrashedInfoBarDelegate(browser->profile(), | 113 new SessionCrashedInfoBarDelegate(browser->profile(), |
| 114 tab->infobar_tab_helper())); | 114 tab->infobar_tab_helper())); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace browser | 117 } // namespace browser |
| 118 | 118 |
| OLD | NEW |