Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
|
viettrungluu
2010/02/22 00:57:40
There should really be a blank line before this on
| |
| 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/autofill/autofill_dialog.h" | 15 #include "chrome/browser/autofill/autofill_dialog.h" |
| 16 #include "chrome/browser/autofill/autofill_type.h" | 16 #include "chrome/browser/autofill/autofill_type.h" |
| 17 #include "chrome/browser/autofill/personal_data_manager.h" | 17 #include "chrome/browser/autofill/personal_data_manager.h" |
| 18 #include "chrome/browser/browser.h" | 18 #include "chrome/browser/browser.h" |
| 19 #include "chrome/browser/browser_list.h" | 19 #include "chrome/browser/browser_list.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" | 21 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" |
| 22 #import "chrome/browser/cocoa/cookies_window_controller.h" | 22 #import "chrome/browser/cocoa/content_settings_dialog_controller.h" |
| 23 #import "chrome/browser/cocoa/custom_home_pages_model.h" | 23 #import "chrome/browser/cocoa/custom_home_pages_model.h" |
| 24 #import "chrome/browser/cocoa/font_language_settings_controller.h" | 24 #import "chrome/browser/cocoa/font_language_settings_controller.h" |
| 25 #import "chrome/browser/cocoa/import_settings_dialog.h" | 25 #import "chrome/browser/cocoa/import_settings_dialog.h" |
| 26 #import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h" | 26 #import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h" |
| 27 #import "chrome/browser/cocoa/search_engine_list_model.h" | 27 #import "chrome/browser/cocoa/search_engine_list_model.h" |
| 28 #include "chrome/browser/extensions/extensions_service.h" | 28 #include "chrome/browser/extensions/extensions_service.h" |
| 29 #include "chrome/browser/metrics/metrics_service.h" | 29 #include "chrome/browser/metrics/metrics_service.h" |
| 30 #include "chrome/browser/metrics/user_metrics.h" | 30 #include "chrome/browser/metrics/user_metrics.h" |
| 31 #include "chrome/browser/net/dns_global.h" | 31 #include "chrome/browser/net/dns_global.h" |
| 32 #include "chrome/browser/net/url_fixer_upper.h" | 32 #include "chrome/browser/net/url_fixer_upper.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 | 304 |
| 305 // Simply removes all the views in |toRemove|. | 305 // Simply removes all the views in |toRemove|. |
| 306 void RemoveGroupFromView(NSView* view, NSArray* toRemove) { | 306 void RemoveGroupFromView(NSView* view, NSArray* toRemove) { |
| 307 for (NSView* viewToRemove in toRemove) { | 307 for (NSView* viewToRemove in toRemove) { |
| 308 RemoveViewFromView(view, viewToRemove); | 308 RemoveViewFromView(view, viewToRemove); |
| 309 } | 309 } |
| 310 } | 310 } |
| 311 | 311 |
| 312 // Helper to tweak the layout of the "Under the Hood" content by autosizing all | 312 // Helper to tweak the layout of the "Under the Hood" content by autosizing all |
| 313 // the views and moving things up vertically. Special case the two controls for | 313 // the views and moving things up vertically. Special case the two controls for |
| 314 // download location as they are horizontal, and should fill the row. | 314 // download location as they are horizontal, and should fill the row. Special |
| 315 // case "Content Settings" and "Clear browsing data" as they are horizontal as | |
| 316 // well. | |
| 315 CGFloat AutoSizeUnderTheHoodContent(NSView* view, | 317 CGFloat AutoSizeUnderTheHoodContent(NSView* view, |
| 318 NSButton* contentSettingsButton, | |
| 319 NSButton* clearDataButton, | |
| 316 NSPathControl* downloadLocationControl, | 320 NSPathControl* downloadLocationControl, |
| 317 NSButton* downloadLocationButton) { | 321 NSButton* downloadLocationButton) { |
| 318 CGFloat verticalShift = 0.0; | 322 CGFloat verticalShift = 0.0; |
| 319 | 323 |
| 320 // Loop bottom up through the views sizing and shifting. | 324 // Loop bottom up through the views sizing and shifting. |
| 321 NSArray* views = | 325 NSArray* views = |
| 322 [[view subviews] sortedArrayUsingFunction:CompareFrameY context:NULL]; | 326 [[view subviews] sortedArrayUsingFunction:CompareFrameY context:NULL]; |
| 323 for (NSView* view in views) { | 327 for (NSView* view in views) { |
| 324 NSSize delta = WrapOrSizeToFit(view); | 328 NSSize delta = WrapOrSizeToFit(view); |
| 325 DCHECK_GE(delta.height, 0.0) << "Should NOT shrink in height"; | 329 DCHECK_GE(delta.height, 0.0) << "Should NOT shrink in height"; |
| 326 if (verticalShift) { | 330 if (verticalShift) { |
| 327 NSPoint origin = [view frame].origin; | 331 NSPoint origin = [view frame].origin; |
| 328 origin.y += verticalShift; | 332 origin.y += verticalShift; |
| 329 [view setFrameOrigin:origin]; | 333 [view setFrameOrigin:origin]; |
| 330 } | 334 } |
| 331 verticalShift += delta.height; | 335 verticalShift += delta.height; |
| 332 | 336 |
| 337 // "Content Settings" and "Clear Browsing Data" are horizontally aligned. | |
| 338 if (view == contentSettingsButton) { | |
| 339 NSPoint origin = [clearDataButton frame].origin; | |
| 340 origin.x += delta.width; | |
| 341 [clearDataButton setFrameOrigin:origin]; | |
| 342 } | |
| 343 | |
| 333 // The Download Location controls go in a row with the button aligned to the | 344 // The Download Location controls go in a row with the button aligned to the |
| 334 // right edge and the path control using all the rest of the space. | 345 // right edge and the path control using all the rest of the space. |
| 335 if (view == downloadLocationButton) { | 346 if (view == downloadLocationButton) { |
| 336 NSPoint origin = [downloadLocationButton frame].origin; | 347 NSPoint origin = [downloadLocationButton frame].origin; |
| 337 origin.x -= delta.width; | 348 origin.x -= delta.width; |
| 338 [downloadLocationButton setFrameOrigin:origin]; | 349 [downloadLocationButton setFrameOrigin:origin]; |
| 339 NSSize controlSize = [downloadLocationControl frame].size; | 350 NSSize controlSize = [downloadLocationControl frame].size; |
| 340 controlSize.width -= delta.width; | 351 controlSize.width -= delta.width; |
| 341 [downloadLocationControl setFrameSize:controlSize]; | 352 [downloadLocationControl setFrameSize:controlSize]; |
| 342 } | 353 } |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 370 - (void)setShowHomeButton:(BOOL)value; | 381 - (void)setShowHomeButton:(BOOL)value; |
| 371 - (void)setShowPageOptionsButtons:(BOOL)value; | 382 - (void)setShowPageOptionsButtons:(BOOL)value; |
| 372 - (void)setPasswordManagerEnabledIndex:(NSInteger)value; | 383 - (void)setPasswordManagerEnabledIndex:(NSInteger)value; |
| 373 - (void)setFormAutofillEnabledIndex:(NSInteger)value; | 384 - (void)setFormAutofillEnabledIndex:(NSInteger)value; |
| 374 - (void)setIsUsingDefaultTheme:(BOOL)value; | 385 - (void)setIsUsingDefaultTheme:(BOOL)value; |
| 375 - (void)setShowAlternateErrorPages:(BOOL)value; | 386 - (void)setShowAlternateErrorPages:(BOOL)value; |
| 376 - (void)setUseSuggest:(BOOL)value; | 387 - (void)setUseSuggest:(BOOL)value; |
| 377 - (void)setDnsPrefetch:(BOOL)value; | 388 - (void)setDnsPrefetch:(BOOL)value; |
| 378 - (void)setSafeBrowsing:(BOOL)value; | 389 - (void)setSafeBrowsing:(BOOL)value; |
| 379 - (void)setMetricsRecording:(BOOL)value; | 390 - (void)setMetricsRecording:(BOOL)value; |
| 380 - (void)setCookieBehavior:(NSInteger)value; | |
| 381 - (void)setAskForSaveLocation:(BOOL)value; | 391 - (void)setAskForSaveLocation:(BOOL)value; |
| 382 - (void)displayPreferenceViewForPage:(OptionsPage)page | 392 - (void)displayPreferenceViewForPage:(OptionsPage)page |
| 383 animate:(BOOL)animate; | 393 animate:(BOOL)animate; |
| 384 @end | 394 @end |
| 385 | 395 |
| 386 // A C++ class registered for changes in preferences. Bridges the | 396 // A C++ class registered for changes in preferences. Bridges the |
| 387 // notification back to the PWC. | 397 // notification back to the PWC. |
| 388 class PrefObserverBridge : public NotificationObserver, | 398 class PrefObserverBridge : public NotificationObserver, |
| 389 public ProfileSyncServiceObserver { | 399 public ProfileSyncServiceObserver { |
| 390 public: | 400 public: |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 [underTheHoodView_ setFrameSize:underTheHoodSize]; | 719 [underTheHoodView_ setFrameSize:underTheHoodSize]; |
| 710 | 720 |
| 711 // Widen the Under the Hood content so things can rewrap to the full width. | 721 // Widen the Under the Hood content so things can rewrap to the full width. |
| 712 NSSize underTheHoodContentSize = [underTheHoodContentView_ frame].size; | 722 NSSize underTheHoodContentSize = [underTheHoodContentView_ frame].size; |
| 713 underTheHoodContentSize.width = [underTheHoodScroller_ contentSize].width; | 723 underTheHoodContentSize.width = [underTheHoodScroller_ contentSize].width; |
| 714 [underTheHoodContentView_ setFrameSize:underTheHoodContentSize]; | 724 [underTheHoodContentView_ setFrameSize:underTheHoodContentSize]; |
| 715 | 725 |
| 716 // Now that Under the Hood is the right width, auto-size to the new width to | 726 // Now that Under the Hood is the right width, auto-size to the new width to |
| 717 // get the final height. | 727 // get the final height. |
| 718 verticalShift = AutoSizeUnderTheHoodContent(underTheHoodContentView_, | 728 verticalShift = AutoSizeUnderTheHoodContent(underTheHoodContentView_, |
| 729 contentSettingsButton_, | |
| 730 clearDataButton_, | |
| 719 downloadLocationControl_, | 731 downloadLocationControl_, |
| 720 downloadLocationButton_); | 732 downloadLocationButton_); |
| 721 [GTMUILocalizerAndLayoutTweaker | 733 [GTMUILocalizerAndLayoutTweaker |
| 722 resizeViewWithoutAutoResizingSubViews:underTheHoodContentView_ | 734 resizeViewWithoutAutoResizingSubViews:underTheHoodContentView_ |
| 723 delta:NSMakeSize(0.0, verticalShift)]; | 735 delta:NSMakeSize(0.0, verticalShift)]; |
| 724 underTheHoodContentSize = [underTheHoodContentView_ frame].size; | 736 underTheHoodContentSize = [underTheHoodContentView_ frame].size; |
| 725 | 737 |
| 726 // Put the Under the Hood content view into the scroller and scroll it to the | 738 // Put the Under the Hood content view into the scroller and scroll it to the |
| 727 // top. | 739 // top. |
| 728 [underTheHoodScroller_ setDocumentView:underTheHoodContentView_]; | 740 [underTheHoodScroller_ setDocumentView:underTheHoodContentView_]; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 784 safeBrowsing_.Init(prefs::kSafeBrowsingEnabled, prefs_, observer_.get()); | 796 safeBrowsing_.Init(prefs::kSafeBrowsingEnabled, prefs_, observer_.get()); |
| 785 | 797 |
| 786 // During unit tests, there is no local state object, so we fall back to | 798 // During unit tests, there is no local state object, so we fall back to |
| 787 // the prefs object (where we've explicitly registered this pref so we | 799 // the prefs object (where we've explicitly registered this pref so we |
| 788 // know it's there). | 800 // know it's there). |
| 789 PrefService* local = g_browser_process->local_state(); | 801 PrefService* local = g_browser_process->local_state(); |
| 790 if (!local) | 802 if (!local) |
| 791 local = prefs_; | 803 local = prefs_; |
| 792 metricsRecording_.Init(prefs::kMetricsReportingEnabled, | 804 metricsRecording_.Init(prefs::kMetricsReportingEnabled, |
| 793 local, observer_.get()); | 805 local, observer_.get()); |
| 794 cookieBehavior_.Init(prefs::kCookieBehavior, prefs_, observer_.get()); | |
| 795 defaultDownloadLocation_.Init(prefs::kDownloadDefaultDirectory, prefs_, | 806 defaultDownloadLocation_.Init(prefs::kDownloadDefaultDirectory, prefs_, |
| 796 observer_.get()); | 807 observer_.get()); |
| 797 askForSaveLocation_.Init(prefs::kPromptForDownload, prefs_, observer_.get()); | 808 askForSaveLocation_.Init(prefs::kPromptForDownload, prefs_, observer_.get()); |
| 798 | 809 |
| 799 // We don't need to observe changes in this value. | 810 // We don't need to observe changes in this value. |
| 800 lastSelectedPage_.Init(prefs::kOptionsWindowLastTabIndex, local, NULL); | 811 lastSelectedPage_.Init(prefs::kOptionsWindowLastTabIndex, local, NULL); |
| 801 } | 812 } |
| 802 | 813 |
| 803 // Clean up what was registered in -registerPrefObservers. We only have to | 814 // Clean up what was registered in -registerPrefObservers. We only have to |
| 804 // clean up the non-PrefMember registrations. | 815 // clean up the non-PrefMember registrations. |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1249 personalDataManager->SetObserver(personalDataManagerObserver_.get()); | 1260 personalDataManager->SetObserver(personalDataManagerObserver_.get()); |
| 1250 } | 1261 } |
| 1251 } | 1262 } |
| 1252 | 1263 |
| 1253 // Called to import data from other browsers (Safari, Firefox, etc). | 1264 // Called to import data from other browsers (Safari, Firefox, etc). |
| 1254 - (IBAction)importData:(id)sender { | 1265 - (IBAction)importData:(id)sender { |
| 1255 UserMetrics::RecordAction("Import_ShowDlg", profile_); | 1266 UserMetrics::RecordAction("Import_ShowDlg", profile_); |
| 1256 [ImportSettingsDialogController showImportSettingsDialogForProfile:profile_]; | 1267 [ImportSettingsDialogController showImportSettingsDialogForProfile:profile_]; |
| 1257 } | 1268 } |
| 1258 | 1269 |
| 1259 // Called to clear user's browsing data. This puts up an application-modal | |
| 1260 // dialog to guide the user through clearing the data. | |
| 1261 - (IBAction)clearData:(id)sender { | |
| 1262 [ClearBrowsingDataController | |
| 1263 showClearBrowsingDialogForProfile:profile_]; | |
| 1264 } | |
| 1265 | |
| 1266 - (IBAction)resetThemeToDefault:(id)sender { | 1270 - (IBAction)resetThemeToDefault:(id)sender { |
| 1267 [self recordUserAction:"Options_ThemesReset"]; | 1271 [self recordUserAction:"Options_ThemesReset"]; |
| 1268 profile_->ClearTheme(); | 1272 profile_->ClearTheme(); |
| 1269 } | 1273 } |
| 1270 | 1274 |
| 1271 - (IBAction)themesGallery:(id)sender { | 1275 - (IBAction)themesGallery:(id)sender { |
| 1272 [self recordUserAction:"Options_ThemesGallery"]; | 1276 [self recordUserAction:"Options_ThemesGallery"]; |
| 1273 Browser* browser = | 1277 Browser* browser = |
| 1274 BrowserList::FindBrowserWithType(profile_, Browser::TYPE_NORMAL); | 1278 BrowserList::FindBrowserWithType(profile_, Browser::TYPE_NORMAL); |
| 1275 | 1279 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1387 } | 1391 } |
| 1388 else if (*prefName == prefs::kDnsPrefetchingEnabled) { | 1392 else if (*prefName == prefs::kDnsPrefetchingEnabled) { |
| 1389 [self setDnsPrefetch:dnsPrefetch_.GetValue() ? YES : NO]; | 1393 [self setDnsPrefetch:dnsPrefetch_.GetValue() ? YES : NO]; |
| 1390 } | 1394 } |
| 1391 else if (*prefName == prefs::kSafeBrowsingEnabled) { | 1395 else if (*prefName == prefs::kSafeBrowsingEnabled) { |
| 1392 [self setSafeBrowsing:safeBrowsing_.GetValue() ? YES : NO]; | 1396 [self setSafeBrowsing:safeBrowsing_.GetValue() ? YES : NO]; |
| 1393 } | 1397 } |
| 1394 else if (*prefName == prefs::kMetricsReportingEnabled) { | 1398 else if (*prefName == prefs::kMetricsReportingEnabled) { |
| 1395 [self setMetricsRecording:metricsRecording_.GetValue() ? YES : NO]; | 1399 [self setMetricsRecording:metricsRecording_.GetValue() ? YES : NO]; |
| 1396 } | 1400 } |
| 1397 else if (*prefName == prefs::kCookieBehavior) { | |
| 1398 [self setCookieBehavior:cookieBehavior_.GetValue()]; | |
| 1399 } | |
| 1400 else if (*prefName == prefs::kPromptForDownload) { | 1401 else if (*prefName == prefs::kPromptForDownload) { |
| 1401 [self setAskForSaveLocation:askForSaveLocation_.GetValue() ? YES : NO]; | 1402 [self setAskForSaveLocation:askForSaveLocation_.GetValue() ? YES : NO]; |
| 1402 } | 1403 } |
| 1403 } | 1404 } |
| 1404 | 1405 |
| 1405 // Set the new download path and notify the UI via KVO. | 1406 // Set the new download path and notify the UI via KVO. |
| 1406 - (void)downloadPathPanelDidEnd:(NSOpenPanel*)panel | 1407 - (void)downloadPathPanelDidEnd:(NSOpenPanel*)panel |
| 1407 code:(NSInteger)returnCode | 1408 code:(NSInteger)returnCode |
| 1408 context:(void*)context { | 1409 context:(void*)context { |
| 1409 if (returnCode == NSOKButton) { | 1410 if (returnCode == NSOKButton) { |
| 1410 [self recordUserAction:"Options_SetDownloadDirectory"]; | 1411 [self recordUserAction:"Options_SetDownloadDirectory"]; |
| 1411 NSURL* path = [[panel URLs] lastObject]; // We only allow 1 item. | 1412 NSURL* path = [[panel URLs] lastObject]; // We only allow 1 item. |
| 1412 [self willChangeValueForKey:@"defaultDownloadLocation"]; | 1413 [self willChangeValueForKey:@"defaultDownloadLocation"]; |
| 1413 defaultDownloadLocation_.SetValue(base::SysNSStringToWide([path path])); | 1414 defaultDownloadLocation_.SetValue(base::SysNSStringToWide([path path])); |
| 1414 [self didChangeValueForKey:@"defaultDownloadLocation"]; | 1415 [self didChangeValueForKey:@"defaultDownloadLocation"]; |
| 1415 } | 1416 } |
| 1416 } | 1417 } |
| 1417 | 1418 |
| 1418 // Shows the cookies controller. | |
| 1419 - (IBAction)showCookies:(id)sender { | |
| 1420 // The controller will clean itself up. | |
| 1421 BrowsingDataDatabaseHelper* databaseHelper = | |
| 1422 new BrowsingDataDatabaseHelper(profile_); | |
| 1423 BrowsingDataLocalStorageHelper* storageHelper = | |
| 1424 new BrowsingDataLocalStorageHelper(profile_); | |
| 1425 CookiesWindowController* controller = | |
| 1426 [[CookiesWindowController alloc] initWithProfile:profile_ | |
| 1427 databaseHelper:databaseHelper | |
| 1428 storageHelper:storageHelper]; | |
| 1429 [controller attachSheetTo:[self window]]; | |
| 1430 } | |
| 1431 | |
| 1432 // Bring up an open panel to allow the user to set a new downloads location. | 1419 // Bring up an open panel to allow the user to set a new downloads location. |
| 1433 - (void)browseDownloadLocation:(id)sender { | 1420 - (void)browseDownloadLocation:(id)sender { |
| 1434 NSOpenPanel* panel = [NSOpenPanel openPanel]; | 1421 NSOpenPanel* panel = [NSOpenPanel openPanel]; |
| 1435 [panel setAllowsMultipleSelection:NO]; | 1422 [panel setAllowsMultipleSelection:NO]; |
| 1436 [panel setCanChooseFiles:NO]; | 1423 [panel setCanChooseFiles:NO]; |
| 1437 [panel setCanChooseDirectories:YES]; | 1424 [panel setCanChooseDirectories:YES]; |
| 1438 NSString* path = base::SysWideToNSString(defaultDownloadLocation_.GetValue()); | 1425 NSString* path = base::SysWideToNSString(defaultDownloadLocation_.GetValue()); |
| 1439 [panel beginSheetForDirectory:path | 1426 [panel beginSheetForDirectory:path |
| 1440 file:nil | 1427 file:nil |
| 1441 types:nil | 1428 types:nil |
| 1442 modalForWindow:[self window] | 1429 modalForWindow:[self window] |
| 1443 modalDelegate:self | 1430 modalDelegate:self |
| 1444 didEndSelector:@selector(downloadPathPanelDidEnd:code:context:) | 1431 didEndSelector:@selector(downloadPathPanelDidEnd:code:context:) |
| 1445 contextInfo:NULL]; | 1432 contextInfo:NULL]; |
| 1446 } | 1433 } |
| 1447 | 1434 |
| 1435 // Called to clear user's browsing data. This puts up an application-modal | |
| 1436 // dialog to guide the user through clearing the data. | |
| 1437 - (IBAction)clearData:(id)sender { | |
| 1438 [ClearBrowsingDataController | |
| 1439 showClearBrowsingDialogForProfile:profile_]; | |
| 1440 } | |
| 1441 | |
| 1442 // Opens the "Content Settings" dialog. | |
| 1443 - (IBAction)showContentSettings:(id)sender { | |
| 1444 [ContentSettingsDialogController | |
| 1445 showContentSettingsForType:CONTENT_SETTINGS_TYPE_DEFAULT | |
| 1446 profile:profile_]; | |
| 1447 } | |
| 1448 | |
| 1448 - (IBAction)privacyLearnMore:(id)sender { | 1449 - (IBAction)privacyLearnMore:(id)sender { |
| 1449 // We open a new browser window so the Options dialog doesn't get lost | 1450 // We open a new browser window so the Options dialog doesn't get lost |
| 1450 // behind other windows. | 1451 // behind other windows. |
| 1451 Browser* browser = Browser::Create(profile_); | 1452 Browser* browser = Browser::Create(profile_); |
| 1452 browser->OpenURL(GURL(l10n_util::GetStringUTF16(IDS_LEARN_MORE_PRIVACY_URL)), | 1453 browser->OpenURL(GURL(l10n_util::GetStringUTF16(IDS_LEARN_MORE_PRIVACY_URL)), |
| 1453 GURL(), NEW_WINDOW, PageTransition::LINK); | 1454 GURL(), NEW_WINDOW, PageTransition::LINK); |
| 1454 } | 1455 } |
| 1455 | 1456 |
| 1456 // Returns whether the alternate error page checkbox should be checked based | 1457 // Returns whether the alternate error page checkbox should be checked based |
| 1457 // on the preference. | 1458 // on the preference. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1557 metrics->Start(); | 1558 metrics->Start(); |
| 1558 else | 1559 else |
| 1559 metrics->Stop(); | 1560 metrics->Stop(); |
| 1560 } | 1561 } |
| 1561 | 1562 |
| 1562 // TODO(pinkerton): windows shows a dialog here telling the user they need to | 1563 // TODO(pinkerton): windows shows a dialog here telling the user they need to |
| 1563 // restart for this to take effect. http://crbug.com/34653 | 1564 // restart for this to take effect. http://crbug.com/34653 |
| 1564 metricsRecording_.SetValue(enabled); | 1565 metricsRecording_.SetValue(enabled); |
| 1565 } | 1566 } |
| 1566 | 1567 |
| 1567 // Returns the index of the cookie popup based on the preference. | |
| 1568 - (NSInteger)cookieBehavior { | |
| 1569 return cookieBehavior_.GetValue(); | |
| 1570 } | |
| 1571 | |
| 1572 // Sets the backend pref for whether or not to accept cookies based on |index|. | |
| 1573 - (void)setCookieBehavior:(NSInteger)index { | |
| 1574 // TODO(darin): Remove everything else related to this setter. | |
| 1575 // http://crbug.com/34656 | |
| 1576 } | |
| 1577 | |
| 1578 - (NSURL*)defaultDownloadLocation { | 1568 - (NSURL*)defaultDownloadLocation { |
| 1579 NSString* pathString = | 1569 NSString* pathString = |
| 1580 base::SysWideToNSString(defaultDownloadLocation_.GetValue()); | 1570 base::SysWideToNSString(defaultDownloadLocation_.GetValue()); |
| 1581 return [NSURL fileURLWithPath:pathString]; | 1571 return [NSURL fileURLWithPath:pathString]; |
| 1582 } | 1572 } |
| 1583 | 1573 |
| 1584 - (BOOL)askForSaveLocation { | 1574 - (BOOL)askForSaveLocation { |
| 1585 return askForSaveLocation_.GetValue(); | 1575 return askForSaveLocation_.GetValue(); |
| 1586 } | 1576 } |
| 1587 | 1577 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1900 case OPTIONS_PAGE_ADVANCED: | 1890 case OPTIONS_PAGE_ADVANCED: |
| 1901 return underTheHoodView_; | 1891 return underTheHoodView_; |
| 1902 case OPTIONS_PAGE_DEFAULT: | 1892 case OPTIONS_PAGE_DEFAULT: |
| 1903 case OPTIONS_PAGE_COUNT: | 1893 case OPTIONS_PAGE_COUNT: |
| 1904 LOG(DFATAL) << "Invalid page value " << page; | 1894 LOG(DFATAL) << "Invalid page value " << page; |
| 1905 } | 1895 } |
| 1906 return basicsView_; | 1896 return basicsView_; |
| 1907 } | 1897 } |
| 1908 | 1898 |
| 1909 @end | 1899 @end |
| OLD | NEW |