| 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/startup/default_browser_prompt.h" | 5 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Returns true if the default browser prompt should be shown if Chrome is not | 59 // Returns true if the default browser prompt should be shown if Chrome is not |
| 60 // the user's default browser. | 60 // the user's default browser. |
| 61 bool ShouldShowDefaultBrowserPrompt(Profile* profile) { | 61 bool ShouldShowDefaultBrowserPrompt(Profile* profile) { |
| 62 // Do not show the prompt if the "suppress_default_browser_prompt_for_version" | 62 // Do not show the prompt if the "suppress_default_browser_prompt_for_version" |
| 63 // master preference is set to the current version. | 63 // master preference is set to the current version. |
| 64 const std::string disable_version_string = | 64 const std::string disable_version_string = |
| 65 g_browser_process->local_state()->GetString( | 65 g_browser_process->local_state()->GetString( |
| 66 prefs::kBrowserSuppressDefaultBrowserPrompt); | 66 prefs::kBrowserSuppressDefaultBrowserPrompt); |
| 67 const Version disable_version(disable_version_string); | 67 const base::Version disable_version(disable_version_string); |
| 68 DCHECK(disable_version_string.empty() || disable_version.IsValid()); | 68 DCHECK(disable_version_string.empty() || disable_version.IsValid()); |
| 69 if (disable_version.IsValid() && | 69 if (disable_version.IsValid() && |
| 70 disable_version == Version(version_info::GetVersionNumber())) { | 70 disable_version == base::Version(version_info::GetVersionNumber())) { |
| 71 return false; | 71 return false; |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Do not show if the prompt period has yet to pass since the user previously | 74 // Do not show if the prompt period has yet to pass since the user previously |
| 75 // dismissed the infobar. | 75 // dismissed the infobar. |
| 76 int64_t last_dismissed_value = | 76 int64_t last_dismissed_value = |
| 77 profile->GetPrefs()->GetInt64(prefs::kDefaultBrowserLastDeclined); | 77 profile->GetPrefs()->GetInt64(prefs::kDefaultBrowserLastDeclined); |
| 78 if (last_dismissed_value) { | 78 if (last_dismissed_value) { |
| 79 int period_days = 0; | 79 int period_days = 0; |
| 80 base::StringToInt(variations::GetVariationParamValue( | 80 base::StringToInt(variations::GetVariationParamValue( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 profile->GetPrefs()->ClearPref(prefs::kDefaultBrowserLastDeclined); | 146 profile->GetPrefs()->ClearPref(prefs::kDefaultBrowserLastDeclined); |
| 147 } | 147 } |
| 148 | 148 |
| 149 #if !defined(OS_WIN) | 149 #if !defined(OS_WIN) |
| 150 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { | 150 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { |
| 151 return false; | 151 return false; |
| 152 } | 152 } |
| 153 #endif | 153 #endif |
| 154 | 154 |
| 155 } // namespace chrome | 155 } // namespace chrome |
| OLD | NEW |