| 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 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/tab_contents/tab_contents.h" | 25 #include "chrome/browser/tab_contents/tab_contents.h" |
| 26 #include "chrome/common/notification_details.h" | 26 #include "chrome/common/notification_details.h" |
| 27 #include "chrome/common/notification_observer.h" | 27 #include "chrome/common/notification_observer.h" |
| 28 #include "chrome/common/notification_type.h" | 28 #include "chrome/common/notification_type.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/pref_service.h" | 30 #include "chrome/common/pref_service.h" |
| 31 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 32 #include "chrome/installer/util/google_update_settings.h" | 32 #include "chrome/installer/util/google_update_settings.h" |
| 33 #include "grit/chromium_strings.h" | 33 #include "grit/chromium_strings.h" |
| 34 #include "grit/generated_resources.h" | 34 #include "grit/generated_resources.h" |
| 35 #include "grit/locale_settings.h" |
| 35 #include "net/base/cookie_policy.h" | 36 #include "net/base/cookie_policy.h" |
| 36 | 37 |
| 37 NSString* const kUserDoneEditingPrefsNotification = | 38 NSString* const kUserDoneEditingPrefsNotification = |
| 38 @"kUserDoneEditingPrefsNotification"; | 39 @"kUserDoneEditingPrefsNotification"; |
| 39 | 40 |
| 40 namespace { | 41 namespace { |
| 41 std::wstring GetNewTabUIURLString() { | 42 std::wstring GetNewTabUIURLString() { |
| 42 std::wstring temp = UTF8ToWide(chrome::kChromeUINewTabURL); | 43 std::wstring temp = UTF8ToWide(chrome::kChromeUINewTabURL); |
| 43 return URLFixerUpper::FixupURL(temp, std::wstring()); | 44 return URLFixerUpper::FixupURL(temp, std::wstring()); |
| 44 } | 45 } |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 initWithProfile:profile_]); | 632 initWithProfile:profile_]); |
| 632 [controller runModalDialog]; | 633 [controller runModalDialog]; |
| 633 } | 634 } |
| 634 | 635 |
| 635 // Called to reset the theming info back to the defaults. | 636 // Called to reset the theming info back to the defaults. |
| 636 - (IBAction)resetTheme:(id)sender { | 637 - (IBAction)resetTheme:(id)sender { |
| 637 [self recordUserAction:L"Options_ThemesReset"]; | 638 [self recordUserAction:L"Options_ThemesReset"]; |
| 638 profile_->ClearTheme(); | 639 profile_->ClearTheme(); |
| 639 } | 640 } |
| 640 | 641 |
| 642 - (IBAction)themesGallery:(id)sender { |
| 643 [self recordUserAction:L"Options_ThemesGallery"]; |
| 644 Browser* browser = |
| 645 BrowserList::FindBrowserWithType(profile_, Browser::TYPE_NORMAL); |
| 646 |
| 647 if (!browser || !browser->GetSelectedTabContents()) { |
| 648 browser = Browser::Create(profile_); |
| 649 browser->OpenURL( |
| 650 GURL(l10n_util::GetStringUTF8(IDS_THEMES_GALLERY_URL)), |
| 651 GURL(), NEW_WINDOW, PageTransition::LINK); |
| 652 } else { |
| 653 browser->AddTabWithURL( |
| 654 GURL(l10n_util::GetStringUTF8(IDS_THEMES_GALLERY_URL)), |
| 655 GURL(), PageTransition::LINK, true, -1, false, NULL); |
| 656 } |
| 657 } |
| 658 |
| 641 - (void)setPasswordManagerEnabledIndex:(NSInteger)value { | 659 - (void)setPasswordManagerEnabledIndex:(NSInteger)value { |
| 642 if (value == kEnabledIndex) | 660 if (value == kEnabledIndex) |
| 643 [self recordUserAction:L"Options_PasswordManager_Enable"]; | 661 [self recordUserAction:L"Options_PasswordManager_Enable"]; |
| 644 else | 662 else |
| 645 [self recordUserAction:L"Options_PasswordManager_Disable"]; | 663 [self recordUserAction:L"Options_PasswordManager_Disable"]; |
| 646 askSavePasswords_.SetValue(value == kEnabledIndex ? true : false); | 664 askSavePasswords_.SetValue(value == kEnabledIndex ? true : false); |
| 647 } | 665 } |
| 648 | 666 |
| 649 - (NSInteger)passwordManagerEnabledIndex { | 667 - (NSInteger)passwordManagerEnabledIndex { |
| 650 return askSavePasswords_.GetValue() ? kEnabledIndex : kDisabledIndex; | 668 return askSavePasswords_.GetValue() ? kEnabledIndex : kDisabledIndex; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 | 859 |
| 842 // Called when the window is being closed. Send out a notification that the | 860 // Called when the window is being closed. Send out a notification that the |
| 843 // user is done editing preferences. | 861 // user is done editing preferences. |
| 844 - (void)windowWillClose:(NSNotification *)notification { | 862 - (void)windowWillClose:(NSNotification *)notification { |
| 845 [[NSNotificationCenter defaultCenter] | 863 [[NSNotificationCenter defaultCenter] |
| 846 postNotificationName:kUserDoneEditingPrefsNotification | 864 postNotificationName:kUserDoneEditingPrefsNotification |
| 847 object:self]; | 865 object:self]; |
| 848 } | 866 } |
| 849 | 867 |
| 850 @end | 868 @end |
| OLD | NEW |