OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/cocoa/website_settings_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/website_settings_bubble_controller.h" |
6 | 6 |
7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
11 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 11 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
12 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
13 #include "content/public/browser/cert_store.h" | 13 #include "content/public/browser/cert_store.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "grit/theme_resources.h" | |
15 #include "grit/ui_resources.h" | 16 #include "grit/ui_resources.h" |
16 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 17 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // The width of the window, in view coordinates. The height will be determined | 23 // The width of the window, in view coordinates. The height will be determined |
23 // by the content. | 24 // by the content. |
24 const CGFloat kWindowWidth = 380; | 25 const CGFloat kWindowWidth = 380; |
(...skipping 21 matching lines...) Expand all Loading... | |
46 // Width of the text fields. | 47 // Width of the text fields. |
47 const CGFloat kTextWidth = kWindowWidth - (kImageSize + kImageSpacing + | 48 const CGFloat kTextWidth = kWindowWidth - (kImageSize + kImageSpacing + |
48 kFramePadding * 2); | 49 kFramePadding * 2); |
49 | 50 |
50 // The amount of padding given to tab view contents. | 51 // The amount of padding given to tab view contents. |
51 const CGFloat kTabViewContentsPadding = kFramePadding; | 52 const CGFloat kTabViewContentsPadding = kFramePadding; |
52 | 53 |
53 // The spacing between individual items in the Permissions tab. | 54 // The spacing between individual items in the Permissions tab. |
54 const CGFloat kPermissionsTabSpacing = 8; | 55 const CGFloat kPermissionsTabSpacing = 8; |
55 | 56 |
57 // The extra space to the left of the first tab in the tab strip. | |
58 const CGFloat kTabStripXPadding = 19; | |
59 | |
60 // The amount of space between the visual borders of adjacent tabs. | |
61 const CGFloat kTabSpacing = 4; | |
62 | |
63 // The extra width outside the hit rect used by the visual borders of the tab. | |
64 const CGFloat kTabBorderExtraWidth = 16; | |
65 | |
66 // The height of the clickable area of the tab strip. | |
67 const CGFloat kTabHeight = 27; | |
68 | |
69 // The height of the background image for the tab strip. | |
70 const CGFloat kTabStripHeight = 44; | |
71 | |
72 // The amount of space above tab labels. | |
73 const CGFloat kTabLabelTopPadding = 20; | |
74 | |
75 // The amount of padding to leave on either side of the tab label. | |
76 const CGFloat kTabLabelXPadding = 12; | |
77 | |
56 // In the permission changing menu, the order of the menu items (which | 78 // In the permission changing menu, the order of the menu items (which |
57 // correspond to different content settings). | 79 // correspond to different content settings). |
58 const ContentSetting kPermissionsMenuSettings[] = { | 80 const ContentSetting kPermissionsMenuSettings[] = { |
59 CONTENT_SETTING_ALLOW, | 81 CONTENT_SETTING_ALLOW, |
60 CONTENT_SETTING_BLOCK, | 82 CONTENT_SETTING_BLOCK, |
61 CONTENT_SETTING_DEFAULT | 83 CONTENT_SETTING_DEFAULT |
62 }; | 84 }; |
63 | 85 |
64 } // namespace | 86 } // namespace |
65 | 87 |
66 // A simple container to hold all the contents of the website settings bubble. | 88 // A simple container to hold all the contents of the website settings bubble. |
67 // It uses a flipped coordinate system to make text layout easier. | 89 // It uses a flipped coordinate system to make text layout easier. |
68 @interface WebsiteSettingsContentView : NSView | 90 @interface WebsiteSettingsContentView : NSView |
69 @end | 91 @end |
70 @implementation WebsiteSettingsContentView | 92 @implementation WebsiteSettingsContentView |
71 - (BOOL)isFlipped { | 93 - (BOOL)isFlipped { |
72 return YES; | 94 return YES; |
73 } | 95 } |
74 @end | 96 @end |
75 | 97 |
98 @interface WebsiteSettingsTabSegmentedCell : NSSegmentedCell { | |
99 @private | |
100 scoped_nsobject<NSImage> tabBackgroundImage_; | |
101 scoped_nsobject<NSImage> tabCenterImage_; | |
102 scoped_nsobject<NSImage> tabLeftImage_; | |
103 scoped_nsobject<NSImage> tabRightImage_; | |
104 } | |
105 @end | |
106 @implementation WebsiteSettingsTabSegmentedCell | |
107 - (id)init { | |
108 if (self = [super init]) { | |
Robert Sesek
2012/07/31 00:11:38
nit: need extra () around this otherwise you'll li
Patrick Dubroy
2012/08/09 14:31:12
Done.
| |
109 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | |
110 tabBackgroundImage_.reset( | |
111 [rb.GetNativeImageNamed(IDR_WEBSITE_SETTINGS_TAB_BACKGROUND) retain]); | |
112 tabCenterImage_.reset( | |
113 [rb.GetNativeImageNamed(IDR_WEBSITE_SETTINGS_TAB_CENTER) retain]); | |
114 tabLeftImage_.reset( | |
115 [rb.GetNativeImageNamed(IDR_WEBSITE_SETTINGS_TAB_LEFT) retain]); | |
116 tabRightImage_.reset( | |
117 [rb.GetNativeImageNamed(IDR_WEBSITE_SETTINGS_TAB_RIGHT) retain]); | |
118 } | |
119 | |
Robert Sesek
2012/07/31 00:11:38
nit: no blank line
Patrick Dubroy
2012/08/09 14:31:12
Done.
| |
120 return self; | |
121 } | |
122 | |
123 - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { | |
124 // Draw the background for the tab strip. | |
125 NSDrawThreePartImage(cellFrame, | |
126 nil, | |
127 tabBackgroundImage_, | |
128 nil, | |
129 /*vertical=*/ NO, | |
130 NSCompositeSourceOver, | |
131 1, | |
132 /*flipped=*/ YES); | |
133 | |
134 // Draw the tab for the selected segment. The drawing area is slightly | |
135 // larger than the hit rect for the tab. | |
136 NSRect tabRect = [self hitRectForSegment:[self selectedSegment]]; | |
137 tabRect.origin.x -= kTabBorderExtraWidth; | |
138 tabRect.size.width += 2 * kTabBorderExtraWidth; | |
139 | |
140 tabRect.origin.y = 0; | |
141 tabRect.size.height = kTabStripHeight; | |
142 | |
143 NSDrawThreePartImage(tabRect, | |
144 tabLeftImage_, | |
145 tabCenterImage_, | |
146 tabRightImage_, | |
147 /*vertical=*/ NO, | |
148 NSCompositeSourceOver, | |
149 1, | |
150 /*flipped=*/ YES); | |
151 | |
152 // Call the superclass method to trigger drawing of the tab labels. | |
153 [self drawInteriorWithFrame:cellFrame inView:controlView]; | |
154 } | |
155 | |
156 // Return the hit rect (i.e., the visual bounds of the tab) for | |
157 // the given segment. | |
158 - (NSRect)hitRectForSegment:(NSInteger)segment { | |
159 NSRect rect = NSMakeRect(0, kTabStripHeight - kTabHeight, | |
160 [self widthForSegment:segment], kTabHeight); | |
161 for (int i = 0; i < segment; ++i) { | |
Robert Sesek
2012/07/31 00:11:38
segment is NSInteger
Patrick Dubroy
2012/08/09 14:31:12
Done.
| |
162 rect.origin.x += [self widthForSegment:i]; | |
163 } | |
164 int xAdjust = (segment == 0) ? kTabStripXPadding : 0; | |
165 rect.size.width = [self widthForSegment:segment] - kTabSpacing - xAdjust; | |
166 rect.origin.x += kTabSpacing / 2 + xAdjust; | |
167 | |
168 return rect; | |
169 } | |
170 | |
171 - (void)drawSegment:(NSInteger)segment | |
172 inFrame:(NSRect)frame | |
173 withView:(NSView*)controlView { | |
174 // Call the superclass to draw the label, adjusting the rectangle so that | |
175 // the label appears centered in the tab. | |
176 if (segment == 0) { | |
177 frame.origin.x += kTabStripXPadding / 2; | |
178 frame.size.width -= kTabStripXPadding; | |
179 } | |
180 frame.origin.y += kTabLabelTopPadding; | |
181 frame.size.height -= kTabLabelTopPadding; | |
182 [super drawSegment:segment inFrame:frame withView:controlView]; | |
183 } | |
184 | |
185 // Override the default tracking behavior to only respond to clicks inside the | |
186 // visual borders of the tab. | |
187 - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView { | |
188 NSInteger segmentCount = [self segmentCount]; | |
189 for (int i = 0; i < segmentCount; ++i) { | |
Robert Sesek
2012/07/31 00:11:38
NSInteger
Patrick Dubroy
2012/08/09 14:31:12
Done.
| |
190 if (NSPointInRect(startPoint, [self hitRectForSegment:i])) | |
191 return YES; | |
192 } | |
193 return NO; | |
194 } | |
195 | |
196 @end | |
197 | |
76 @implementation WebsiteSettingsBubbleController | 198 @implementation WebsiteSettingsBubbleController |
77 | 199 |
78 - (id)initWithParentWindow:(NSWindow*)parentWindow | 200 - (id)initWithParentWindow:(NSWindow*)parentWindow |
79 websiteSettingsUIBridge:(WebsiteSettingsUIBridge*)bridge { | 201 websiteSettingsUIBridge:(WebsiteSettingsUIBridge*)bridge { |
80 DCHECK(parentWindow); | 202 DCHECK(parentWindow); |
81 | 203 |
82 // Use an arbitrary height; it will be changed in performLayout. | 204 // Use an arbitrary height; it will be changed in performLayout. |
83 NSRect contentRect = NSMakeRect(0, 0, kWindowWidth, 1); | 205 NSRect contentRect = NSMakeRect(0, 0, kWindowWidth, 1); |
84 // Create an empty window into which content is placed. | 206 // Create an empty window into which content is placed. |
85 scoped_nsobject<InfoBubbleWindow> window( | 207 scoped_nsobject<InfoBubbleWindow> window( |
86 [[InfoBubbleWindow alloc] initWithContentRect:contentRect | 208 [[InfoBubbleWindow alloc] initWithContentRect:contentRect |
87 styleMask:NSBorderlessWindowMask | 209 styleMask:NSBorderlessWindowMask |
88 backing:NSBackingStoreBuffered | 210 backing:NSBackingStoreBuffered |
89 defer:NO]); | 211 defer:NO]); |
90 | 212 |
91 if ((self = [super initWithWindow:window.get() | 213 if ((self = [super initWithWindow:window.get() |
92 parentWindow:parentWindow | 214 parentWindow:parentWindow |
93 anchoredAt:NSZeroPoint])) { | 215 anchoredAt:NSZeroPoint])) { |
94 [[self bubble] setArrowLocation:info_bubble::kTopLeft]; | 216 [[self bubble] setArrowLocation:info_bubble::kTopLeft]; |
217 [[self bubble] setBackgroundColor:[NSColor colorWithCalibratedWhite:1.0 | |
218 alpha:1.0]]; | |
95 [self initializeContents]; | 219 [self initializeContents]; |
96 | 220 |
97 bridge_.reset(bridge); | 221 bridge_.reset(bridge); |
98 bridge_->set_bubble_controller(self); | 222 bridge_->set_bubble_controller(self); |
99 } | 223 } |
100 return self; | 224 return self; |
101 } | 225 } |
102 | 226 |
103 - (void)setPresenter:(WebsiteSettings*)presenter { | 227 - (void)setPresenter:(WebsiteSettings*)presenter { |
104 presenter_.reset(presenter); | 228 presenter_.reset(presenter); |
(...skipping 21 matching lines...) Expand all Loading... | |
126 | 250 |
127 // Create a text field to identity status (e.g. verified, not verified). | 251 // Create a text field to identity status (e.g. verified, not verified). |
128 identityStatusField_ = [self addText:string16() | 252 identityStatusField_ = [self addText:string16() |
129 withSize:[NSFont smallSystemFontSize] | 253 withSize:[NSFont smallSystemFontSize] |
130 bold:NO | 254 bold:NO |
131 toView:contentView_ | 255 toView:contentView_ |
132 atPoint:controlOrigin]; | 256 atPoint:controlOrigin]; |
133 | 257 |
134 // Create the tab view and its two tabs. | 258 // Create the tab view and its two tabs. |
135 | 259 |
260 NSRect initialFrame = NSMakeRect(0, 0, kWindowWidth, kTabStripHeight); | |
261 segmentedControl_.reset( | |
262 [[NSSegmentedControl alloc] initWithFrame:initialFrame]); | |
263 [segmentedControl_ setCell:[[WebsiteSettingsTabSegmentedCell alloc] init]]; | |
264 [segmentedControl_ setSegmentCount:2]; | |
265 [segmentedControl_ setTarget:self]; | |
266 [segmentedControl_ setAction:@selector(tabSelected:)]; | |
267 NSFont* smallSystemFont = | |
268 [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; | |
269 NSDictionary* textAttributes = | |
270 [NSDictionary dictionaryWithObject:smallSystemFont | |
271 forKey:NSFontAttributeName]; | |
272 | |
273 // Create the "Permissions" tab. | |
274 NSString* label = l10n_util::GetNSString( | |
275 IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS); | |
276 NSSize textSize = [label sizeWithAttributes:textAttributes]; | |
277 CGFloat tabWidth = textSize.width + 2 * kTabLabelXPadding; | |
278 [segmentedControl_ setLabel:label forSegment:0]; | |
279 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding forSegment:0]; | |
280 | |
281 // Create the "Connection" tab. | |
282 label = l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION); | |
283 textSize = [label sizeWithAttributes:textAttributes]; | |
284 [segmentedControl_ setLabel:label forSegment:1]; | |
285 | |
286 // Make both tabs the width of the widest. The first segment has some | |
287 // additional padding that is not part of the tab. | |
288 tabWidth = std::max(tabWidth, | |
289 textSize.width + 2 * kTabLabelXPadding); | |
290 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding forSegment:0]; | |
291 [segmentedControl_ setWidth:tabWidth forSegment:1]; | |
292 | |
293 [segmentedControl_ setFont:smallSystemFont]; | |
294 [segmentedControl_ setSelectedSegment:0]; | |
295 [contentView_ addSubview:segmentedControl_]; | |
296 | |
136 NSRect tabFrame = NSMakeRect(0, 0, kWindowWidth, 300); | 297 NSRect tabFrame = NSMakeRect(0, 0, kWindowWidth, 300); |
137 tabView_.reset([[NSTabView alloc] initWithFrame:tabFrame]); | 298 tabView_.reset([[NSTabView alloc] initWithFrame:tabFrame]); |
138 [tabView_ setTabViewType:NSTopTabsBezelBorder]; | 299 [tabView_ setTabViewType:NSNoTabsNoBorder]; |
300 [tabView_ setDrawsBackground:NO]; | |
139 [tabView_ setControlSize:NSSmallControlSize]; | 301 [tabView_ setControlSize:NSSmallControlSize]; |
140 [tabView_ setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; | |
141 [contentView_ addSubview:tabView_.get()]; | 302 [contentView_ addSubview:tabView_.get()]; |
142 | 303 |
143 permissionsContentView_ = [self addPermissionsTabToTabView:tabView_]; | 304 permissionsContentView_ = [self addPermissionsTabToTabView:tabView_]; |
144 [self addConnectionTabToTabView:tabView_]; | 305 [self addConnectionTabToTabView:tabView_]; |
145 | 306 |
146 // Replace the window's content. | 307 // Replace the window's content. |
147 [[[self window] contentView] setSubviews: | 308 [[[self window] contentView] setSubviews: |
148 [NSArray arrayWithObject:contentView_.get()]]; | 309 [NSArray arrayWithObject:contentView_.get()]]; |
149 | 310 |
150 [self performLayout]; | 311 [self performLayout]; |
151 } | 312 } |
152 | 313 |
153 // Create the contents of the Permissions tab and add it to the given tab view. | 314 // Create the contents of the Permissions tab and add it to the given tab view. |
154 // Returns a weak reference to the tab view item's view. | 315 // Returns a weak reference to the tab view item's view. |
155 - (NSView*)addPermissionsTabToTabView:(NSTabView*)tabView { | 316 - (NSView*)addPermissionsTabToTabView:(NSTabView*)tabView { |
156 scoped_nsobject<NSTabViewItem> item([[NSTabViewItem alloc] init]); | 317 scoped_nsobject<NSTabViewItem> item([[NSTabViewItem alloc] init]); |
157 [item setLabel: | |
158 l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS)]; | |
159 [tabView_ addTabViewItem:item.get()]; | 318 [tabView_ addTabViewItem:item.get()]; |
160 scoped_nsobject<NSView> contentView([[WebsiteSettingsContentView alloc] | 319 scoped_nsobject<NSView> contentView([[WebsiteSettingsContentView alloc] |
161 initWithFrame:[tabView_ contentRect]]); | 320 initWithFrame:[tabView_ contentRect]]); |
162 [item setView:contentView.get()]; | 321 [item setView:contentView.get()]; |
163 return contentView.get(); | 322 return contentView.get(); |
164 } | 323 } |
165 | 324 |
166 // Create the contents of the Connection tab and add it to the given tab view. | 325 // Create the contents of the Connection tab and add it to the given tab view. |
167 // Returns a weak reference to the tab view item's view. | 326 // Returns a weak reference to the tab view item's view. |
168 - (NSView*)addConnectionTabToTabView:(NSTabView*)tabView { | 327 - (NSView*)addConnectionTabToTabView:(NSTabView*)tabView { |
169 scoped_nsobject<NSTabViewItem> item([[NSTabViewItem alloc] init]); | 328 scoped_nsobject<NSTabViewItem> item([[NSTabViewItem alloc] init]); |
170 [item setLabel: | |
171 l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION)]; | |
172 | |
173 scoped_nsobject<NSView> contentView([[WebsiteSettingsContentView alloc] | 329 scoped_nsobject<NSView> contentView([[WebsiteSettingsContentView alloc] |
174 initWithFrame:[tabView_ contentRect]]); | 330 initWithFrame:[tabView_ contentRect]]); |
175 | 331 |
176 // Place all the text at the same position. It will be adjusted in | 332 // Place all the text at the same position. It will be adjusted in |
177 // performLayout. | 333 // performLayout. |
178 NSPoint textPosition = NSMakePoint( | 334 NSPoint textPosition = NSMakePoint( |
179 kTabViewContentsPadding + kImageSize + kImageSpacing, | 335 kTabViewContentsPadding + kImageSize + kImageSpacing, |
180 kTabViewContentsPadding); | 336 kTabViewContentsPadding); |
181 | 337 |
182 identityStatusIcon_ = | 338 identityStatusIcon_ = |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 | 416 |
261 // Lay out the last visit section. | 417 // Lay out the last visit section. |
262 [self setYPositionOfView:firstVisitIcon_ to:yPos]; | 418 [self setYPositionOfView:firstVisitIcon_ to:yPos]; |
263 [self sizeTextFieldHeightToFit:firstVisitHeaderField_]; | 419 [self sizeTextFieldHeightToFit:firstVisitHeaderField_]; |
264 yPos = [self setYPositionOfView:firstVisitHeaderField_ to:yPos]; | 420 yPos = [self setYPositionOfView:firstVisitHeaderField_ to:yPos]; |
265 yPos += kHeadlineSpacing; | 421 yPos += kHeadlineSpacing; |
266 [self sizeTextFieldHeightToFit:firstVisitDescriptionField_]; | 422 [self sizeTextFieldHeightToFit:firstVisitDescriptionField_]; |
267 [self setYPositionOfView:firstVisitDescriptionField_ to:yPos]; | 423 [self setYPositionOfView:firstVisitDescriptionField_ to:yPos]; |
268 | 424 |
269 // Adjust the tab view size and place it below the identity status. | 425 // Adjust the tab view size and place it below the identity status. |
426 | |
427 NSRect segmentedControlFrame = [segmentedControl_ frame]; | |
428 segmentedControlFrame.origin.y = | |
429 NSMaxY([identityStatusField_ frame]); | |
430 [segmentedControl_ setFrame:segmentedControlFrame]; | |
431 | |
270 NSRect tabViewFrame = [tabView_ frame]; | 432 NSRect tabViewFrame = [tabView_ frame]; |
271 tabViewFrame.origin.y = | 433 tabViewFrame.origin.y = NSMaxY(segmentedControlFrame); |
272 NSMaxY([identityStatusField_ frame]) + kVerticalSpacing; | |
273 | 434 |
274 CGFloat connectionTabHeight = std::max( | 435 CGFloat connectionTabHeight = std::max( |
275 NSMaxY([firstVisitDescriptionField_ frame]), | 436 NSMaxY([firstVisitDescriptionField_ frame]), |
276 NSMaxY([firstVisitIcon_ frame ])); | 437 NSMaxY([firstVisitIcon_ frame ])); |
277 connectionTabHeight += kVerticalSpacing; | 438 connectionTabHeight += kVerticalSpacing; |
278 | 439 |
279 CGFloat tabContentHeight = std::max(connectionTabHeight, | 440 CGFloat tabContentHeight = std::max(connectionTabHeight, |
280 permissionsTabHeight_); | 441 permissionsTabHeight_); |
281 tabViewFrame.size.height = tabContentHeight + | 442 tabViewFrame.size.height = tabContentHeight + |
282 NSHeight(tabViewFrame) - NSHeight([tabView_ contentRect]); | 443 NSHeight(tabViewFrame) - NSHeight([tabView_ contentRect]); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 | 623 |
463 [button setAction:@selector(permissionValueChanged:)]; | 624 [button setAction:@selector(permissionValueChanged:)]; |
464 [button setTarget:self]; | 625 [button setTarget:self]; |
465 | 626 |
466 [self setTitleOfButton:button]; | 627 [self setTitleOfButton:button]; |
467 | 628 |
468 [view addSubview:button.get()]; | 629 [view addSubview:button.get()]; |
469 return button.get(); | 630 return button.get(); |
470 } | 631 } |
471 | 632 |
633 - (void)tabSelected:(id)sender { | |
634 [tabView_ selectTabViewItemAtIndex:[segmentedControl_ selectedSegment]]; | |
635 } | |
636 | |
472 // Handler for the permission-changing menus. | 637 // Handler for the permission-changing menus. |
473 - (void)permissionValueChanged:(id)sender { | 638 - (void)permissionValueChanged:(id)sender { |
474 DCHECK([sender isKindOfClass:[NSPopUpButton class]]); | 639 DCHECK([sender isKindOfClass:[NSPopUpButton class]]); |
475 NSPopUpButton* button = static_cast<NSPopUpButton*>(sender); | 640 NSPopUpButton* button = static_cast<NSPopUpButton*>(sender); |
476 ContentSettingsType type = static_cast<ContentSettingsType>([button tag]); | 641 ContentSettingsType type = static_cast<ContentSettingsType>([button tag]); |
477 ContentSetting newSetting = [self contentSettingForButton:button]; | 642 ContentSetting newSetting = [self contentSettingForButton:button]; |
478 | 643 |
479 [self setTitleOfButton:button]; | 644 [self setTitleOfButton:button]; |
480 if (presenter_.get()) | 645 if (presenter_.get()) |
481 presenter_->OnSitePermissionChanged(type, newSetting); | 646 presenter_->OnSitePermissionChanged(type, newSetting); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 } | 775 } |
611 | 776 |
612 void WebsiteSettingsUIBridge::SetIdentityInfo( | 777 void WebsiteSettingsUIBridge::SetIdentityInfo( |
613 const WebsiteSettingsUI::IdentityInfo& identity_info) { | 778 const WebsiteSettingsUI::IdentityInfo& identity_info) { |
614 [bubble_controller_ setIdentityInfo:identity_info]; | 779 [bubble_controller_ setIdentityInfo:identity_info]; |
615 } | 780 } |
616 | 781 |
617 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { | 782 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { |
618 [bubble_controller_ setFirstVisit:first_visit]; | 783 [bubble_controller_ setFirstVisit:first_visit]; |
619 } | 784 } |
OLD | NEW |