| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 [self recordUserAction:L"Options_SearchEngineChanged"]; | 573 [self recordUserAction:L"Options_SearchEngineChanged"]; |
| 574 [searchEngineModel_ setDefaultIndex:index]; | 574 [searchEngineModel_ setDefaultIndex:index]; |
| 575 } | 575 } |
| 576 | 576 |
| 577 // Called when the search engine model changes. Update the selection in the | 577 // Called when the search engine model changes. Update the selection in the |
| 578 // popup by tickling the bindings with the new value. | 578 // popup by tickling the bindings with the new value. |
| 579 - (void)searchEngineModelChanged:(NSNotification*)notify { | 579 - (void)searchEngineModelChanged:(NSNotification*)notify { |
| 580 [self setSearchEngineSelectedIndex:[self searchEngineSelectedIndex]]; | 580 [self setSearchEngineSelectedIndex:[self searchEngineSelectedIndex]]; |
| 581 } | 581 } |
| 582 | 582 |
| 583 // Notification receiver for when the keyword editor window closes. The | |
| 584 // controller will clean up the window, but we need to clean up. | |
| 585 - (void)keywordEditorClosed:(NSNotification*)notif { | |
| 586 keywordEditorController_ = nil; | |
| 587 } | |
| 588 | |
| 589 // Brings up the edit search engines window. | |
| 590 - (IBAction)manageSearchEngines:(id)sender { | 583 - (IBAction)manageSearchEngines:(id)sender { |
| 591 if (!keywordEditorController_) { | 584 [KeywordEditorCocoaController showKeywordEditor:profile_]; |
| 592 keywordEditorController_ = | |
| 593 [[KeywordEditorCocoaController alloc] initWithProfile:profile_]; | |
| 594 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | |
| 595 [center addObserver:self | |
| 596 selector:@selector(keywordEditorClosed:) | |
| 597 name:NSWindowWillCloseNotification | |
| 598 object:[keywordEditorController_ window]]; | |
| 599 } | |
| 600 [[keywordEditorController_ window] makeKeyAndOrderFront:sender]; | |
| 601 } | 585 } |
| 602 | 586 |
| 603 // Called when the user clicks the button to make Chromium the default | 587 // Called when the user clicks the button to make Chromium the default |
| 604 // browser. Registers http and https. | 588 // browser. Registers http and https. |
| 605 - (IBAction)makeDefaultBrowser:(id)sender { | 589 - (IBAction)makeDefaultBrowser:(id)sender { |
| 606 [self willChangeValueForKey:@"defaultBrowser"]; | 590 [self willChangeValueForKey:@"defaultBrowser"]; |
| 607 | 591 |
| 608 ShellIntegration::SetAsDefaultBrowser(); | 592 ShellIntegration::SetAsDefaultBrowser(); |
| 609 [self recordUserAction:L"Options_SetAsDefaultBrowser"]; | 593 [self recordUserAction:L"Options_SetAsDefaultBrowser"]; |
| 610 // If the user made Chrome the default browser, then he/she arguably wants | 594 // If the user made Chrome the default browser, then he/she arguably wants |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 [[NSNotificationCenter defaultCenter] | 1020 [[NSNotificationCenter defaultCenter] |
| 1037 postNotificationName:kUserDoneEditingPrefsNotification | 1021 postNotificationName:kUserDoneEditingPrefsNotification |
| 1038 object:self]; | 1022 object:self]; |
| 1039 } | 1023 } |
| 1040 | 1024 |
| 1041 - (void)controlTextDidEndEditing:(NSNotification*)notification { | 1025 - (void)controlTextDidEndEditing:(NSNotification*)notification { |
| 1042 [customPagesSource_ validateURLs]; | 1026 [customPagesSource_ validateURLs]; |
| 1043 } | 1027 } |
| 1044 | 1028 |
| 1045 @end | 1029 @end |
| OLD | NEW |