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

Side by Side Diff: chrome/browser/cocoa/content_settings_dialog_controller.mm

Issue 2534001: Mac: Change content settings from showing tabs on top to showing a list on the side. (Closed)
Patch Set: commenst Created 10 years, 6 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 unified diff | Download patch
« no previous file with comments | « chrome/app/nibs/ContentSettings.xib ('k') | chrome/browser/cocoa/tab_view_picker_table.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/content_settings_dialog_controller.h" 5 #import "chrome/browser/cocoa/content_settings_dialog_controller.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/mac_util.h" 10 #include "base/mac_util.h"
(...skipping 26 matching lines...) Expand all
37 37
38 // Stores the currently visible content settings dialog, if any. 38 // Stores the currently visible content settings dialog, if any.
39 ContentSettingsDialogController* g_instance = nil; 39 ContentSettingsDialogController* g_instance = nil;
40 40
41 // Indices of the various geolocation settings in the geolocation radio group. 41 // Indices of the various geolocation settings in the geolocation radio group.
42 const NSInteger kGeolocationEnabledIndex = 0; 42 const NSInteger kGeolocationEnabledIndex = 0;
43 const NSInteger kGeolocationAskIndex = 1; 43 const NSInteger kGeolocationAskIndex = 1;
44 const NSInteger kGeolocationDisabledIndex = 2; 44 const NSInteger kGeolocationDisabledIndex = 2;
45 45
46 // Walks views in top-down order, wraps each to their current width, and moves 46 // Walks views in top-down order, wraps each to their current width, and moves
47 // the latter ones down to prevernt overlaps. 47 // the latter ones down to prevent overlaps.
48 CGFloat VerticallyReflowGroup(NSArray* views) { 48 CGFloat VerticallyReflowGroup(NSArray* views) {
49 views = [views sortedArrayUsingFunction:cocoa_l10n_util::CompareFrameY 49 views = [views sortedArrayUsingFunction:cocoa_l10n_util::CompareFrameY
50 context:NULL]; 50 context:NULL];
51 CGFloat localVerticalShift = 0; 51 CGFloat localVerticalShift = 0;
52 for (NSInteger index = [views count] - 1; index >= 0; --index) { 52 for (NSInteger index = [views count] - 1; index >= 0; --index) {
53 NSView* view = [views objectAtIndex:index]; 53 NSView* view = [views objectAtIndex:index];
54
55 // Since the tab pane is in a horizontal resizer in IB, it's convenient
56 // to give all the subviews flexible width so that their sizes are
57 // autoupdated in IB. However, in chrome, the subviews shouldn't have
58 // flexible widths as this looks weird.
59 [view setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
60
54 NSSize delta = cocoa_l10n_util::WrapOrSizeToFit(view); 61 NSSize delta = cocoa_l10n_util::WrapOrSizeToFit(view);
55 localVerticalShift += delta.height; 62 localVerticalShift += delta.height;
56 if (localVerticalShift) { 63 if (localVerticalShift) {
57 NSPoint origin = [view frame].origin; 64 NSPoint origin = [view frame].origin;
58 origin.y -= localVerticalShift; 65 origin.y -= localVerticalShift;
59 [view setFrameOrigin:origin]; 66 [view setFrameOrigin:origin];
60 } 67 }
61 } 68 }
62 return localVerticalShift; 69 return localVerticalShift;
63 } 70 }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 case CONTENT_SETTING_ALLOW: return kGeolocationEnabledIndex; 410 case CONTENT_SETTING_ALLOW: return kGeolocationEnabledIndex;
404 case CONTENT_SETTING_ASK: return kGeolocationAskIndex; 411 case CONTENT_SETTING_ASK: return kGeolocationAskIndex;
405 case CONTENT_SETTING_BLOCK: return kGeolocationDisabledIndex; 412 case CONTENT_SETTING_BLOCK: return kGeolocationDisabledIndex;
406 default: 413 default:
407 NOTREACHED(); 414 NOTREACHED();
408 return kGeolocationAskIndex; 415 return kGeolocationAskIndex;
409 } 416 }
410 } 417 }
411 418
412 @end 419 @end
OLDNEW
« no previous file with comments | « chrome/app/nibs/ContentSettings.xib ('k') | chrome/browser/cocoa/tab_view_picker_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698