OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 NSData* fileURLData = [fileURLDesc data]; | 225 NSData* fileURLData = [fileURLDesc data]; |
226 if (!fileURLData) | 226 if (!fileURLData) |
227 continue; | 227 continue; |
228 GURL gurl(std::string((char*)[fileURLData bytes], [fileURLData length])); | 228 GURL gurl(std::string((char*)[fileURLData bytes], [fileURLData length])); |
229 gurlVector.push_back(gurl); | 229 gurlVector.push_back(gurl); |
230 } | 230 } |
231 | 231 |
232 OpenURLs(gurlVector); | 232 OpenURLs(gurlVector); |
233 } | 233 } |
234 | 234 |
| 235 // Called when the preferences window is closed. We use this to release the |
| 236 // window controller. |
| 237 - (void)prefsWindowClosed:(NSNotification*)notify { |
| 238 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 239 prefsController_.reset(NULL); |
| 240 } |
| 241 |
235 // Show the preferences window, or bring it to the front if it's already | 242 // Show the preferences window, or bring it to the front if it's already |
236 // visible. | 243 // visible. |
237 - (IBAction)showPreferences:(id)sender { | 244 - (IBAction)showPreferences:(id)sender { |
238 if (!prefsController_.get()) { | 245 if (!prefsController_.get()) { |
239 PrefService* prefs = [self defaultProfile]->GetPrefs(); | 246 PrefService* prefs = [self defaultProfile]->GetPrefs(); |
240 prefsController_.reset([[PreferencesWindowController alloc] | 247 prefsController_.reset([[PreferencesWindowController alloc] |
241 initWithPrefs:prefs]); | 248 initWithPrefs:prefs]); |
| 249 // Watch for a notification of when it goes away so that we can destroy |
| 250 // the controller. |
| 251 [[NSNotificationCenter defaultCenter] |
| 252 addObserver:self |
| 253 selector:@selector(prefsWindowClosed:) |
| 254 name:kUserDoneEditingPrefsNotification |
| 255 object:prefsController_.get()]; |
242 } | 256 } |
243 [prefsController_ showPreferences:sender]; | 257 [prefsController_ showPreferences:sender]; |
244 } | 258 } |
245 | 259 |
246 @end | 260 @end |
OLD | NEW |