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/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 [[NSNotificationCenter defaultCenter] | 1207 [[NSNotificationCenter defaultCenter] |
1208 removeObserver:self | 1208 removeObserver:self |
1209 name:NSWindowWillCloseNotification | 1209 name:NSWindowWillCloseNotification |
1210 object:window]; | 1210 object:window]; |
1211 // AboutWindowControllers are autoreleased in | 1211 // AboutWindowControllers are autoreleased in |
1212 // -[AboutWindowController windowWillClose:]. | 1212 // -[AboutWindowController windowWillClose:]. |
1213 aboutController_ = nil; | 1213 aboutController_ = nil; |
1214 } | 1214 } |
1215 | 1215 |
1216 - (IBAction)orderFrontStandardAboutPanel:(id)sender { | 1216 - (IBAction)orderFrontStandardAboutPanel:(id)sender { |
1217 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableUberPage)) { | 1217 if (Browser* browser = ActivateBrowser([self lastProfile])) { |
1218 if (!aboutController_) { | 1218 // Show about tab in the active browser window. |
1219 aboutController_ = | 1219 browser->OpenAboutChromeDialog(); |
1220 [[AboutWindowController alloc] initWithProfile:[self lastProfile]]; | |
1221 | |
1222 // Watch for a notification of when it goes away so that we can destroy | |
1223 // the controller. | |
1224 [[NSNotificationCenter defaultCenter] | |
1225 addObserver:self | |
1226 selector:@selector(aboutWindowClosed:) | |
1227 name:NSWindowWillCloseNotification | |
1228 object:[aboutController_ window]]; | |
1229 } | |
1230 | |
1231 [aboutController_ showWindow:self]; | |
1232 } else { | 1220 } else { |
1233 if (Browser* browser = ActivateBrowser([self lastProfile])) { | 1221 // No browser window, so create one for the about tab. |
1234 // Show about tab in the active browser window. | 1222 Browser::OpenAboutWindow([self lastProfile]); |
1235 browser->OpenAboutChromeDialog(); | |
1236 } else { | |
1237 // No browser window, so create one for the about tab. | |
1238 Browser::OpenAboutWindow([self lastProfile]); | |
1239 } | |
1240 } | 1223 } |
1241 } | 1224 } |
1242 | 1225 |
1243 - (IBAction)toggleConfirmToQuit:(id)sender { | 1226 - (IBAction)toggleConfirmToQuit:(id)sender { |
1244 PrefService* prefService = g_browser_process->local_state(); | 1227 PrefService* prefService = g_browser_process->local_state(); |
1245 bool enabled = prefService->GetBoolean(prefs::kConfirmToQuitEnabled); | 1228 bool enabled = prefService->GetBoolean(prefs::kConfirmToQuitEnabled); |
1246 prefService->SetBoolean(prefs::kConfirmToQuitEnabled, !enabled); | 1229 prefService->SetBoolean(prefs::kConfirmToQuitEnabled, !enabled); |
1247 } | 1230 } |
1248 | 1231 |
1249 // Explicitly bring to the foreground when creating new windows from the dock. | 1232 // Explicitly bring to the foreground when creating new windows from the dock. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 | 1334 |
1352 } // namespace browser | 1335 } // namespace browser |
1353 | 1336 |
1354 namespace app_controller_mac { | 1337 namespace app_controller_mac { |
1355 | 1338 |
1356 bool IsOpeningNewWindow() { | 1339 bool IsOpeningNewWindow() { |
1357 return g_is_opening_new_window; | 1340 return g_is_opening_new_window; |
1358 } | 1341 } |
1359 | 1342 |
1360 } // namespace app_controller_mac | 1343 } // namespace app_controller_mac |
OLD | NEW |