diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-04 00:48:42 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-04 00:48:42 +0000 |
commit | 53b41f0e7522dcccee24886e2661d0cfaf1b2d6c (patch) | |
tree | 23b036c3b5ea10c5156b18e1203031e9ee1eddd7 /chrome/browser/views | |
parent | d5ddf9a35100011523c9a83f5091fcb2160801b4 (diff) | |
download | chromium_src-53b41f0e7522dcccee24886e2661d0cfaf1b2d6c.zip chromium_src-53b41f0e7522dcccee24886e2661d0cfaf1b2d6c.tar.gz chromium_src-53b41f0e7522dcccee24886e2661d0cfaf1b2d6c.tar.bz2 |
Win: Grey out/remove default browser choices in side by side installs.
BUG=37125
TEST=run mini_installer.exe --chrome-sxs, should display message about being a secondary install instead of having a default browser checkbox. In SxS options it should display the same message and have the default browser button greyed out. Uninstall of SxS should not show default browser setting.
Review URL: http://codereview.chromium.org/661440
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40583 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/first_run_customize_view.cc | 6 | ||||
-rw-r--r-- | chrome/browser/views/first_run_view.cc | 8 | ||||
-rw-r--r-- | chrome/browser/views/first_run_view_base.cc | 38 | ||||
-rw-r--r-- | chrome/browser/views/first_run_view_base.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/options/general_page_view.cc | 15 | ||||
-rw-r--r-- | chrome/browser/views/options/general_page_view.h | 4 | ||||
-rw-r--r-- | chrome/browser/views/uninstall_view.cc | 5 |
7 files changed, 61 insertions, 17 deletions
diff --git a/chrome/browser/views/first_run_customize_view.cc b/chrome/browser/views/first_run_customize_view.cc index abc6f93..d2886ad 100644 --- a/chrome/browser/views/first_run_customize_view.cc +++ b/chrome/browser/views/first_run_customize_view.cc @@ -10,6 +10,7 @@ #include "chrome/browser/importer/importer.h" #include "chrome/browser/first_run.h" #include "chrome/browser/metrics/user_metrics.h" +#include "chrome/installer/util/browser_distribution.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -45,7 +46,8 @@ FirstRunCustomizeView::FirstRunCustomizeView(Profile* profile, // the customize view, so that the user selection isn't lost when you uncheck // and then open the Customize dialog. Therefore, we propagate the selection // status of the default browser here. - default_browser_->SetChecked(default_browser_checked); + if (default_browser_) + default_browser_->SetChecked(default_browser_checked); } FirstRunCustomizeView::~FirstRunCustomizeView() { @@ -209,7 +211,7 @@ bool FirstRunCustomizeView::Accept() { importer_host_->GetSourceProfileInfoAt(browser_selected).browser_type, GetImportItems(), window()->GetNativeWindow()); } - if (default_browser_->checked()) + if (default_browser_ && default_browser_->checked()) SetDefaultBrowser(); if (customize_observer_) diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc index 79c6fdd..8a0ffe9 100644 --- a/chrome/browser/views/first_run_view.cc +++ b/chrome/browser/views/first_run_view.cc @@ -11,6 +11,7 @@ #include "chrome/browser/first_run.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/views/first_run_customize_view.h" +#include "chrome/installer/util/browser_distribution.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -55,7 +56,8 @@ void FirstRunView::SetupControls() { using views::Label; using views::Link; - default_browser_->SetChecked(true); + if (default_browser_) + default_browser_->SetChecked(true); welcome_label_ = new Label(l10n_util::GetString(IDS_FIRSTRUN_DLG_TEXT)); welcome_label_->SetColor(SK_ColorBLACK); @@ -156,7 +158,7 @@ void FirstRunView::OpenCustomizeDialog() { new FirstRunCustomizeView(profile_, importer_host_, this, - default_browser_->checked(), + default_browser_ && default_browser_->checked(), homepage_defined_, import_items_, dont_import_items_))->Show(); @@ -189,7 +191,7 @@ bool FirstRunView::Accept() { importer_host_->GetSourceProfileInfoAt(0).browser_type, GetImportItems(), window()->GetNativeWindow()); UserMetrics::RecordAction("FirstRunDef_Accept", profile_); - if (default_browser_->checked()) + if (default_browser_ && default_browser_->checked()) SetDefaultBrowser(); accepted_ = true; diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc index 75aeb88..88e2b9d 100644 --- a/chrome/browser/views/first_run_view_base.cc +++ b/chrome/browser/views/first_run_view_base.cc @@ -17,6 +17,7 @@ #include "chrome/browser/shell_integration.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "chrome/installer/util/browser_distribution.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -36,6 +37,7 @@ FirstRunViewBase::FirstRunViewBase(Profile* profile, bool homepage_defined, background_image_(NULL), separator_1_(NULL), default_browser_(NULL), + non_default_browser_label_(NULL), separator_2_(NULL), importer_host_(NULL), profile_(profile), @@ -88,11 +90,21 @@ void FirstRunViewBase::SetupControls() { separator_1_ = new views::Separator; AddChildView(separator_1_); - // The "make us default browser" check box. - default_browser_ = new views::Checkbox( - l10n_util::GetString(IDS_FR_CUSTOMIZE_DEFAULT_BROWSER)); - default_browser_->SetMultiLine(true); - AddChildView(default_browser_); + if (BrowserDistribution::GetDistribution()->CanSetAsDefault()) { + // The "make us default browser" check box. + default_browser_ = new views::Checkbox( + l10n_util::GetString(IDS_FR_CUSTOMIZE_DEFAULT_BROWSER)); + default_browser_->SetMultiLine(true); + AddChildView(default_browser_); + } else { + non_default_browser_label_ = new Label( + l10n_util::GetStringF(IDS_OPTIONS_DEFAULTBROWSER_SXS, + l10n_util::GetString(IDS_PRODUCT_NAME))); + non_default_browser_label_->SetMultiLine(true); + non_default_browser_label_->SetHorizontalAlignment( + views::Label::ALIGN_LEFT); + AddChildView(non_default_browser_label_); + } // The second separator marks the start of buttons. separator_2_ = new views::Separator; @@ -134,9 +146,16 @@ void FirstRunViewBase::Layout() { next_v_space = separator_2_->y() + separator_2_->height() + kVertSpacing; int width = canvas.width() - 2 * kPanelHorizMargin; - int height = default_browser_->GetHeightForWidth(width); - default_browser_->SetBounds(kPanelHorizMargin, next_v_space, width, height); - AdjustDialogWidth(default_browser_); + if (default_browser_) { + int height = default_browser_->GetHeightForWidth(width); + default_browser_->SetBounds(kPanelHorizMargin, next_v_space, width, height); + AdjustDialogWidth(default_browser_); + } else { + int height = non_default_browser_label_->GetHeightForWidth(width); + non_default_browser_label_->SetBounds(kPanelHorizMargin, next_v_space, + width, height); + AdjustDialogWidth(non_default_browser_label_); + } } bool FirstRunViewBase::CanResize() const { @@ -186,7 +205,8 @@ void FirstRunViewBase::DisableButtons() { views::DialogClientView* dcv = GetDialogClientView(); dcv->ok_button()->SetEnabled(false); dcv->cancel_button()->SetEnabled(false); - default_browser_->SetEnabled(false); + if (default_browser_) + default_browser_->SetEnabled(false); } bool FirstRunViewBase::CreateDesktopShortcut() { diff --git a/chrome/browser/views/first_run_view_base.h b/chrome/browser/views/first_run_view_base.h index 5879cccb..b0d53d4 100644 --- a/chrome/browser/views/first_run_view_base.h +++ b/chrome/browser/views/first_run_view_base.h @@ -11,6 +11,7 @@ namespace views { class Checkbox; +class Label; class Window; class ImageView; class Separator; @@ -81,6 +82,7 @@ class FirstRunViewBase : public views::View, scoped_refptr<ImporterHost> importer_host_; Profile* profile_; views::Checkbox* default_browser_; + views::Label* non_default_browser_label_; protected: bool homepage_defined_; diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index 317f596..e9c9e01 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -28,6 +28,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "chrome/installer/util/browser_distribution.h" #include "grit/app_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -671,6 +672,15 @@ void GeneralPageView::SetDefaultBrowserUIState( } } +void GeneralPageView::SetDefaultBrowserUIStateForSxS() { + default_browser_use_as_default_button_->SetEnabled(false); + default_browser_status_label_->SetText( + l10n_util::GetStringF(IDS_OPTIONS_DEFAULTBROWSER_SXS, + l10n_util::GetString(IDS_PRODUCT_NAME))); + default_browser_status_label_->SetColor(kNotDefaultBrowserLabelColor); + Layout(); +} + void GeneralPageView::InitStartupGroup() { startup_homepage_radio_ = new views::RadioButton( l10n_util::GetString(IDS_OPTIONS_STARTUP_SHOW_DEFAULT_AND_NEWTAB), @@ -882,7 +892,10 @@ void GeneralPageView::InitDefaultBrowserGroup() { contents, l10n_util::GetString(IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME), std::wstring(), false); - default_browser_worker_->StartCheckDefaultBrowser(); + if (BrowserDistribution::GetDistribution()->CanSetAsDefault()) + default_browser_worker_->StartCheckDefaultBrowser(); + else + SetDefaultBrowserUIStateForSxS(); } void GeneralPageView::SaveStartupPref() { diff --git a/chrome/browser/views/options/general_page_view.h b/chrome/browser/views/options/general_page_view.h index dae9fa5..32372b4 100644 --- a/chrome/browser/views/options/general_page_view.h +++ b/chrome/browser/views/options/general_page_view.h @@ -71,6 +71,10 @@ class GeneralPageView : public OptionsPageView, virtual void SetDefaultBrowserUIState( ShellIntegration::DefaultBrowserUIState state); + // For Side by Side installs, this will disable the Default Browser setting + // and display an explanitory message. + void SetDefaultBrowserUIStateForSxS(); + // Init all the dialog controls void InitStartupGroup(); void InitHomepageGroup(); diff --git a/chrome/browser/views/uninstall_view.cc b/chrome/browser/views/uninstall_view.cc index 4b29766..2ecbc43 100644 --- a/chrome/browser/views/uninstall_view.cc +++ b/chrome/browser/views/uninstall_view.cc @@ -9,6 +9,7 @@ #include "base/process_util.h" #include "chrome/browser/shell_integration.h" #include "chrome/common/result_codes.h" +#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/shell_util.h" #include "views/controls/button/checkbox.h" #include "views/controls/label.h" @@ -62,7 +63,8 @@ void UninstallView::SetupControls() { layout->AddView(delete_profile_); // Set default browser combo box - if (ShellIntegration::IsDefaultBrowser()) { + if (BrowserDistribution::GetDistribution()->CanSetAsDefault() && + ShellIntegration::IsDefaultBrowser()) { browsers_.reset(new BrowsersMap()); ShellUtil::GetRegisteredBrowsers(browsers_.get()); if (!browsers_->empty()) { @@ -146,4 +148,3 @@ std::wstring UninstallView::GetItemAt(int index) { std::advance(it, index); return (*it).first; } - |