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

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

Issue 2132593002: Remove remaining calls to deprecated MessageLoop methods on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: h264_vt_encoder_unittest.cc Created 4 years, 5 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
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/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h"
11 #include "base/strings/sys_string_conversions.h" 12 #include "base/strings/sys_string_conversions.h"
13 #include "base/threading/thread_task_runner_handle.h"
12 #include "chrome/browser/first_run/first_run.h" 14 #include "chrome/browser/first_run/first_run.h"
13 #include "chrome/browser/first_run/first_run_dialog.h" 15 #include "chrome/browser/first_run/first_run_dialog.h"
14 #include "chrome/browser/metrics/metrics_reporting_state.h" 16 #include "chrome/browser/metrics/metrics_reporting_state.h"
15 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/search_engines/template_url_service_factory.h" 18 #include "chrome/browser/search_engines/template_url_service_factory.h"
17 #include "chrome/browser/shell_integration.h" 19 #include "chrome/browser/shell_integration.h"
18 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
19 #include "components/search_engines/template_url_service.h" 21 #include "components/search_engines/template_url_service.h"
20 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h" 22 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h"
21 #include "ui/base/l10n/l10n_util_mac.h" 23 #include "ui/base/l10n/l10n_util_mac.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 - (void)dealloc { 139 - (void)dealloc {
138 [super dealloc]; 140 [super dealloc];
139 } 141 }
140 142
141 - (IBAction)showWindow:(id)sender { 143 - (IBAction)showWindow:(id)sender {
142 // The main MessageLoop has not yet run, but has been spun. If we call 144 // The main MessageLoop has not yet run, but has been spun. If we call
143 // -[NSApplication runModalForWindow:] we will hang <http://crbug.com/54248>. 145 // -[NSApplication runModalForWindow:] we will hang <http://crbug.com/54248>.
144 // Therefore the main MessageLoop is run so things work. 146 // Therefore the main MessageLoop is run so things work.
145 147
146 scoped_refptr<FirstRunShowBridge> bridge(new FirstRunShowBridge(self)); 148 scoped_refptr<FirstRunShowBridge> bridge(new FirstRunShowBridge(self));
147 base::MessageLoop::current()->PostTask(FROM_HERE, 149 base::ThreadTaskRunnerHandle::Get()->PostTask(
148 base::Bind(&FirstRunShowBridge::ShowDialog, bridge.get())); 150 FROM_HERE, base::Bind(&FirstRunShowBridge::ShowDialog, bridge.get()));
149 base::MessageLoop::current()->Run(); 151 base::RunLoop().Run();
150 } 152 }
151 153
152 - (void)show { 154 - (void)show {
153 NSWindow* win = [self window]; 155 NSWindow* win = [self window];
154 156
155 if (!shell_integration::CanSetAsDefaultBrowser()) { 157 if (!shell_integration::CanSetAsDefaultBrowser()) {
156 [setAsDefaultCheckbox_ setHidden:YES]; 158 [setAsDefaultCheckbox_ setHidden:YES];
157 } 159 }
158 160
159 // Only support the sizing the window once. 161 // Only support the sizing the window once.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 [NSApp stopModal]; 264 [NSApp stopModal];
263 } 265 }
264 266
265 - (IBAction)learnMore:(id)sender { 267 - (IBAction)learnMore:(id)sender {
266 NSString* urlStr = base::SysUTF8ToNSString(chrome::kLearnMoreReportingURL); 268 NSString* urlStr = base::SysUTF8ToNSString(chrome::kLearnMoreReportingURL);
267 NSURL* learnMoreUrl = [NSURL URLWithString:urlStr]; 269 NSURL* learnMoreUrl = [NSURL URLWithString:urlStr];
268 [[NSWorkspace sharedWorkspace] openURL:learnMoreUrl]; 270 [[NSWorkspace sharedWorkspace] openURL:learnMoreUrl];
269 } 271 }
270 272
271 @end 273 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698