Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: chrome/browser/cocoa/preferences_window_controller.mm

Issue 650124: Mac: Move prefs around in preparation for the content settings window. (Closed)
Patch Set: done? Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/preferences_window_controller.mm
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm
index af59f2d53716cc1f1bece854fabaf053e461ea4d..810c670178d9a5eea95321e858f14d62ba624443 100644
--- a/chrome/browser/cocoa/preferences_window_controller.mm
+++ b/chrome/browser/cocoa/preferences_window_controller.mm
@@ -19,7 +19,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#import "chrome/browser/cocoa/clear_browsing_data_controller.h"
-#import "chrome/browser/cocoa/cookies_window_controller.h"
+#import "chrome/browser/cocoa/content_settings_dialog_controller.h"
#import "chrome/browser/cocoa/custom_home_pages_model.h"
#import "chrome/browser/cocoa/font_language_settings_controller.h"
#import "chrome/browser/cocoa/import_settings_dialog.h"
@@ -311,8 +311,12 @@ void RemoveGroupFromView(NSView* view, NSArray* toRemove) {
// Helper to tweak the layout of the "Under the Hood" content by autosizing all
// the views and moving things up vertically. Special case the two controls for
-// download location as they are horizontal, and should fill the row.
+// download location as they are horizontal, and should fill the row. Special
+// case "Content Settings" and "Clear browsing data" as they are horizontal as
+// well.
CGFloat AutoSizeUnderTheHoodContent(NSView* view,
+ NSButton* contentSettingsButton,
+ NSButton* clearDataButton,
NSPathControl* downloadLocationControl,
NSButton* downloadLocationButton) {
CGFloat verticalShift = 0.0;
@@ -330,6 +334,13 @@ CGFloat AutoSizeUnderTheHoodContent(NSView* view,
}
verticalShift += delta.height;
+ // "Content Settings" and "Clear Browsing Data" are horizontally aligned.
+ if (view == contentSettingsButton) {
+ NSPoint origin = [clearDataButton frame].origin;
+ origin.x += delta.width;
+ [clearDataButton setFrameOrigin:origin];
+ }
+
// The Download Location controls go in a row with the button aligned to the
// right edge and the path control using all the rest of the space.
if (view == downloadLocationButton) {
@@ -377,7 +388,6 @@ CGFloat AutoSizeUnderTheHoodContent(NSView* view,
- (void)setDnsPrefetch:(BOOL)value;
- (void)setSafeBrowsing:(BOOL)value;
- (void)setMetricsRecording:(BOOL)value;
-- (void)setCookieBehavior:(NSInteger)value;
- (void)setAskForSaveLocation:(BOOL)value;
- (void)displayPreferenceViewForPage:(OptionsPage)page
animate:(BOOL)animate;
@@ -716,6 +726,8 @@ void PersonalDataManagerObserver::ShowAutoFillDialog(
// Now that Under the Hood is the right width, auto-size to the new width to
// get the final height.
verticalShift = AutoSizeUnderTheHoodContent(underTheHoodContentView_,
+ contentSettingsButton_,
+ clearDataButton_,
downloadLocationControl_,
downloadLocationButton_);
[GTMUILocalizerAndLayoutTweaker
@@ -791,7 +803,6 @@ void PersonalDataManagerObserver::ShowAutoFillDialog(
local = prefs_;
metricsRecording_.Init(prefs::kMetricsReportingEnabled,
local, observer_.get());
- cookieBehavior_.Init(prefs::kCookieBehavior, prefs_, observer_.get());
defaultDownloadLocation_.Init(prefs::kDownloadDefaultDirectory, prefs_,
observer_.get());
askForSaveLocation_.Init(prefs::kPromptForDownload, prefs_, observer_.get());
@@ -1256,13 +1267,6 @@ const int kDisabledIndex = 1;
[ImportSettingsDialogController showImportSettingsDialogForProfile:profile_];
}
-// Called to clear user's browsing data. This puts up an application-modal
-// dialog to guide the user through clearing the data.
-- (IBAction)clearData:(id)sender {
- [ClearBrowsingDataController
- showClearBrowsingDialogForProfile:profile_];
-}
-
- (IBAction)resetThemeToDefault:(id)sender {
[self recordUserAction:"Options_ThemesReset"];
profile_->ClearTheme();
@@ -1394,9 +1398,6 @@ const int kDisabledIndex = 1;
else if (*prefName == prefs::kMetricsReportingEnabled) {
[self setMetricsRecording:metricsRecording_.GetValue() ? YES : NO];
}
- else if (*prefName == prefs::kCookieBehavior) {
- [self setCookieBehavior:cookieBehavior_.GetValue()];
- }
else if (*prefName == prefs::kPromptForDownload) {
[self setAskForSaveLocation:askForSaveLocation_.GetValue() ? YES : NO];
}
@@ -1415,20 +1416,6 @@ const int kDisabledIndex = 1;
}
}
-// Shows the cookies controller.
-- (IBAction)showCookies:(id)sender {
- // The controller will clean itself up.
- BrowsingDataDatabaseHelper* databaseHelper =
- new BrowsingDataDatabaseHelper(profile_);
- BrowsingDataLocalStorageHelper* storageHelper =
- new BrowsingDataLocalStorageHelper(profile_);
- CookiesWindowController* controller =
- [[CookiesWindowController alloc] initWithProfile:profile_
- databaseHelper:databaseHelper
- storageHelper:storageHelper];
- [controller attachSheetTo:[self window]];
-}
-
// Bring up an open panel to allow the user to set a new downloads location.
- (void)browseDownloadLocation:(id)sender {
NSOpenPanel* panel = [NSOpenPanel openPanel];
@@ -1445,6 +1432,20 @@ const int kDisabledIndex = 1;
contextInfo:NULL];
}
+// Called to clear user's browsing data. This puts up an application-modal
+// dialog to guide the user through clearing the data.
+- (IBAction)clearData:(id)sender {
+ [ClearBrowsingDataController
+ showClearBrowsingDialogForProfile:profile_];
+}
+
+// Opens the "Content Settings" dialog.
+- (IBAction)showContentSettings:(id)sender {
+ [ContentSettingsDialogController
+ showContentSettingsForType:CONTENT_SETTINGS_TYPE_DEFAULT
+ profile:profile_];
+}
+
- (IBAction)privacyLearnMore:(id)sender {
// We open a new browser window so the Options dialog doesn't get lost
// behind other windows.
@@ -1564,17 +1565,6 @@ const int kDisabledIndex = 1;
metricsRecording_.SetValue(enabled);
}
-// Returns the index of the cookie popup based on the preference.
-- (NSInteger)cookieBehavior {
- return cookieBehavior_.GetValue();
-}
-
-// Sets the backend pref for whether or not to accept cookies based on |index|.
-- (void)setCookieBehavior:(NSInteger)index {
- // TODO(darin): Remove everything else related to this setter.
- // http://crbug.com/34656
-}
-
- (NSURL*)defaultDownloadLocation {
NSString* pathString =
base::SysWideToNSString(defaultDownloadLocation_.GetValue());

Powered by Google App Engine
This is Rietveld 408576698