Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: chrome/browser/ui/startup/session_crashed_prompt.cc

Issue 10391158: Moves methods for finding browsers to browser_finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include fixs Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_wrapper.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_list.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"
22 22
23 namespace { 23 namespace {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 string16 SessionCrashedInfoBarDelegate::GetButtonLabel( 70 string16 SessionCrashedInfoBarDelegate::GetButtonLabel(
71 InfoBarButton button) const { 71 InfoBarButton button) const {
72 DCHECK_EQ(BUTTON_OK, button); 72 DCHECK_EQ(BUTTON_OK, button);
73 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON); 73 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON);
74 } 74 }
75 75
76 bool SessionCrashedInfoBarDelegate::Accept() { 76 bool SessionCrashedInfoBarDelegate::Accept() {
77 uint32 behavior = 0; 77 uint32 behavior = 0;
78 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 78 Browser* browser = browser::FindLastActiveWithProfile(profile_);
79 if (browser && browser->tab_count() == 1 79 if (browser && browser->tab_count() == 1
80 && browser->GetWebContentsAt(0)->GetURL() == 80 && browser->GetWebContentsAt(0)->GetURL() ==
81 GURL(chrome::kChromeUINewTabURL)) { 81 GURL(chrome::kChromeUINewTabURL)) {
82 // There is only one tab and its the new tab page, make session restore 82 // There is only one tab and its the new tab page, make session restore
83 // clobber it. 83 // clobber it.
84 behavior = SessionRestore::CLOBBER_CURRENT_TAB; 84 behavior = SessionRestore::CLOBBER_CURRENT_TAB;
85 } 85 }
86 SessionRestore::RestoreSession( 86 SessionRestore::RestoreSession(
87 profile_, browser, behavior, std::vector<GURL>()); 87 profile_, browser, behavior, std::vector<GURL>());
88 return true; 88 return true;
(...skipping 20 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698