Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Side by Side Diff: chrome/browser/ui/cocoa/first_run_dialog.mm

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 FirstRunDialogController* controller_; 66 FirstRunDialogController* controller_;
67 }; 67 };
68 68
69 FirstRunShowBridge::FirstRunShowBridge( 69 FirstRunShowBridge::FirstRunShowBridge(
70 FirstRunDialogController* controller) : controller_(controller) { 70 FirstRunDialogController* controller) : controller_(controller) {
71 } 71 }
72 72
73 void FirstRunShowBridge::ShowDialog() { 73 void FirstRunShowBridge::ShowDialog() {
74 [controller_ show]; 74 [controller_ show];
75 MessageLoop::current()->QuitNow(); 75 base::MessageLoop::current()->QuitNow();
76 } 76 }
77 77
78 FirstRunShowBridge::~FirstRunShowBridge() {} 78 FirstRunShowBridge::~FirstRunShowBridge() {}
79 79
80 // Show the first run UI. 80 // Show the first run UI.
81 // Returns true if the first run dialog was shown. 81 // Returns true if the first run dialog was shown.
82 bool ShowFirstRun(Profile* profile) { 82 bool ShowFirstRun(Profile* profile) {
83 bool dialog_shown = false; 83 bool dialog_shown = false;
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
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 - (void)dealloc { 174 - (void)dealloc {
175 [super dealloc]; 175 [super dealloc];
176 } 176 }
177 177
178 - (IBAction)showWindow:(id)sender { 178 - (IBAction)showWindow:(id)sender {
179 // The main MessageLoop has not yet run, but has been spun. If we call 179 // The main MessageLoop has not yet run, but has been spun. If we call
180 // -[NSApplication runModalForWindow:] we will hang <http://crbug.com/54248>. 180 // -[NSApplication runModalForWindow:] we will hang <http://crbug.com/54248>.
181 // Therefore the main MessageLoop is run so things work. 181 // Therefore the main MessageLoop is run so things work.
182 182
183 scoped_refptr<FirstRunShowBridge> bridge(new FirstRunShowBridge(self)); 183 scoped_refptr<FirstRunShowBridge> bridge(new FirstRunShowBridge(self));
184 MessageLoop::current()->PostTask(FROM_HERE, 184 base::MessageLoop::current()->PostTask(FROM_HERE,
185 base::Bind(&FirstRunShowBridge::ShowDialog, bridge.get())); 185 base::Bind(&FirstRunShowBridge::ShowDialog, bridge.get()));
186 MessageLoop::current()->Run(); 186 base::MessageLoop::current()->Run();
187 } 187 }
188 188
189 - (void)show { 189 - (void)show {
190 NSWindow* win = [self window]; 190 NSWindow* win = [self window];
191 191
192 if (!ShellIntegration::CanSetAsDefaultBrowser()) { 192 if (!ShellIntegration::CanSetAsDefaultBrowser()) {
193 [setAsDefaultCheckbox_ setHidden:YES]; 193 [setAsDefaultCheckbox_ setHidden:YES];
194 } 194 }
195 195
196 // Only support the sizing the window once. 196 // Only support the sizing the window once.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/external_protocol_dialog.mm ('k') | chrome/browser/ui/cocoa/importer/import_lock_dialog_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698