| 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/cocoa/preferences_window_controller.h" | 5 #import "chrome/browser/cocoa/preferences_window_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 [self recordUserAction:L"Options_SearchEngineChanged"]; | 533 [self recordUserAction:L"Options_SearchEngineChanged"]; |
| 534 [searchEngineModel_ setDefaultIndex:index]; | 534 [searchEngineModel_ setDefaultIndex:index]; |
| 535 } | 535 } |
| 536 | 536 |
| 537 // Called when the search engine model changes. Update the selection in the | 537 // Called when the search engine model changes. Update the selection in the |
| 538 // popup by tickling the bindings with the new value. | 538 // popup by tickling the bindings with the new value. |
| 539 - (void)searchEngineModelChanged:(NSNotification*)notify { | 539 - (void)searchEngineModelChanged:(NSNotification*)notify { |
| 540 [self setSearchEngineSelectedIndex:[self searchEngineSelectedIndex]]; | 540 [self setSearchEngineSelectedIndex:[self searchEngineSelectedIndex]]; |
| 541 } | 541 } |
| 542 | 542 |
| 543 // Notification receiver for when the keyword editor window closes. The |
| 544 // controller will clean up the window, but we need to clean up. |
| 545 - (void)keywordEditorClosed:(NSNotification*)notif { |
| 546 keywordEditorController_ = nil; |
| 547 } |
| 548 |
| 543 // Brings up the edit search engines window. | 549 // Brings up the edit search engines window. |
| 544 - (IBAction)manageSearchEngines:(id)sender { | 550 - (IBAction)manageSearchEngines:(id)sender { |
| 545 KeywordEditorCocoaController* controller = | 551 if (!keywordEditorController_) { |
| 546 [[KeywordEditorCocoaController alloc] initWithProfile:profile_]; | 552 keywordEditorController_ = |
| 547 [[controller window] makeKeyAndOrderFront:sender]; | 553 [[KeywordEditorCocoaController alloc] initWithProfile:profile_]; |
| 554 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 555 [center addObserver:self |
| 556 selector:@selector(keywordEditorClosed:) |
| 557 name:NSWindowWillCloseNotification |
| 558 object:[keywordEditorController_ window]]; |
| 559 } |
| 560 [[keywordEditorController_ window] makeKeyAndOrderFront:sender]; |
| 548 } | 561 } |
| 549 | 562 |
| 550 // Called when the user clicks the button to make Chromium the default | 563 // Called when the user clicks the button to make Chromium the default |
| 551 // browser. Registers http and https. | 564 // browser. Registers http and https. |
| 552 - (IBAction)makeDefaultBrowser:(id)sender { | 565 - (IBAction)makeDefaultBrowser:(id)sender { |
| 553 [self willChangeValueForKey:@"defaultBrowser"]; | 566 [self willChangeValueForKey:@"defaultBrowser"]; |
| 554 | 567 |
| 555 ShellIntegration::SetAsDefaultBrowser(); | 568 ShellIntegration::SetAsDefaultBrowser(); |
| 556 [self recordUserAction:L"Options_SetAsDefaultBrowser"]; | 569 [self recordUserAction:L"Options_SetAsDefaultBrowser"]; |
| 557 // If the user made Chrome the default browser, then he/she arguably wants | 570 // If the user made Chrome the default browser, then he/she arguably wants |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 [[NSNotificationCenter defaultCenter] | 892 [[NSNotificationCenter defaultCenter] |
| 880 postNotificationName:kUserDoneEditingPrefsNotification | 893 postNotificationName:kUserDoneEditingPrefsNotification |
| 881 object:self]; | 894 object:self]; |
| 882 } | 895 } |
| 883 | 896 |
| 884 - (void)controlTextDidEndEditing:(NSNotification*)notification { | 897 - (void)controlTextDidEndEditing:(NSNotification*)notification { |
| 885 [customPagesSource_ validateURLs]; | 898 [customPagesSource_ validateURLs]; |
| 886 } | 899 } |
| 887 | 900 |
| 888 @end | 901 @end |
| OLD | NEW |