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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm

Issue 2408613002: Replace kPreferHtmlOverPlugins feature checks with PluginUtils::ShouldPreferHtmlOverPlugi… (Closed)
Patch Set: Replace remaining kPreferHtmlOverPlugins feature checks with PluginUtils::ShouldPreferHtmlOverPlugi… Created 4 years, 2 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
OLDNEW
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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } else { 229 } else {
230 [self initializeContents]; 230 [self initializeContents];
231 } 231 }
232 232
233 bridge_.reset(bridge); 233 bridge_.reset(bridge);
234 bridge_->set_bubble_controller(self); 234 bridge_->set_bubble_controller(self);
235 } 235 }
236 return self; 236 return self;
237 } 237 }
238 238
239 - (Profile*)profile {
240 return Profile::FromBrowserContext(webContents_->GetBrowserContext());
241 }
242
239 - (void)windowWillClose:(NSNotification*)notification { 243 - (void)windowWillClose:(NSNotification*)notification {
240 if (presenter_.get()) 244 if (presenter_.get())
241 presenter_->OnUIClosing(); 245 presenter_->OnUIClosing();
242 presenter_.reset(); 246 presenter_.reset();
243 [super windowWillClose:notification]; 247 [super windowWillClose:notification];
244 } 248 }
245 249
246 - (void)setPresenter:(WebsiteSettings*)presenter { 250 - (void)setPresenter:(WebsiteSettings*)presenter {
247 presenter_.reset(presenter); 251 presenter_.reset(presenter);
248 } 252 }
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698