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

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

Issue 11571010: fixed the DCHECK and also corrected the website setting UI for media (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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 <cmath> 7 #include <cmath>
8 8
9 #import <AppKit/AppKit.h> 9 #import <AppKit/AppKit.h>
10 10
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK)]; 886 l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_MENU_ITEM_BLOCK)];
887 [[button lastItem] setTag:CONTENT_SETTING_BLOCK]; 887 [[button lastItem] setTag:CONTENT_SETTING_BLOCK];
888 } 888 }
889 889
890 [button addItemWithTitle:l10n_util::GetNSStringF( 890 [button addItemWithTitle:l10n_util::GetNSStringF(
891 IDS_WEBSITE_SETTINGS_DEFAULT_PERMISSION_LABEL, 891 IDS_WEBSITE_SETTINGS_DEFAULT_PERMISSION_LABEL,
892 WebsiteSettingsUI::PermissionValueToUIString( 892 WebsiteSettingsUI::PermissionValueToUIString(
893 permissionInfo.default_setting))]; 893 permissionInfo.default_setting))];
894 [[button lastItem] setTag:CONTENT_SETTING_DEFAULT]; 894 [[button lastItem] setTag:CONTENT_SETTING_DEFAULT];
895 895
896 [button selectItemWithTag:permissionInfo.setting]; 896 if (permissionInfo.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM &&
markusheintz_ 2012/12/14 10:49:04 Sorry I think I miss some detail. Why do we need t
markusheintz_ 2012/12/14 15:10:04 Alrigth after discussing this offline via chat I'm
897 permissionInfo.setting == CONTENT_SETTING_ALLOW) {
898 // Show the default setting since MEDIASTREAM does not support allow yet.
899 [button selectItemWithTag:CONTENT_SETTING_DEFAULT];
900 } else {
901 [button selectItemWithTag:permissionInfo.setting];
902 }
897 903
898 // Set the button title. 904 // Set the button title.
899 scoped_nsobject<NSMenuItem> titleItem([[NSMenuItem alloc] init]); 905 scoped_nsobject<NSMenuItem> titleItem([[NSMenuItem alloc] init]);
900 string16 buttonTitle = WebsiteSettingsUI::PermissionActionToUIString( 906 string16 buttonTitle = WebsiteSettingsUI::PermissionActionToUIString(
901 permissionInfo.setting, 907 permissionInfo.setting,
902 permissionInfo.default_setting, 908 permissionInfo.default_setting,
903 permissionInfo.source); 909 permissionInfo.source);
904 [titleItem setTitle:base::SysUTF16ToNSString(buttonTitle)]; 910 [titleItem setTitle:base::SysUTF16ToNSString(buttonTitle)];
905 [[button cell] setUsesItemFromMenu:NO]; 911 [[button cell] setUsesItemFromMenu:NO];
906 [[button cell] setMenuItem:titleItem.get()]; 912 [[button cell] setMenuItem:titleItem.get()];
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 } 1119 }
1114 1120
1115 controlOrigin.y += kPermissionsTabSpacing; 1121 controlOrigin.y += kPermissionsTabSpacing;
1116 [cookiesView_ setFrameSize: 1122 [cookiesView_ setFrameSize:
1117 NSMakeSize(NSWidth([cookiesView_ frame]), controlOrigin.y)]; 1123 NSMakeSize(NSWidth([cookiesView_ frame]), controlOrigin.y)];
1118 1124
1119 [self performLayout]; 1125 [self performLayout];
1120 } 1126 }
1121 1127
1122 - (void)setPermissionInfo:(const PermissionInfoList&)permissionInfoList { 1128 - (void)setPermissionInfo:(const PermissionInfoList&)permissionInfoList {
1123 // The contents of the permissions view can cause the whole window to get
1124 // bigger, but currently permissions are always set before cookie info.
1125 // Check to make sure that's still the case.
1126 DCHECK_EQ(0U, [[cookiesView_ subviews] count]);
markusheintz_ 2012/12/14 10:49:04 Patrick Dubroy will fix the DCHECK issue and uploa
1127
1128 [permissionsView_ setSubviews:[NSArray array]]; 1129 [permissionsView_ setSubviews:[NSArray array]];
1129 NSPoint controlOrigin = NSMakePoint(kFramePadding, 0); 1130 NSPoint controlOrigin = NSMakePoint(kFramePadding, 0);
1130 1131
1131 string16 sectionTitle = l10n_util::GetStringUTF16( 1132 string16 sectionTitle = l10n_util::GetStringUTF16(
1132 IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS); 1133 IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS);
1133 NSTextField* header = [self addText:sectionTitle 1134 NSTextField* header = [self addText:sectionTitle
1134 withSize:[NSFont smallSystemFontSize] 1135 withSize:[NSFont smallSystemFontSize]
1135 bold:YES 1136 bold:YES
1136 toView:permissionsView_ 1137 toView:permissionsView_
1137 atPoint:controlOrigin]; 1138 atPoint:controlOrigin];
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 [bubble_controller_ setPermissionInfo:permission_info_list]; 1233 [bubble_controller_ setPermissionInfo:permission_info_list];
1233 } 1234 }
1234 1235
1235 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { 1236 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) {
1236 [bubble_controller_ setFirstVisit:first_visit]; 1237 [bubble_controller_ setFirstVisit:first_visit];
1237 } 1238 }
1238 1239
1239 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { 1240 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) {
1240 [bubble_controller_ setSelectedTab:tab_id]; 1241 [bubble_controller_ setSelectedTab:tab_id];
1241 } 1242 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698