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 "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "base/version.h" | 14 #include "base/version.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/first_run/first_run.h" | 16 #include "chrome/browser/first_run/first_run.h" |
17 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/browser/shell_integration.h" | 20 #include "chrome/browser/shell_integration.h" |
21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/browser_finder.h" | 22 #include "chrome/browser/ui/browser_finder.h" |
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
24 #include "chrome/common/chrome_version_info.h" | |
25 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
26 #include "chrome/grit/chromium_strings.h" | 25 #include "chrome/grit/chromium_strings.h" |
27 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
28 #include "chrome/installer/util/master_preferences.h" | 27 #include "chrome/installer/util/master_preferences.h" |
29 #include "chrome/installer/util/master_preferences_constants.h" | 28 #include "chrome/installer/util/master_preferences_constants.h" |
30 #include "components/infobars/core/confirm_infobar_delegate.h" | 29 #include "components/infobars/core/confirm_infobar_delegate.h" |
31 #include "components/infobars/core/infobar.h" | 30 #include "components/infobars/core/infobar.h" |
| 31 #include "components/version_info/version_info.h" |
32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
33 #include "content/public/browser/navigation_details.h" | 33 #include "content/public/browser/navigation_details.h" |
34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
35 #include "grit/theme_resources.h" | 35 #include "grit/theme_resources.h" |
36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
37 | 37 |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 // Calls the appropriate function for setting Chrome as the default browser. | 41 // Calls the appropriate function for setting Chrome as the default browser. |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 return; | 263 return; |
264 } | 264 } |
265 | 265 |
266 if (show_prompt) { | 266 if (show_prompt) { |
267 const std::string disable_version_string = | 267 const std::string disable_version_string = |
268 g_browser_process->local_state()->GetString( | 268 g_browser_process->local_state()->GetString( |
269 prefs::kBrowserSuppressDefaultBrowserPrompt); | 269 prefs::kBrowserSuppressDefaultBrowserPrompt); |
270 const Version disable_version(disable_version_string); | 270 const Version disable_version(disable_version_string); |
271 DCHECK(disable_version_string.empty() || disable_version.IsValid()); | 271 DCHECK(disable_version_string.empty() || disable_version.IsValid()); |
272 if (disable_version.IsValid()) { | 272 if (disable_version.IsValid()) { |
273 const chrome::VersionInfo version_info; | 273 if (disable_version.Equals(Version(version_info::GetVersionNumber()))) |
274 if (disable_version.Equals(Version(version_info.Version()))) | |
275 show_prompt = false; | 274 show_prompt = false; |
276 } | 275 } |
277 } | 276 } |
278 | 277 |
279 content::BrowserThread::PostTask( | 278 content::BrowserThread::PostTask( |
280 content::BrowserThread::FILE, FROM_HERE, | 279 content::BrowserThread::FILE, FROM_HERE, |
281 base::Bind(&CheckDefaultBrowserOnFileThread, profile->GetPath(), | 280 base::Bind(&CheckDefaultBrowserOnFileThread, profile->GetPath(), |
282 show_prompt, desktop_type)); | 281 show_prompt, desktop_type)); |
283 } | 282 } |
284 | 283 |
285 #if !defined(OS_WIN) | 284 #if !defined(OS_WIN) |
286 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { | 285 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { |
287 return false; | 286 return false; |
288 } | 287 } |
289 #endif | 288 #endif |
290 | 289 |
291 } // namespace chrome | 290 } // namespace chrome |
OLD | NEW |