Chromium Code Reviews| 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 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 } | 172 } |
| 173 | 173 |
| 174 - (void)deleteClicked:(id)sender { | 174 - (void)deleteClicked:(id)sender { |
| 175 callback_.Run(*objectInfo_); | 175 callback_.Run(*objectInfo_); |
| 176 } | 176 } |
| 177 | 177 |
| 178 @end | 178 @end |
| 179 | 179 |
| 180 @implementation WebsiteSettingsBubbleController | 180 @implementation WebsiteSettingsBubbleController |
| 181 | 181 |
| 182 - (Profile*)profile { | |
|
tapted
2016/10/11 02:22:16
nit: move after the initializer (line ~242)
raymes
2016/10/11 03:50:02
Done.
| |
| 183 return Profile::FromBrowserContext(webContents_->GetBrowserContext()); | |
| 184 } | |
| 185 | |
| 182 - (CGFloat)defaultWindowWidth { | 186 - (CGFloat)defaultWindowWidth { |
| 183 return kDefaultWindowWidth; | 187 return kDefaultWindowWidth; |
| 184 } | 188 } |
| 185 | 189 |
| 186 bool IsInternalURL(const GURL& url) { | 190 bool IsInternalURL(const GURL& url) { |
| 187 return url.SchemeIs(content::kChromeUIScheme) || | 191 return url.SchemeIs(content::kChromeUIScheme) || |
| 188 url.SchemeIs(extensions::kExtensionScheme) || | 192 url.SchemeIs(extensions::kExtensionScheme) || |
| 189 url.SchemeIs(content::kViewSourceScheme); | 193 url.SchemeIs(content::kViewSourceScheme); |
| 190 } | 194 } |
| 191 | 195 |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 | 734 |
| 731 GURL url = webContents_ ? webContents_->GetURL() : GURL(); | 735 GURL url = webContents_ ? webContents_->GetURL() : GURL(); |
| 732 __block WebsiteSettingsBubbleController* weakSelf = self; | 736 __block WebsiteSettingsBubbleController* weakSelf = self; |
| 733 PermissionMenuModel::ChangeCallback callback = | 737 PermissionMenuModel::ChangeCallback callback = |
| 734 base::BindBlock(^(const WebsiteSettingsUI::PermissionInfo& permission) { | 738 base::BindBlock(^(const WebsiteSettingsUI::PermissionInfo& permission) { |
| 735 [weakSelf onPermissionChanged:permission.type to:permission.setting]; | 739 [weakSelf onPermissionChanged:permission.type to:permission.setting]; |
| 736 }); | 740 }); |
| 737 base::scoped_nsobject<PermissionSelectorButton> button( | 741 base::scoped_nsobject<PermissionSelectorButton> button( |
| 738 [[PermissionSelectorButton alloc] initWithPermissionInfo:permissionInfo | 742 [[PermissionSelectorButton alloc] initWithPermissionInfo:permissionInfo |
| 739 forURL:url | 743 forURL:url |
| 740 withCallback:callback]); | 744 withCallback:callback |
| 745 profile:[self profile]]); | |
| 741 | 746 |
| 742 // Determine the largest possible size for this button. | 747 // Determine the largest possible size for this button. |
| 743 CGFloat maxTitleWidth = [button | 748 CGFloat maxTitleWidth = |
| 744 maxTitleWidthForContentSettingsType:permissionInfo.type | 749 [button maxTitleWidthForContentSettingsType:permissionInfo.type |
| 745 withDefaultSetting:permissionInfo.default_setting]; | 750 withDefaultSetting:permissionInfo.default_setting |
| 751 profile:[self profile]]; | |
| 746 | 752 |
| 747 // Ensure the containing view is large enough to contain the button with its | 753 // Ensure the containing view is large enough to contain the button with its |
| 748 // widest possible title. | 754 // widest possible title. |
| 749 NSRect containerFrame = [view frame]; | 755 NSRect containerFrame = [view frame]; |
| 750 containerFrame.size.width = | 756 containerFrame.size.width = |
| 751 std::max(NSWidth(containerFrame), | 757 std::max(NSWidth(containerFrame), |
| 752 point.x + maxTitleWidth + kSectionHorizontalPadding); | 758 point.x + maxTitleWidth + kSectionHorizontalPadding); |
| 753 [view setFrame:containerFrame]; | 759 [view setFrame:containerFrame]; |
| 754 [view addSubview:button.get()]; | 760 [view addSubview:button.get()]; |
| 755 return button.get(); | 761 return button.get(); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1191 void WebsiteSettingsUIBridge::SetPermissionInfo( | 1197 void WebsiteSettingsUIBridge::SetPermissionInfo( |
| 1192 const PermissionInfoList& permission_info_list, | 1198 const PermissionInfoList& permission_info_list, |
| 1193 const ChosenObjectInfoList& chosen_object_info_list) { | 1199 const ChosenObjectInfoList& chosen_object_info_list) { |
| 1194 [bubble_controller_ setPermissionInfo:permission_info_list | 1200 [bubble_controller_ setPermissionInfo:permission_info_list |
| 1195 andChosenObjects:chosen_object_info_list]; | 1201 andChosenObjects:chosen_object_info_list]; |
| 1196 } | 1202 } |
| 1197 | 1203 |
| 1198 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { | 1204 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { |
| 1199 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) | 1205 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) |
| 1200 } | 1206 } |
| OLD | NEW |