| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/browser_init.h" | 5 #include "chrome/browser/ui/browser_init.h" |
| 6 | 6 |
| 7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 bool DefaultBrowserInfoBarDelegate::NeedElevation(InfoBarButton button) const { | 326 bool DefaultBrowserInfoBarDelegate::NeedElevation(InfoBarButton button) const { |
| 327 return button == BUTTON_OK; | 327 return button == BUTTON_OK; |
| 328 } | 328 } |
| 329 | 329 |
| 330 bool DefaultBrowserInfoBarDelegate::Accept() { | 330 bool DefaultBrowserInfoBarDelegate::Accept() { |
| 331 action_taken_ = true; | 331 action_taken_ = true; |
| 332 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1); | 332 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1); |
| 333 BrowserThread::PostTask( | 333 BrowserThread::PostTask( |
| 334 BrowserThread::FILE, | 334 BrowserThread::FILE, |
| 335 FROM_HERE, | 335 FROM_HERE, |
| 336 base::IgnoreReturn<bool>( | 336 base::Bind(base::IgnoreResult(&ShellIntegration::SetAsDefaultBrowser))); |
| 337 base::Bind(&ShellIntegration::SetAsDefaultBrowser))); | |
| 338 return true; | 337 return true; |
| 339 } | 338 } |
| 340 | 339 |
| 341 bool DefaultBrowserInfoBarDelegate::Cancel() { | 340 bool DefaultBrowserInfoBarDelegate::Cancel() { |
| 342 action_taken_ = true; | 341 action_taken_ = true; |
| 343 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.DontSetAsDefault", 1); | 342 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.DontSetAsDefault", 1); |
| 344 // User clicked "Don't ask me again", remember that. | 343 // User clicked "Don't ask me again", remember that. |
| 345 prefs_->SetBoolean(prefs::kCheckDefaultBrowser, false); | 344 prefs_->SetBoolean(prefs::kCheckDefaultBrowser, false); |
| 346 return true; | 345 return true; |
| 347 } | 346 } |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) || | 1441 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) || |
| 1443 is_first_run_) { | 1442 is_first_run_) { |
| 1444 return; | 1443 return; |
| 1445 } | 1444 } |
| 1446 if (g_browser_process->local_state()->IsManagedPreference( | 1445 if (g_browser_process->local_state()->IsManagedPreference( |
| 1447 prefs::kDefaultBrowserSettingEnabled)) { | 1446 prefs::kDefaultBrowserSettingEnabled)) { |
| 1448 if (g_browser_process->local_state()->GetBoolean( | 1447 if (g_browser_process->local_state()->GetBoolean( |
| 1449 prefs::kDefaultBrowserSettingEnabled)) { | 1448 prefs::kDefaultBrowserSettingEnabled)) { |
| 1450 BrowserThread::PostTask( | 1449 BrowserThread::PostTask( |
| 1451 BrowserThread::FILE, FROM_HERE, | 1450 BrowserThread::FILE, FROM_HERE, |
| 1452 base::IgnoreReturn<bool>( | 1451 base::Bind( |
| 1453 base::Bind(&ShellIntegration::SetAsDefaultBrowser))); | 1452 base::IgnoreResult(&ShellIntegration::SetAsDefaultBrowser))); |
| 1454 } else { | 1453 } else { |
| 1455 // TODO(pastarmovj): We can't really do anything meaningful here yet but | 1454 // TODO(pastarmovj): We can't really do anything meaningful here yet but |
| 1456 // just prevent showing the infobar. | 1455 // just prevent showing the infobar. |
| 1457 } | 1456 } |
| 1458 return; | 1457 return; |
| 1459 } | 1458 } |
| 1460 BrowserThread::PostTask( | 1459 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 1461 BrowserThread::FILE, FROM_HERE, base::Bind(&CheckDefaultBrowserCallback)); | 1460 base::Bind(&CheckDefaultBrowserCallback)); |
| 1462 } | 1461 } |
| 1463 | 1462 |
| 1464 bool BrowserInit::LaunchWithProfile::CheckIfAutoLaunched(Profile* profile) { | 1463 bool BrowserInit::LaunchWithProfile::CheckIfAutoLaunched(Profile* profile) { |
| 1465 #if defined(OS_WIN) | 1464 #if defined(OS_WIN) |
| 1466 if (!auto_launch_trial::IsInAutoLaunchGroup()) | 1465 if (!auto_launch_trial::IsInAutoLaunchGroup()) |
| 1467 return false; | 1466 return false; |
| 1468 | 1467 |
| 1469 int infobar_shown = | 1468 int infobar_shown = |
| 1470 profile->GetPrefs()->GetInteger(prefs::kShownAutoLaunchInfobar); | 1469 profile->GetPrefs()->GetInteger(prefs::kShownAutoLaunchInfobar); |
| 1471 if (infobar_shown >= kMaxInfobarShown) | 1470 if (infobar_shown >= kMaxInfobarShown) |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 | 1720 |
| 1722 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1721 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 1723 if (!profile) { | 1722 if (!profile) { |
| 1724 // We should only be able to get here if the profile already exists and | 1723 // We should only be able to get here if the profile already exists and |
| 1725 // has been created. | 1724 // has been created. |
| 1726 NOTREACHED(); | 1725 NOTREACHED(); |
| 1727 return; | 1726 return; |
| 1728 } | 1727 } |
| 1729 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL); | 1728 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, NULL, NULL); |
| 1730 } | 1729 } |
| OLD | NEW |