diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-26 21:45:34 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-26 21:45:34 +0000 |
commit | 96788b0612875c0d12584757b63f02112e9541a7 (patch) | |
tree | d7eb82156c83b850d2714110dd7d8bb7aad60c41 /chrome/browser/views/first_run_bubble.cc | |
parent | 21ca7bf8f06e3b6e608f26eed8dce30515721b86 (diff) | |
download | chromium_src-96788b0612875c0d12584757b63f02112e9541a7.zip chromium_src-96788b0612875c0d12584757b63f02112e9541a7.tar.gz chromium_src-96788b0612875c0d12584757b63f02112e9541a7.tar.bz2 |
Mac: First run bubble.
Add a BaseBubbleController. Move ContentBlockedBubbleController to use it (other bubbles will follow in later CLs), add FIrstRunBubbleController which uses it.
Move some l10n stuff to l10n_util and use that, too.
Update first run code to actually call the bubble code. Fix a double free while I'm at it (the scoped_ptr<> in DoFirstRun() already does the freeing, no need to do it in FirstRunDone())
BUG=27489,36366
TEST=Firstrun bubble shows up when starting chrome with --first-run, doesn't if starting chrome without that flag. Content blocked bubbles still work.
Review URL: http://codereview.chromium.org/2822026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50940 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/first_run_bubble.cc')
-rw-r--r-- | chrome/browser/views/first_run_bubble.cc | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc index 2c6bcf9..0ebc0c7 100644 --- a/chrome/browser/views/first_run_bubble.cc +++ b/chrome/browser/views/first_run_bubble.cc @@ -8,14 +8,14 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/win_util.h" +#include "base/utf_string_conversions.h" #include "base/win_util.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/first_run.h" #include "chrome/browser/options_window.h" -#include "chrome/browser/profile.h" -#include "chrome/browser/search_engines/template_url_model.h" +#include "chrome/browser/search_engines/util.h" #include "chrome/browser/metrics/user_metrics.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -46,22 +46,6 @@ const int kStringSeparationPadding = 2; // Margin around close button. const int kMarginRightOfCloseButton = 7; -std::wstring GetDefaultSearchEngineName(Profile* profile) { - if (!profile) { - NOTREACHED(); - return std::wstring(); - } - const TemplateURL* const default_provider = - 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 - // http://code.google.com/p/chromium/issues/detail?id=2573 - return std::wstring(); - } - return default_provider->short_name(); -} - } // namespace // Base class for implementations of the client view which appears inside the @@ -133,7 +117,7 @@ FirstRunBubbleView::FirstRunBubbleView(FirstRunBubble* bubble_window, AddChildView(label2_); std::wstring question_str = l10n_util::GetStringF(IDS_FR_BUBBLE_QUESTION, - GetDefaultSearchEngineName(profile)); + UTF16ToWideHack(GetDefaultSearchEngineName(profile))); label3_ = new views::Label(question_str); label3_->SetMultiLine(true); label3_->SetFont(font); @@ -142,7 +126,7 @@ FirstRunBubbleView::FirstRunBubbleView(FirstRunBubble* bubble_window, AddChildView(label3_); std::wstring keep_str = l10n_util::GetStringF(IDS_FR_BUBBLE_OK, - GetDefaultSearchEngineName(profile)); + UTF16ToWideHack(GetDefaultSearchEngineName(profile))); keep_button_ = new views::NativeButton(this, keep_str); keep_button_->SetIsDefault(true); AddChildView(keep_button_); @@ -421,7 +405,7 @@ FirstRunMinimalBubbleView::FirstRunMinimalBubbleView( ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont); label1_ = new views::Label(l10n_util::GetStringF(IDS_FR_SE_BUBBLE_TITLE, - GetDefaultSearchEngineName(profile_))); + UTF16ToWideHack(GetDefaultSearchEngineName(profile_)))); label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD)); label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(label1_); |