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 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return NSOrderedDescending; | 50 return NSOrderedDescending; |
51 else | 51 else |
52 return NSOrderedSame; | 52 return NSOrderedSame; |
53 } | 53 } |
54 | 54 |
55 class FirstRunShowBridge : public base::RefCounted<FirstRunShowBridge> { | 55 class FirstRunShowBridge : public base::RefCounted<FirstRunShowBridge> { |
56 public: | 56 public: |
57 FirstRunShowBridge(FirstRunDialogController* controller); | 57 FirstRunShowBridge(FirstRunDialogController* controller); |
58 | 58 |
59 void ShowDialog(); | 59 void ShowDialog(); |
| 60 |
60 private: | 61 private: |
| 62 friend class base::RefCounted<FirstRunShowBridge>; |
| 63 |
| 64 ~FirstRunShowBridge(); |
| 65 |
61 FirstRunDialogController* controller_; | 66 FirstRunDialogController* controller_; |
62 }; | 67 }; |
63 | 68 |
64 FirstRunShowBridge::FirstRunShowBridge( | 69 FirstRunShowBridge::FirstRunShowBridge( |
65 FirstRunDialogController* controller) : controller_(controller) { | 70 FirstRunDialogController* controller) : controller_(controller) { |
66 } | 71 } |
67 | 72 |
68 void FirstRunShowBridge::ShowDialog() { | 73 void FirstRunShowBridge::ShowDialog() { |
69 [controller_ show]; | 74 [controller_ show]; |
70 MessageLoop::current()->QuitNow(); | 75 MessageLoop::current()->QuitNow(); |
71 } | 76 } |
72 | 77 |
| 78 FirstRunShowBridge::~FirstRunShowBridge() {} |
| 79 |
73 // Show the first run UI. | 80 // Show the first run UI. |
74 void ShowFirstRun(Profile* profile) { | 81 void ShowFirstRun(Profile* profile) { |
75 #if defined(GOOGLE_CHROME_BUILD) | 82 #if defined(GOOGLE_CHROME_BUILD) |
76 // The purpose of the dialog is to ask the user to enable stats and crash | 83 // The purpose of the dialog is to ask the user to enable stats and crash |
77 // reporting. This setting may be controlled through configuration management | 84 // reporting. This setting may be controlled through configuration management |
78 // in enterprise scenarios. If that is the case, skip the dialog entirely, as | 85 // in enterprise scenarios. If that is the case, skip the dialog entirely, as |
79 // it's not worth bothering the user for only the default browser question | 86 // it's not worth bothering the user for only the default browser question |
80 // (which is likely to be forced in enterprise deployments anyway). | 87 // (which is likely to be forced in enterprise deployments anyway). |
81 const PrefService::Preference* metrics_reporting_pref = | 88 const PrefService::Preference* metrics_reporting_pref = |
82 g_browser_process->local_state()->FindPreference( | 89 g_browser_process->local_state()->FindPreference( |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 [NSApp stopModal]; | 285 [NSApp stopModal]; |
279 } | 286 } |
280 | 287 |
281 - (IBAction)learnMore:(id)sender { | 288 - (IBAction)learnMore:(id)sender { |
282 NSString* urlStr = base::SysUTF8ToNSString(chrome::kLearnMoreReportingURL); | 289 NSString* urlStr = base::SysUTF8ToNSString(chrome::kLearnMoreReportingURL); |
283 NSURL* learnMoreUrl = [NSURL URLWithString:urlStr]; | 290 NSURL* learnMoreUrl = [NSURL URLWithString:urlStr]; |
284 [[NSWorkspace sharedWorkspace] openURL:learnMoreUrl]; | 291 [[NSWorkspace sharedWorkspace] openURL:learnMoreUrl]; |
285 } | 292 } |
286 | 293 |
287 @end | 294 @end |
OLD | NEW |