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

Unified Diff: chrome/browser/views/first_run_bubble.cc

Issue 20381: Fix crasher in GetDefaultSearchEngineName() in first run bubble.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/first_run_bubble.h ('k') | chrome/browser/views/location_bar_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/first_run_bubble.cc
===================================================================
--- chrome/browser/views/first_run_bubble.cc (revision 9891)
+++ chrome/browser/views/first_run_bubble.cc (working copy)
@@ -29,11 +29,13 @@
// infobubble provides.
static const int kBubblePadding = 4;
-std::wstring GetDefaultSearchEngineName() {
- Browser* browser = BrowserList::GetLastActive();
- DCHECK(browser);
+std::wstring GetDefaultSearchEngineName(Profile* profile) {
+ if (!profile) {
+ NOTREACHED();
+ return std::wstring();
+ }
const TemplateURL* const default_provider =
- browser->profile()->GetTemplateURLModel()->GetDefaultSearchProvider();
+ profile->GetTemplateURLModel()->GetDefaultSearchProvider();
if (!default_provider) {
// TODO(cpu): bug 1187517. It is possible to have no default provider.
// returning an empty string is a stopgap measure for the crash
@@ -50,7 +52,7 @@
class FirstRunBubbleView : public views::View,
public views::NativeButton::Listener {
public:
- explicit FirstRunBubbleView(FirstRunBubble* bubble_window)
+ FirstRunBubbleView(FirstRunBubble* bubble_window, Profile* profile)
: bubble_window_(bubble_window),
label1_(NULL),
label2_(NULL),
@@ -76,7 +78,7 @@
std::wstring question_str
= l10n_util::GetStringF(IDS_FR_BUBBLE_QUESTION,
- GetDefaultSearchEngineName());
+ GetDefaultSearchEngineName(profile));
label3_ = new views::Label(question_str);
label3_->SetMultiLine(true);
label3_->SetFont(font);
@@ -84,8 +86,9 @@
label3_->SizeToFit(ps.width() - kBubblePadding * 2);
AddChildView(label3_);
- std::wstring keep_str = l10n_util::GetStringF(IDS_FR_BUBBLE_OK,
- GetDefaultSearchEngineName());
+ std::wstring keep_str =
+ l10n_util::GetStringF(IDS_FR_BUBBLE_OK,
+ GetDefaultSearchEngineName(profile));
keep_button_ = new views::NativeButton(keep_str, true);
keep_button_->SetListener(this);
AddChildView(keep_button_);
@@ -203,10 +206,10 @@
enable_window_method_factory_.RevokeAll();
}
-FirstRunBubble* FirstRunBubble::Show(HWND parent_hwnd,
+FirstRunBubble* FirstRunBubble::Show(Profile* profile, HWND parent_hwnd,
const gfx::Rect& position_relative_to) {
FirstRunBubble* window = new FirstRunBubble();
- views::View* view = new FirstRunBubbleView(window);
+ views::View* view = new FirstRunBubbleView(window, profile);
window->SetDelegate(window);
window->Init(parent_hwnd, position_relative_to, view);
window->ShowWindow(SW_SHOW);
« no previous file with comments | « chrome/browser/views/first_run_bubble.h ('k') | chrome/browser/views/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698