| 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 "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac_util.h" | 11 #include "base/mac_util.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
| 15 #include "chrome/browser/browser.h" | 15 #include "chrome/browser/browser.h" |
| 16 #include "chrome/browser/browser_list.h" | 16 #include "chrome/browser/browser_list.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" | 18 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" |
| 19 #import "chrome/browser/cocoa/cookies_window_controller.h" |
| 19 #import "chrome/browser/cocoa/custom_home_pages_model.h" | 20 #import "chrome/browser/cocoa/custom_home_pages_model.h" |
| 20 #import "chrome/browser/cocoa/font_language_settings_controller.h" | 21 #import "chrome/browser/cocoa/font_language_settings_controller.h" |
| 21 #import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h" | 22 #import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h" |
| 22 #import "chrome/browser/cocoa/search_engine_list_model.h" | 23 #import "chrome/browser/cocoa/search_engine_list_model.h" |
| 23 #include "chrome/browser/extensions/extensions_service.h" | 24 #include "chrome/browser/extensions/extensions_service.h" |
| 24 #include "chrome/browser/metrics/metrics_service.h" | 25 #include "chrome/browser/metrics/metrics_service.h" |
| 25 #include "chrome/browser/metrics/user_metrics.h" | 26 #include "chrome/browser/metrics/user_metrics.h" |
| 26 #include "chrome/browser/net/dns_global.h" | 27 #include "chrome/browser/net/dns_global.h" |
| 27 #include "chrome/browser/net/url_fixer_upper.h" | 28 #include "chrome/browser/net/url_fixer_upper.h" |
| 28 #include "chrome/browser/options_window.h" | 29 #include "chrome/browser/options_window.h" |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 context:(void*)context { | 1293 context:(void*)context { |
| 1293 if (returnCode == NSOKButton) { | 1294 if (returnCode == NSOKButton) { |
| 1294 [self recordUserAction:"Options_SetDownloadDirectory"]; | 1295 [self recordUserAction:"Options_SetDownloadDirectory"]; |
| 1295 NSURL* path = [[panel URLs] lastObject]; // We only allow 1 item. | 1296 NSURL* path = [[panel URLs] lastObject]; // We only allow 1 item. |
| 1296 [self willChangeValueForKey:@"defaultDownloadLocation"]; | 1297 [self willChangeValueForKey:@"defaultDownloadLocation"]; |
| 1297 defaultDownloadLocation_.SetValue(base::SysNSStringToWide([path path])); | 1298 defaultDownloadLocation_.SetValue(base::SysNSStringToWide([path path])); |
| 1298 [self didChangeValueForKey:@"defaultDownloadLocation"]; | 1299 [self didChangeValueForKey:@"defaultDownloadLocation"]; |
| 1299 } | 1300 } |
| 1300 } | 1301 } |
| 1301 | 1302 |
| 1303 // Shows the cookies controller. |
| 1304 - (IBAction)showCookies:(id)sender { |
| 1305 // The controller will clean itself up. |
| 1306 CookiesWindowController* controller = |
| 1307 [[CookiesWindowController alloc] initWithProfile:profile_]; |
| 1308 [controller attachSheetTo:[self window]]; |
| 1309 } |
| 1310 |
| 1302 // Bring up an open panel to allow the user to set a new downloads location. | 1311 // Bring up an open panel to allow the user to set a new downloads location. |
| 1303 - (void)browseDownloadLocation:(id)sender { | 1312 - (void)browseDownloadLocation:(id)sender { |
| 1304 NSOpenPanel* panel = [NSOpenPanel openPanel]; | 1313 NSOpenPanel* panel = [NSOpenPanel openPanel]; |
| 1305 [panel setAllowsMultipleSelection:NO]; | 1314 [panel setAllowsMultipleSelection:NO]; |
| 1306 [panel setCanChooseFiles:NO]; | 1315 [panel setCanChooseFiles:NO]; |
| 1307 [panel setCanChooseDirectories:YES]; | 1316 [panel setCanChooseDirectories:YES]; |
| 1308 NSString* path = base::SysWideToNSString(defaultDownloadLocation_.GetValue()); | 1317 NSString* path = base::SysWideToNSString(defaultDownloadLocation_.GetValue()); |
| 1309 [panel beginSheetForDirectory:path | 1318 [panel beginSheetForDirectory:path |
| 1310 file:nil | 1319 file:nil |
| 1311 types:nil | 1320 types:nil |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 case OPTIONS_PAGE_ADVANCED: | 1762 case OPTIONS_PAGE_ADVANCED: |
| 1754 return underTheHoodView_; | 1763 return underTheHoodView_; |
| 1755 case OPTIONS_PAGE_DEFAULT: | 1764 case OPTIONS_PAGE_DEFAULT: |
| 1756 case OPTIONS_PAGE_COUNT: | 1765 case OPTIONS_PAGE_COUNT: |
| 1757 LOG(DFATAL) << "Invalid page value " << page; | 1766 LOG(DFATAL) << "Invalid page value " << page; |
| 1758 } | 1767 } |
| 1759 return basicsView_; | 1768 return basicsView_; |
| 1760 } | 1769 } |
| 1761 | 1770 |
| 1762 @end | 1771 @end |
| OLD | NEW |