| 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 #import "chrome/browser/ui/cocoa/first_run_dialog.h" | 5 #import "chrome/browser/ui/cocoa/first_run_dialog.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #import "base/memory/scoped_nsobject.h" | |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #include "chrome/browser/first_run/first_run.h" | 14 #include "chrome/browser/first_run/first_run.h" |
| 15 #include "chrome/browser/first_run/first_run_dialog.h" | 15 #include "chrome/browser/first_run/first_run_dialog.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/search_engines/template_url_service.h" | 17 #include "chrome/browser/search_engines/template_url_service.h" |
| 18 #include "chrome/browser/search_engines/template_url_service_factory.h" | 18 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 19 #include "chrome/browser/shell_integration.h" | 19 #include "chrome/browser/shell_integration.h" |
| 20 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
| 21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 #if defined(GOOGLE_CHROME_BUILD) | 84 #if defined(GOOGLE_CHROME_BUILD) |
| 85 // The purpose of the dialog is to ask the user to enable stats and crash | 85 // The purpose of the dialog is to ask the user to enable stats and crash |
| 86 // reporting. This setting may be controlled through configuration management | 86 // reporting. This setting may be controlled through configuration management |
| 87 // in enterprise scenarios. If that is the case, skip the dialog entirely, as | 87 // in enterprise scenarios. If that is the case, skip the dialog entirely, as |
| 88 // it's not worth bothering the user for only the default browser question | 88 // it's not worth bothering the user for only the default browser question |
| 89 // (which is likely to be forced in enterprise deployments anyway). | 89 // (which is likely to be forced in enterprise deployments anyway). |
| 90 const PrefService::Preference* metrics_reporting_pref = | 90 const PrefService::Preference* metrics_reporting_pref = |
| 91 g_browser_process->local_state()->FindPreference( | 91 g_browser_process->local_state()->FindPreference( |
| 92 prefs::kMetricsReportingEnabled); | 92 prefs::kMetricsReportingEnabled); |
| 93 if (!metrics_reporting_pref || !metrics_reporting_pref->IsManaged()) { | 93 if (!metrics_reporting_pref || !metrics_reporting_pref->IsManaged()) { |
| 94 scoped_nsobject<FirstRunDialogController> dialog( | 94 base::scoped_nsobject<FirstRunDialogController> dialog( |
| 95 [[FirstRunDialogController alloc] init]); | 95 [[FirstRunDialogController alloc] init]); |
| 96 | 96 |
| 97 [dialog.get() showWindow:nil]; | 97 [dialog.get() showWindow:nil]; |
| 98 dialog_shown = true; | 98 dialog_shown = true; |
| 99 | 99 |
| 100 // If the dialog asked the user to opt-in for stats and crash reporting, | 100 // If the dialog asked the user to opt-in for stats and crash reporting, |
| 101 // record the decision and enable the crash reporter if appropriate. | 101 // record the decision and enable the crash reporter if appropriate. |
| 102 bool stats_enabled = [dialog.get() statsEnabled]; | 102 bool stats_enabled = [dialog.get() statsEnabled]; |
| 103 GoogleUpdateSettings::SetCollectStatsConsent(stats_enabled); | 103 GoogleUpdateSettings::SetCollectStatsConsent(stats_enabled); |
| 104 | 104 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 [NSApp stopModal]; | 291 [NSApp stopModal]; |
| 292 } | 292 } |
| 293 | 293 |
| 294 - (IBAction)learnMore:(id)sender { | 294 - (IBAction)learnMore:(id)sender { |
| 295 NSString* urlStr = base::SysUTF8ToNSString(chrome::kLearnMoreReportingURL); | 295 NSString* urlStr = base::SysUTF8ToNSString(chrome::kLearnMoreReportingURL); |
| 296 NSURL* learnMoreUrl = [NSURL URLWithString:urlStr]; | 296 NSURL* learnMoreUrl = [NSURL URLWithString:urlStr]; |
| 297 [[NSWorkspace sharedWorkspace] openURL:learnMoreUrl]; | 297 [[NSWorkspace sharedWorkspace] openURL:learnMoreUrl]; |
| 298 } | 298 } |
| 299 | 299 |
| 300 @end | 300 @end |
| OLD | NEW |