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

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

Issue 230453004: Remove InfoBarDelegate::web_contents() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile Created 6 years, 8 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_infobar_delegate.h" 5 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h"
6 6
7 #include "chrome/browser/infobars/infobar.h" 7 #include "chrome/browser/infobars/infobar.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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 base::string16 SessionCrashedInfoBarDelegate::GetButtonLabel( 68 base::string16 SessionCrashedInfoBarDelegate::GetButtonLabel(
69 InfoBarButton button) const { 69 InfoBarButton button) const {
70 DCHECK_EQ(BUTTON_OK, button); 70 DCHECK_EQ(BUTTON_OK, button);
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 uint32 behavior = 0; 75 uint32 behavior = 0;
76 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); 76 content::WebContents* web_contents =
77 InfoBarService::WebContentsFromInfoBar(infobar());
78 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
77 if (browser->tab_strip_model()->count() == 1) { 79 if (browser->tab_strip_model()->count() == 1) {
78 const content::WebContents* active_tab = 80 const content::WebContents* active_tab =
79 browser->tab_strip_model()->GetWebContentsAt(0); 81 browser->tab_strip_model()->GetWebContentsAt(0);
80 if (active_tab->GetURL() == GURL(chrome::kChromeUINewTabURL) || 82 if (active_tab->GetURL() == GURL(chrome::kChromeUINewTabURL) ||
81 chrome::IsInstantNTP(active_tab)) { 83 chrome::IsInstantNTP(active_tab)) {
82 // There is only one tab and its the new tab page, make session restore 84 // There is only one tab and its the new tab page, make session restore
83 // clobber it. 85 // clobber it.
84 behavior = SessionRestore::CLOBBER_CURRENT_TAB; 86 behavior = SessionRestore::CLOBBER_CURRENT_TAB;
85 } 87 }
86 } 88 }
87 SessionRestore::RestoreSession(browser->profile(), browser, 89 SessionRestore::RestoreSession(browser->profile(), browser,
88 browser->host_desktop_type(), behavior, 90 browser->host_desktop_type(), behavior,
89 std::vector<GURL>()); 91 std::vector<GURL>());
90 accepted_ = true; 92 accepted_ = true;
91 return true; 93 return true;
92 } 94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698