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

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

Issue 812823002: Remove dependency of infobars component on the embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on Android Created 6 years 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
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_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 15 matching lines...) Expand all
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.
30 Profile* profile = browser->profile(); 30 Profile* profile = browser->profile();
31 content::WebContents* web_contents = 31 content::WebContents* web_contents =
32 browser->tab_strip_model()->GetActiveWebContents(); 32 browser->tab_strip_model()->GetActiveWebContents();
33 if (profile->IsOffTheRecord() || !web_contents) 33 if (profile->IsOffTheRecord() || !web_contents)
34 return; 34 return;
35 35
36 InfoBarService::FromWebContents(web_contents)->AddInfoBar( 36 InfoBarService* infobar_service =
37 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 37 InfoBarService::FromWebContents(web_contents);
38 infobar_service->AddInfoBar(
39 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
38 new SessionCrashedInfoBarDelegate(profile)))); 40 new SessionCrashedInfoBarDelegate(profile))));
39 } 41 }
40 42
41 SessionCrashedInfoBarDelegate::SessionCrashedInfoBarDelegate(Profile* profile) 43 SessionCrashedInfoBarDelegate::SessionCrashedInfoBarDelegate(Profile* profile)
42 : ConfirmInfoBarDelegate(), 44 : ConfirmInfoBarDelegate(),
43 accepted_(false), 45 accepted_(false),
44 profile_(profile) { 46 profile_(profile) {
45 } 47 }
46 48
47 SessionCrashedInfoBarDelegate::~SessionCrashedInfoBarDelegate() { 49 SessionCrashedInfoBarDelegate::~SessionCrashedInfoBarDelegate() {
(...skipping 23 matching lines...) Expand all
71 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON); 73 return l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_VIEW_RESTORE_BUTTON);
72 } 74 }
73 75
74 bool SessionCrashedInfoBarDelegate::Accept() { 76 bool SessionCrashedInfoBarDelegate::Accept() {
75 Browser* browser = chrome::FindBrowserWithWebContents( 77 Browser* browser = chrome::FindBrowserWithWebContents(
76 InfoBarService::WebContentsFromInfoBar(infobar())); 78 InfoBarService::WebContentsFromInfoBar(infobar()));
77 SessionRestore::RestoreSessionAfterCrash(browser); 79 SessionRestore::RestoreSessionAfterCrash(browser);
78 accepted_ = true; 80 accepted_ = true;
79 return true; 81 return true;
80 } 82 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/obsolete_system_infobar_delegate.cc ('k') | chrome/browser/ui/views/infobars/confirm_infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698