summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-01 23:34:29 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-01 23:34:29 +0000
commit16ee695911e2e911d6d5f33092e6748a9c907f39 (patch)
treec94164324f552d0da79947bf0de1cd7b1bbf88f6
parent3579c4dbb74148d4d3f0bb594a099c97811b029e (diff)
downloadchromium_src-16ee695911e2e911d6d5f33092e6748a9c907f39.zip
chromium_src-16ee695911e2e911d6d5f33092e6748a9c907f39.tar.gz
chromium_src-16ee695911e2e911d6d5f33092e6748a9c907f39.tar.bz2
Reverting 15115, it sadly breaks the ui tests.
TBR=beng Review URL: http://codereview.chromium.org/100285 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15122 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.cc1
-rw-r--r--chrome/browser/browser_init.cc122
-rw-r--r--chrome/browser/browser_init.h4
-rw-r--r--chrome/browser/first_run.cc13
-rw-r--r--chrome/browser/views/options/general_page_view.cc3
-rw-r--r--chrome/common/pref_names.cc4
-rw-r--r--chrome/common/pref_names.h2
7 files changed, 3 insertions, 146 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index c5762fe..ac79476 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1174,7 +1174,6 @@ void Browser::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kDeletePasswords, false);
prefs->RegisterBooleanPref(prefs::kDeleteFormData, true);
prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0);
- prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true);
}
// static
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc
index bc47d65..88eae8b 100644
--- a/chrome/browser/browser_init.cc
+++ b/chrome/browser/browser_init.cc
@@ -18,14 +18,12 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extensions_service.h"
-#include "chrome/browser/first_run.h"
#include "chrome/browser/net/dns_global.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/session_startup_pref.h"
#include "chrome/browser/sessions/session_restore.h"
-#include "chrome/browser/shell_integration.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/web_contents.h"
@@ -56,112 +54,6 @@
namespace {
-class SetAsDefaultBrowserTask : public Task {
- public:
- SetAsDefaultBrowserTask() { }
- virtual void Run() {
- ShellIntegration::SetAsDefaultBrowser();
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SetAsDefaultBrowserTask);
-};
-
-// The delegate for the infobar shown when Chrome is not the default browser.
-class DefaultBrowserInfoBarDelegate : public ConfirmInfoBarDelegate {
- public:
- explicit DefaultBrowserInfoBarDelegate(TabContents* contents)
- : ConfirmInfoBarDelegate(contents),
- profile_(contents->profile()),
- action_taken_(false) {
- }
-
- // Overridden from ConfirmInfoBarDelegate:
- virtual void InfoBarClosed() {
- if (!action_taken_)
- UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1);
- delete this;
- }
-
- virtual std::wstring GetMessageText() const {
- return l10n_util::GetString(IDS_DEFAULT_BROWSER_INFOBAR_TEXT);
- }
-
- virtual SkBitmap* GetIcon() const {
- return NULL;
- }
-
- virtual int GetButtons() const { return BUTTON_OK | BUTTON_CANCEL; }
-
- virtual std::wstring GetButtonLabel(InfoBarButton button) const {
- return button == BUTTON_OK ?
- l10n_util::GetString(IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL) :
- l10n_util::GetString(IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL);
- }
-
- virtual bool Accept() {
- action_taken_ = true;
- UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1);
- g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE,
- new SetAsDefaultBrowserTask());
- return true;
- }
-
- virtual bool Cancel() {
- action_taken_ = true;
- UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.DontSetAsDefault", 1);
- // User clicked "Don't ask me again", remember that.
- profile_->GetPrefs()->SetBoolean(prefs::kCheckDefaultBrowser, false);
- return true;
- }
-
- private:
- // The Profile that we restore sessions from.
- Profile* profile_;
-
- // Whether the user clicked one of the buttons.
- bool action_taken_;
-
- DISALLOW_COPY_AND_ASSIGN(DefaultBrowserInfoBarDelegate);
-};
-
-class NotifyNotDefaultBrowserTask : public Task {
- public:
- NotifyNotDefaultBrowserTask() { }
-
- virtual void Run() {
- Browser* browser = BrowserList::GetLastActive();
- if (!browser) {
- NOTREACHED();
- return;
- }
- TabContents* tab = browser->GetSelectedTabContents();
- // Don't show the info-bar if there are already info-bars showing.
- if (tab->infobar_delegate_count() > 0)
- return;
- tab->AddInfoBar(new DefaultBrowserInfoBarDelegate(tab));
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(NotifyNotDefaultBrowserTask);
-};
-
-class CheckDefaultBrowserTask : public Task {
- public:
- explicit CheckDefaultBrowserTask(MessageLoop* ui_loop) : ui_loop_(ui_loop) {
- }
-
- virtual void Run() {
- if (!ShellIntegration::IsDefaultBrowser())
- ui_loop_->PostTask(FROM_HERE, new NotifyNotDefaultBrowserTask());
- }
-
- private:
- MessageLoop* ui_loop_;
-
- DISALLOW_COPY_AND_ASSIGN(CheckDefaultBrowserTask);
-};
-
// A delegate for the InfoBar shown when the previous session has crashed. The
// bar deletes itself automatically after it is closed.
// TODO(timsteele): This delegate can leak when a tab is closed, see
@@ -352,8 +244,6 @@ bool BrowserInit::LaunchWithProfile::Launch(Profile* profile,
browser = BrowserList::GetLastActive();
OpenURLsInBrowser(browser, process_startup, urls_to_open);
}
- // Check whether we are the default browser.
- CheckDefaultBrowser(profile);
} else {
RecordLaunchModeHistogram(LM_AS_WEBAPP);
}
@@ -518,18 +408,6 @@ void BrowserInit::LaunchWithProfile::AddStartupURLs(
}
}
-void BrowserInit::LaunchWithProfile::CheckDefaultBrowser(Profile* profile) {
- // We do not check if we are the default browser if:
- // - the user said "don't ask me again" on the infobar earlier.
- // - this is the first launch after the first run flow.
- if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) ||
- FirstRun::IsChromeFirstRun()) {
- return;
- }
- g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE,
- new CheckDefaultBrowserTask(MessageLoop::current()));
-}
-
bool BrowserInit::ProcessCommandLine(
const CommandLine& command_line, const std::wstring& cur_dir,
bool process_startup, Profile* profile, int* return_code) {
diff --git a/chrome/browser/browser_init.h b/chrome/browser/browser_init.h
index 6be28502..a456d5d 100644
--- a/chrome/browser/browser_init.h
+++ b/chrome/browser/browser_init.h
@@ -78,10 +78,6 @@ class BrowserInit {
// Adds additional startup URLs to the specified vector.
void AddStartupURLs(std::vector<GURL>* startup_urls) const;
- // Checks whether Chrome is still the default browser (unless the user
- // previously instructed not to do so) and warns the user if it is not.
- void CheckDefaultBrowser(Profile* profile);
-
std::wstring cur_dir_;
const CommandLine& command_line_;
Profile* profile_;
diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc
index d14e0c1..c402812 100644
--- a/chrome/browser/first_run.cc
+++ b/chrome/browser/first_run.cc
@@ -154,18 +154,11 @@ bool WriteEULAtoTempFile(FilePath* eula_path) {
} // namespace
bool FirstRun::IsChromeFirstRun() {
- // A troolean, 0 means not yet set, 1 means set to true, 2 set to false.
- static int first_run = 0;
- if (first_run != 0)
- return first_run == 1;
-
std::wstring first_run_sentinel;
- if (!GetFirstRunSentinelFilePath(&first_run_sentinel) ||
- file_util::PathExists(first_run_sentinel)) {
- first_run = 2;
+ if (!GetFirstRunSentinelFilePath(&first_run_sentinel))
+ return false;
+ if (file_util::PathExists(first_run_sentinel))
return false;
- }
- first_run = 1;
return true;
}
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc
index 4fd0801..a314fe7 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/views/options/general_page_view.cc
@@ -581,9 +581,6 @@ void GeneralPageView::ButtonPressed(views::Button* sender) {
} else if (sender == default_browser_use_as_default_button_) {
default_browser_worker_->StartSetAsDefaultBrowser();
UserMetricsRecordAction(L"Options_SetAsDefaultBrowser", NULL);
- // If the user made Chrome the default browser, then he/she arguably wants
- // to be notified when that changes.
- profile()->GetPrefs()->SetBoolean(prefs::kCheckDefaultBrowser, true);
} else if (sender == default_search_manage_engines_button_) {
UserMetricsRecordAction(L"Options_ManageSearchEngines", NULL);
KeywordEditorView::Show(profile());
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index aaf54cc..77a6aff 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -243,10 +243,6 @@ const wchar_t kPrintingPageFooterLeft[] = L"printing.page.footer.left";
const wchar_t kPrintingPageFooterCenter[] = L"printing.page.footer.center";
const wchar_t kPrintingPageFooterRight[] = L"printing.page.footer.right";
-// Boolean that indicates whether we should check if we are the default browser
-// on start-up.
-const wchar_t kCheckDefaultBrowser[] = L"browser.check_default_browser";
-
// *************** LOCAL STATE ***************
// These are attached to the machine/installation
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 53385fd..a9a37ab 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -87,8 +87,6 @@ extern const wchar_t kPrintingPageHeaderRight[];
extern const wchar_t kPrintingPageFooterLeft[];
extern const wchar_t kPrintingPageFooterCenter[];
extern const wchar_t kPrintingPageFooterRight[];
-extern const wchar_t kCheckDefaultBrowser[];
-
// Local state
extern const wchar_t kAvailableProfiles[];