| 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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 | 1103 |
| 1104 void WebsiteSettingsUIBridge::set_bubble_controller( | 1104 void WebsiteSettingsUIBridge::set_bubble_controller( |
| 1105 WebsiteSettingsBubbleController* controller) { | 1105 WebsiteSettingsBubbleController* controller) { |
| 1106 bubble_controller_ = controller; | 1106 bubble_controller_ = controller; |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 void WebsiteSettingsUIBridge::Show( | 1109 void WebsiteSettingsUIBridge::Show( |
| 1110 gfx::NativeWindow parent, | 1110 gfx::NativeWindow parent, |
| 1111 Profile* profile, | 1111 Profile* profile, |
| 1112 content::WebContents* web_contents, | 1112 content::WebContents* web_contents, |
| 1113 const GURL& url, | 1113 const GURL& virtual_url, |
| 1114 const security_state::SecurityStateModel::SecurityInfo& security_info) { | 1114 const security_state::SecurityStateModel::SecurityInfo& security_info) { |
| 1115 if (chrome::ToolkitViewsWebUIDialogsEnabled()) { | 1115 if (chrome::ToolkitViewsWebUIDialogsEnabled()) { |
| 1116 chrome::ShowWebsiteSettingsBubbleViewsAtPoint( | 1116 chrome::ShowWebsiteSettingsBubbleViewsAtPoint( |
| 1117 gfx::ScreenPointFromNSPoint(AnchorPointForWindow(parent)), profile, | 1117 gfx::ScreenPointFromNSPoint(AnchorPointForWindow(parent)), profile, |
| 1118 web_contents, url, security_info); | 1118 web_contents, virtual_url, security_info); |
| 1119 return; | 1119 return; |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 BubbleType bubble_type = WEB_PAGE; | 1122 BubbleType bubble_type = WEB_PAGE; |
| 1123 if (url.SchemeIs(content::kChromeUIScheme)) | 1123 if (virtual_url.SchemeIs(content::kChromeUIScheme)) |
| 1124 bubble_type = INTERNAL_PAGE; | 1124 bubble_type = INTERNAL_PAGE; |
| 1125 else if (url.SchemeIs(extensions::kExtensionScheme)) | 1125 else if (virtual_url.SchemeIs(extensions::kExtensionScheme)) |
| 1126 bubble_type = EXTENSION_PAGE; | 1126 bubble_type = EXTENSION_PAGE; |
| 1127 | 1127 |
| 1128 // Create the bridge. This will be owned by the bubble controller. | 1128 // Create the bridge. This will be owned by the bubble controller. |
| 1129 WebsiteSettingsUIBridge* bridge = new WebsiteSettingsUIBridge(web_contents); | 1129 WebsiteSettingsUIBridge* bridge = new WebsiteSettingsUIBridge(web_contents); |
| 1130 | 1130 |
| 1131 bool is_devtools_disabled = | 1131 bool is_devtools_disabled = |
| 1132 profile->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled); | 1132 profile->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled); |
| 1133 | 1133 |
| 1134 // Create the bubble controller. It will dealloc itself when it closes. | 1134 // Create the bubble controller. It will dealloc itself when it closes. |
| 1135 WebsiteSettingsBubbleController* bubble_controller = | 1135 WebsiteSettingsBubbleController* bubble_controller = |
| 1136 [[WebsiteSettingsBubbleController alloc] | 1136 [[WebsiteSettingsBubbleController alloc] |
| 1137 initWithParentWindow:parent | 1137 initWithParentWindow:parent |
| 1138 websiteSettingsUIBridge:bridge | 1138 websiteSettingsUIBridge:bridge |
| 1139 webContents:web_contents | 1139 webContents:web_contents |
| 1140 bubbleType:bubble_type | 1140 bubbleType:bubble_type |
| 1141 isDevToolsDisabled:is_devtools_disabled]; | 1141 isDevToolsDisabled:is_devtools_disabled]; |
| 1142 | 1142 |
| 1143 if (bubble_type == WEB_PAGE) { | 1143 if (bubble_type == WEB_PAGE) { |
| 1144 // Initialize the presenter, which holds the model and controls the UI. | 1144 // Initialize the presenter, which holds the model and controls the UI. |
| 1145 // This is also owned by the bubble controller. | 1145 // This is also owned by the bubble controller. |
| 1146 WebsiteSettings* presenter = new WebsiteSettings( | 1146 WebsiteSettings* presenter = new WebsiteSettings( |
| 1147 bridge, profile, | 1147 bridge, profile, |
| 1148 TabSpecificContentSettings::FromWebContents(web_contents), web_contents, | 1148 TabSpecificContentSettings::FromWebContents(web_contents), web_contents, |
| 1149 url, security_info, content::CertStore::GetInstance()); | 1149 virtual_url, security_info, content::CertStore::GetInstance()); |
| 1150 [bubble_controller setPresenter:presenter]; | 1150 [bubble_controller setPresenter:presenter]; |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 [bubble_controller showWindow:nil]; | 1153 [bubble_controller showWindow:nil]; |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 void WebsiteSettingsUIBridge::SetIdentityInfo( | 1156 void WebsiteSettingsUIBridge::SetIdentityInfo( |
| 1157 const WebsiteSettingsUI::IdentityInfo& identity_info) { | 1157 const WebsiteSettingsUI::IdentityInfo& identity_info) { |
| 1158 [bubble_controller_ setIdentityInfo:identity_info]; | 1158 [bubble_controller_ setIdentityInfo:identity_info]; |
| 1159 } | 1159 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1173 void WebsiteSettingsUIBridge::SetPermissionInfo( | 1173 void WebsiteSettingsUIBridge::SetPermissionInfo( |
| 1174 const PermissionInfoList& permission_info_list, | 1174 const PermissionInfoList& permission_info_list, |
| 1175 const ChosenObjectInfoList& chosen_object_info_list) { | 1175 const ChosenObjectInfoList& chosen_object_info_list) { |
| 1176 [bubble_controller_ setPermissionInfo:permission_info_list | 1176 [bubble_controller_ setPermissionInfo:permission_info_list |
| 1177 andChosenObjects:chosen_object_info_list]; | 1177 andChosenObjects:chosen_object_info_list]; |
| 1178 } | 1178 } |
| 1179 | 1179 |
| 1180 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { | 1180 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { |
| 1181 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) | 1181 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) |
| 1182 } | 1182 } |
| OLD | NEW |