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

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

Issue 4244: Make Chrome default browser an opt-out instead of an opt-in on first run. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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_view_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/first_run_view_base.cc
===================================================================
--- chrome/browser/views/first_run_view_base.cc (revision 2542)
+++ chrome/browser/views/first_run_view_base.cc (working copy)
@@ -12,6 +12,8 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/first_run.h"
+#include "chrome/browser/shell_integration.h"
+#include "chrome/browser/user_metrics.h"
#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/l10n_util.h"
@@ -19,6 +21,7 @@
#include "chrome/common/pref_service.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/views/background.h"
+#include "chrome/views/checkbox.h"
#include "chrome/views/client_view.h"
#include "chrome/views/image_view.h"
#include "chrome/views/label.h"
@@ -26,12 +29,14 @@
#include "chrome/views/separator.h"
#include "chrome/views/window.h"
+#include "chromium_strings.h"
#include "generated_resources.h"
FirstRunViewBase::FirstRunViewBase(Profile* profile)
: preferred_width_(0),
background_image_(NULL),
separator_1_(NULL),
+ default_browser_(NULL),
separator_2_(NULL),
importer_host_(NULL),
profile_(profile) {
@@ -91,6 +96,12 @@
separator_1_ = new ChromeViews::Separator;
AddChildView(separator_1_);
+ // The "make us default browser" check box.
+ default_browser_ = new ChromeViews::CheckBox(
+ l10n_util::GetString(IDS_FR_CUSTOMIZE_DEFAULT_BROWSER));
+ default_browser_->SetMultiLine(true);
+ AddChildView(default_browser_);
+
// The second separator marks the start of buttons.
separator_2_ = new ChromeViews::Separator;
AddChildView(separator_2_);
@@ -124,10 +135,17 @@
separator_1_->GetPreferredSize(&pref_size);
separator_1_->SetBounds(0 , next_v_space, canvas.cx + 1, pref_size.cy);
- next_v_space = canvas.cy - kPanelSubVerticalSpacing;
+ next_v_space = canvas.cy - kPanelSubVerticalSpacing - 2 * kVertSpacing;
separator_2_->GetPreferredSize(&pref_size);
separator_2_->SetBounds(kPanelHorizMargin , next_v_space,
- canvas.cx - 2*kPanelHorizMargin, pref_size.cy);
+ canvas.cx - 2 * kPanelHorizMargin, pref_size.cy);
+
+ next_v_space = separator_2_->y() + separator_2_->height() + kVertSpacing;
+
+ int width = canvas.cx - 2 * kPanelHorizMargin;
+ int height = default_browser_->GetHeightForWidth(width);
+ default_browser_->SetBounds(kPanelHorizMargin, next_v_space, width, height);
+ AdjustDialogWidth(default_browser_);
}
bool FirstRunViewBase::CanResize() const {
@@ -146,6 +164,13 @@
return false;
}
+std::wstring FirstRunViewBase::GetDialogButtonLabel(DialogButton button) const {
+ if (DIALOGBUTTON_OK == button)
+ return l10n_util::GetString(IDS_FIRSTRUN_DLG_OK);
+ // The other buttons get the default text.
+ return std::wstring();
+}
+
int FirstRunViewBase::GetDefaultImportItems() const {
// It is best to avoid importing cookies because there is a bug that make
// the process take way too much time among other issues. So for the time
@@ -158,6 +183,7 @@
ChromeViews::DialogClientView* dcv = GetDialogClientView();
dcv->ok_button()->SetEnabled(false);
dcv->cancel_button()->SetEnabled(false);
+ default_browser_->SetEnabled(false);
}
bool FirstRunViewBase::CreateDesktopShortcut() {
@@ -168,7 +194,11 @@
return FirstRun::CreateChromeQuickLaunchShortcut();
}
+bool FirstRunViewBase::SetDefaultBrowser() {
+ UserMetrics::RecordAction(L"FirstRun_Do_DefBrowser", profile_);
+ return ShellIntegration::SetAsDefaultBrowser();
+}
+
bool FirstRunViewBase::FirstRunComplete() {
return FirstRun::CreateSentinel();
}
-
« no previous file with comments | « chrome/browser/views/first_run_view_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698