| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/website_settings_bubble_contro
ller.h" | 5 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro
ller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #import <AppKit/AppKit.h> | 9 #import <AppKit/AppKit.h> |
| 10 | 10 |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 __block WebsiteSettingsBubbleController* weakSelf = self; | 914 __block WebsiteSettingsBubbleController* weakSelf = self; |
| 915 PermissionMenuModel::ChangeCallback callback = | 915 PermissionMenuModel::ChangeCallback callback = |
| 916 base::BindBlock(^(const WebsiteSettingsUI::PermissionInfo& permission) { | 916 base::BindBlock(^(const WebsiteSettingsUI::PermissionInfo& permission) { |
| 917 [weakSelf onPermissionChanged:permission.type to:permission.setting]; | 917 [weakSelf onPermissionChanged:permission.type to:permission.setting]; |
| 918 }); | 918 }); |
| 919 base::scoped_nsobject<PermissionSelectorButton> button( | 919 base::scoped_nsobject<PermissionSelectorButton> button( |
| 920 [[PermissionSelectorButton alloc] initWithPermissionInfo:permissionInfo | 920 [[PermissionSelectorButton alloc] initWithPermissionInfo:permissionInfo |
| 921 forURL:url | 921 forURL:url |
| 922 withCallback:callback]); | 922 withCallback:callback]); |
| 923 // Determine the largest possible size for this button. | 923 // Determine the largest possible size for this button. |
| 924 CGFloat maxTitleWidth = | 924 CGFloat maxTitleWidth = [button |
| 925 [button maxTitleWidthWithDefaultSetting:permissionInfo.default_setting]; | 925 maxTitleWidthForContentSettingsType:permissionInfo.type |
| 926 withDefaultSetting:permissionInfo.default_setting]; |
| 926 | 927 |
| 927 // Ensure the containing view is large enough to contain the button with its | 928 // Ensure the containing view is large enough to contain the button with its |
| 928 // widest possible title. | 929 // widest possible title. |
| 929 NSRect containerFrame = [view frame]; | 930 NSRect containerFrame = [view frame]; |
| 930 containerFrame.size.width = std::max( | 931 containerFrame.size.width = std::max( |
| 931 NSWidth(containerFrame), point.x + maxTitleWidth + kFramePadding); | 932 NSWidth(containerFrame), point.x + maxTitleWidth + kFramePadding); |
| 932 [view setFrame:containerFrame]; | 933 [view setFrame:containerFrame]; |
| 933 [view addSubview:button.get()]; | 934 [view addSubview:button.get()]; |
| 934 return button.get(); | 935 return button.get(); |
| 935 } | 936 } |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 [bubble_controller_ setPermissionInfo:permission_info_list]; | 1255 [bubble_controller_ setPermissionInfo:permission_info_list]; |
| 1255 } | 1256 } |
| 1256 | 1257 |
| 1257 void WebsiteSettingsUIBridge::SetFirstVisit(const base::string16& first_visit) { | 1258 void WebsiteSettingsUIBridge::SetFirstVisit(const base::string16& first_visit) { |
| 1258 [bubble_controller_ setFirstVisit:first_visit]; | 1259 [bubble_controller_ setFirstVisit:first_visit]; |
| 1259 } | 1260 } |
| 1260 | 1261 |
| 1261 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { | 1262 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { |
| 1262 [bubble_controller_ setSelectedTab:tab_id]; | 1263 [bubble_controller_ setSelectedTab:tab_id]; |
| 1263 } | 1264 } |
| OLD | NEW |