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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #import <AppKit/AppKit.h> | 9 #import <AppKit/AppKit.h> |
10 | 10 |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 [button setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; | 865 [button setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; |
866 [button setBordered:NO]; | 866 [button setBordered:NO]; |
867 [[button cell] setControlSize:NSSmallControlSize]; | 867 [[button cell] setControlSize:NSSmallControlSize]; |
868 [button setTag:permissionInfo.type]; | 868 [button setTag:permissionInfo.type]; |
869 [button setAction:@selector(permissionValueChanged:)]; | 869 [button setAction:@selector(permissionValueChanged:)]; |
870 [button setTarget:self]; | 870 [button setTarget:self]; |
871 | 871 |
872 // Create the popup menu. | 872 // Create the popup menu. |
873 // TODO(dubroy): Refactor this code to use PermissionMenuModel. | 873 // TODO(dubroy): Refactor this code to use PermissionMenuModel. |
874 | 874 |
875 // Media stream permission does not support "Always allow". | 875 // Media stream permission only support "Always allow" for https. |
876 // TODO(xians): Media supports "allow" for https but not for http. | 876 if (permissionInfo.type != CONTENT_SETTINGS_TYPE_MEDIASTREAM || |
877 if (permissionInfo.type != CONTENT_SETTINGS_TYPE_MEDIASTREAM) { | 877 (webContents_ && webContents_->GetURL().SchemeIsSecure())) { |
878 [button addItemWithTitle: | 878 [button addItemWithTitle: |
879 l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW)]; | 879 l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_MENU_ITEM_ALLOW)]; |
880 [[button lastItem] setTag:CONTENT_SETTING_ALLOW]; | 880 [[button lastItem] setTag:CONTENT_SETTING_ALLOW]; |
881 } | 881 } |
882 | 882 |
883 // Fullscreen does not support "Always block". | 883 // Fullscreen does not support "Always block". |
884 if (permissionInfo.type != CONTENT_SETTINGS_TYPE_FULLSCREEN) { | 884 if (permissionInfo.type != CONTENT_SETTINGS_TYPE_FULLSCREEN) { |
885 [button addItemWithTitle: | 885 [button addItemWithTitle: |
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]; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 [bubble_controller_ setPermissionInfo:permission_info_list]; | 1232 [bubble_controller_ setPermissionInfo:permission_info_list]; |
1233 } | 1233 } |
1234 | 1234 |
1235 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { | 1235 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { |
1236 [bubble_controller_ setFirstVisit:first_visit]; | 1236 [bubble_controller_ setFirstVisit:first_visit]; |
1237 } | 1237 } |
1238 | 1238 |
1239 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { | 1239 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { |
1240 [bubble_controller_ setSelectedTab:tab_id]; | 1240 [bubble_controller_ setSelectedTab:tab_id]; |
1241 } | 1241 } |
OLD | NEW |