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

Side by Side Diff: chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm

Issue 2826233002: [subresource_filter] Mac UI updated and xib replaced with code based layout. (Closed)
Patch Set: Initial patch Created 3 years, 7 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 (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/content_settings/content_setting_bubble_cocoa.h " 5 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h "
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/plugins/plugin_finder.h" 15 #include "chrome/browser/plugins/plugin_finder.h"
16 #include "chrome/browser/plugins/plugin_metadata.h" 16 #include "chrome/browser/plugins/plugin_metadata.h"
17 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 17 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
18 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
shivanisha 2017/05/03 18:10:35 removed this unused include
18 #import "chrome/browser/ui/cocoa/l10n_util.h" 19 #import "chrome/browser/ui/cocoa/l10n_util.h"
20 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h"
21 #import "chrome/browser/ui/cocoa/subresource_filter/subresource_filter_bubble_co ntroller.h"
19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 22 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
20 #include "chrome/browser/ui/content_settings/content_setting_media_menu_model.h" 23 #include "chrome/browser/ui/content_settings/content_setting_media_menu_model.h"
21 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h"
22 #include "chrome/grit/generated_resources.h" 24 #include "chrome/grit/generated_resources.h"
23 #include "components/content_settings/core/browser/host_content_settings_map.h" 25 #include "components/content_settings/core/browser/host_content_settings_map.h"
24 #include "content/public/browser/navigation_handle.h" 26 #include "content/public/browser/navigation_handle.h"
25 #include "content/public/browser/plugin_service.h" 27 #include "content/public/browser/plugin_service.h"
26 #include "content/public/browser/web_contents_observer.h" 28 #include "content/public/browser/web_contents_observer.h"
27 #include "skia/ext/skia_utils_mac.h" 29 #include "skia/ext/skia_utils_mac.h"
28 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h" 30 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h"
29 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" 31 #import "ui/base/cocoa/controls/hyperlink_button_cell.h"
32 #import "ui/base/cocoa/window_size_constants.h"
Robert Sesek 2017/05/02 21:51:47 Unused
shivanisha 2017/05/03 18:10:35 removed
30 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
31 34
32 using content::PluginService; 35 using content::PluginService;
33 36
34 namespace { 37 namespace {
35 38
36 // Height of one link in the popup list. 39 // Height of one link in the popup list.
37 const int kLinkHeight = 16; 40 const int kLinkHeight = 16;
38 41
39 // Space between two popup links. 42 // Space between two popup links.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // close up shop. 201 // close up shop.
199 [controller_ closeBubble:nil]; 202 [controller_ closeBubble:nil];
200 } 203 }
201 204
202 private: 205 private:
203 ContentSettingBubbleController* controller_; // weak 206 ContentSettingBubbleController* controller_; // weak
204 207
205 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleWebContentsObserverBridge); 208 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleWebContentsObserverBridge);
206 }; 209 };
207 210
208 @interface ContentSettingBubbleController(Private) 211 @interface ContentSettingBubbleController (Protected)
209 - (id)initWithModel:(ContentSettingBubbleModel*)settingsBubbleModel 212 - (id)initWithModel:(ContentSettingBubbleModel*)settingsBubbleModel
210 webContents:(content::WebContents*)webContents 213 webContents:(content::WebContents*)webContents
211 parentWindow:(NSWindow*)parentWindow 214 parentWindow:(NSWindow*)parentWindow
212 decoration:(ContentSettingDecoration*)decoration 215 decoration:(ContentSettingDecoration*)decoration
213 anchoredAt:(NSPoint)anchoredAt; 216 anchoredAt:(NSPoint)anchoredAt;
214 - (NSString*)getNibPathForModel:(ContentSettingBubbleModel*)model; 217 + (NSString*)getNibPathForModel:(ContentSettingBubbleModel*)model;
218 + (ContentSettingBubbleController*)getControllerForModel:
219 (ContentSettingBubbleModel*)model;
215 - (NSButton*)hyperlinkButtonWithFrame:(NSRect)frame 220 - (NSButton*)hyperlinkButtonWithFrame:(NSRect)frame
216 title:(NSString*)title 221 title:(NSString*)title
217 icon:(NSImage*)icon 222 icon:(NSImage*)icon
218 referenceFrame:(NSRect)referenceFrame; 223 referenceFrame:(NSRect)referenceFrame;
219 - (void)initializeBlockedPluginsList; 224 - (void)initializeBlockedPluginsList;
220 - (void)initializeTitle; 225 - (void)initializeTitle;
221 - (void)initializeMessage; 226 - (void)initializeMessage;
227 - (void)initalizeManageCheckbox;
222 - (void)initializeRadioGroup; 228 - (void)initializeRadioGroup;
223 - (void)initializeItemList; 229 - (void)initializeItemList;
224 - (void)initializeGeoLists; 230 - (void)initializeGeoLists;
225 - (void)initializeMediaMenus; 231 - (void)initializeMediaMenus;
226 - (void)initializeMIDISysExLists; 232 - (void)initializeMIDISysExLists;
227 - (void)sizeToFitLoadButton; 233 - (void)sizeToFitLoadButton;
228 - (void)initManageDoneButtons;
229 - (void)removeInfoButton; 234 - (void)removeInfoButton;
230 - (void)popupLinkClicked:(id)sender; 235 - (void)popupLinkClicked:(id)sender;
231 - (void)clearGeolocationForCurrentHost:(id)sender; 236 - (void)clearGeolocationForCurrentHost:(id)sender;
232 - (void)clearMIDISysExForCurrentHost:(id)sender; 237 - (void)clearMIDISysExForCurrentHost:(id)sender;
233 @end 238 @end
234 239
235 @implementation ContentSettingBubbleController 240 @implementation ContentSettingBubbleController
236 241
237 + (ContentSettingBubbleController*) 242 + (ContentSettingBubbleController*)
238 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel 243 showForModel:(ContentSettingBubbleModel*)contentSettingBubbleModel
239 webContents:(content::WebContents*)webContents 244 webContents:(content::WebContents*)webContents
240 parentWindow:(NSWindow*)parentWindow 245 parentWindow:(NSWindow*)parentWindow
241 decoration:(ContentSettingDecoration*)decoration 246 decoration:(ContentSettingDecoration*)decoration
242 anchoredAt:(NSPoint)anchor { 247 anchoredAt:(NSPoint)anchor {
243 // Autoreleases itself on bubble close. 248 ContentSettingBubbleController* controller =
244 return [[ContentSettingBubbleController alloc] 249 [self getControllerForModel:contentSettingBubbleModel];
245 initWithModel:contentSettingBubbleModel 250
246 webContents:webContents 251 DCHECK(controller);
247 parentWindow:parentWindow 252
248 decoration:decoration 253 return [controller initWithModel:contentSettingBubbleModel
249 anchoredAt:anchor]; 254 webContents:webContents
255 parentWindow:parentWindow
256 decoration:decoration
257 anchoredAt:anchor];
250 } 258 }
251 259
252 struct ContentTypeToNibPath { 260 struct ContentTypeToNibPath {
253 ContentSettingsType type; 261 ContentSettingsType type;
254 NSString* path; 262 NSString* path;
255 }; 263 };
256 264
257 const ContentTypeToNibPath kNibPaths[] = { 265 const ContentTypeToNibPath kNibPaths[] = {
258 {CONTENT_SETTINGS_TYPE_COOKIES, @"ContentBlockedCookies"}, 266 {CONTENT_SETTINGS_TYPE_COOKIES, @"ContentBlockedCookies"},
259 {CONTENT_SETTINGS_TYPE_IMAGES, @"ContentBlockedSimple"}, 267 {CONTENT_SETTINGS_TYPE_IMAGES, @"ContentBlockedSimple"},
(...skipping 11 matching lines...) Expand all
271 webContents:(content::WebContents*)webContents 279 webContents:(content::WebContents*)webContents
272 parentWindow:(NSWindow*)parentWindow 280 parentWindow:(NSWindow*)parentWindow
273 decoration:(ContentSettingDecoration*)decoration 281 decoration:(ContentSettingDecoration*)decoration
274 anchoredAt:(NSPoint)anchoredAt { 282 anchoredAt:(NSPoint)anchoredAt {
275 // This method takes ownership of |contentSettingBubbleModel| in all cases. 283 // This method takes ownership of |contentSettingBubbleModel| in all cases.
276 std::unique_ptr<ContentSettingBubbleModel> model(contentSettingBubbleModel); 284 std::unique_ptr<ContentSettingBubbleModel> model(contentSettingBubbleModel);
277 DCHECK(model.get()); 285 DCHECK(model.get());
278 observerBridge_.reset( 286 observerBridge_.reset(
279 new ContentSettingBubbleWebContentsObserverBridge(webContents, self)); 287 new ContentSettingBubbleWebContentsObserverBridge(webContents, self));
280 288
281 NSString* nibPath = [self getNibPathForModel:model.get()]; 289 NSString* nibPath =
290 [ContentSettingBubbleController getNibPathForModel:model.get()];
282 291
283 DCHECK_NE(0u, [nibPath length]); 292 DCHECK_NE(0u, [nibPath length]);
284 293
285 if ((self = [super initWithWindowNibPath:nibPath 294 if ((self = [super initWithWindowNibPath:nibPath
286 parentWindow:parentWindow 295 parentWindow:parentWindow
287 anchoredAt:anchoredAt])) { 296 anchoredAt:anchoredAt])) {
288 contentSettingBubbleModel_ = std::move(model); 297 contentSettingBubbleModel_ = std::move(model);
289 decoration_ = decoration; 298 decoration_ = decoration;
290 [self showWindow:nil]; 299 [self showWindow:nil];
291 } 300 }
292 return self; 301 return self;
293 } 302 }
294 303
295 - (NSString*)getNibPathForModel:(ContentSettingBubbleModel*)model { 304 - (id)initWithModel:(ContentSettingBubbleModel*)contentSettingBubbleModel
305 webContents:(content::WebContents*)webContents
306 window:(NSWindow*)window
307 parentWindow:(NSWindow*)parentWindow
308 decoration:(ContentSettingDecoration*)decoration
309 anchoredAt:(NSPoint)anchoredAt {
310 // This method takes ownership of |contentSettingBubbleModel| in all cases.
311 std::unique_ptr<ContentSettingBubbleModel> model(contentSettingBubbleModel);
312 DCHECK(model.get());
313 observerBridge_.reset(
314 new ContentSettingBubbleWebContentsObserverBridge(webContents, self));
315
316 contentSettingBubbleModel_ = std::move(model);
317
318 if ((self = [super initWithWindow:window
319 parentWindow:parentWindow
320 anchoredAt:anchoredAt])) {
321 decoration_ = decoration;
322 [self showWindow:nil];
323 NSRect newWindowFrame =
324 [window frameRectForContentRect:NSMakeRect(196, 376, 316, 134)];
Robert Sesek 2017/05/02 21:51:47 Why is this done here?
shivanisha 2017/05/03 18:10:35 Ah, remnant of earlier patch. Thanks, removed.
325
326 [window setFrame:newWindowFrame
327 display:YES
328 animate:[[self window] isVisible]];
329 }
330 return self;
331 }
332
333 + (NSString*)getNibPathForModel:(ContentSettingBubbleModel*)model {
296 NSString* nibPath = @""; 334 NSString* nibPath = @"";
297 335
298 ContentSettingSimpleBubbleModel* simple_bubble = model->AsSimpleBubbleModel(); 336 ContentSettingSimpleBubbleModel* simple_bubble = model->AsSimpleBubbleModel();
299 if (simple_bubble) { 337 if (simple_bubble) {
300 ContentSettingsType settingsType = simple_bubble->content_type(); 338 ContentSettingsType settingsType = simple_bubble->content_type();
301 339
302 for (const ContentTypeToNibPath& type_to_path : kNibPaths) { 340 for (const ContentTypeToNibPath& type_to_path : kNibPaths) {
303 if (settingsType == type_to_path.type) { 341 if (settingsType == type_to_path.type) {
304 nibPath = type_to_path.path; 342 nibPath = type_to_path.path;
305 break; 343 break;
306 } 344 }
307 } 345 }
308 } 346 }
309 347
310 if (model->AsMediaStreamBubbleModel()) 348 if (model->AsMediaStreamBubbleModel())
311 nibPath = @"ContentBlockedMedia"; 349 nibPath = @"ContentBlockedMedia";
312 350
313 if (model->AsSubresourceFilterBubbleModel())
314 nibPath = @"ContentSubresourceFilter";
315
316 if (model->AsDownloadsBubbleModel()) 351 if (model->AsDownloadsBubbleModel())
317 nibPath = @"ContentBlockedDownloads"; 352 nibPath = @"ContentBlockedDownloads";
318 return nibPath; 353 return nibPath;
319 } 354 }
320 355
356 + (ContentSettingBubbleController*)getControllerForModel:
Robert Sesek 2017/05/02 21:51:47 naming: call this allocControllerForModel: to make
shivanisha 2017/05/03 18:10:35 done
357 (ContentSettingBubbleModel*)model {
358 // Check if the view is expressed in xib file or not.
359 NSString* nibPath = [self getNibPathForModel:model];
360
361 // Autoreleases itself on bubble close.
362
363 if ([nibPath length] > 0u)
364 return [ContentSettingBubbleController alloc];
365
366 if (model->AsSubresourceFilterBubbleModel())
367 return [SubresourceFilterBubbleController alloc];
368
369 return nil;
370 }
371
321 - (void)initializeTitle { 372 - (void)initializeTitle {
322 if (!titleLabel_) 373 if (!titleLabel_)
323 return; 374 return;
324 375
325 NSString* label = base::SysUTF16ToNSString( 376 NSString* label = base::SysUTF16ToNSString(
326 contentSettingBubbleModel_->bubble_content().title); 377 contentSettingBubbleModel_->bubble_content().title);
327 [titleLabel_ setStringValue:label]; 378 [titleLabel_ setStringValue:label];
328 379
329 // Layout title post-localization. 380 // Layout title post-localization.
330 CGFloat deltaY = [GTMUILocalizerAndLayoutTweaker 381 CGFloat deltaY = [GTMUILocalizerAndLayoutTweaker
(...skipping 17 matching lines...) Expand all
348 CGFloat deltaY = [GTMUILocalizerAndLayoutTweaker 399 CGFloat deltaY = [GTMUILocalizerAndLayoutTweaker
349 sizeToFitFixedWidthTextField:messageLabel_]; 400 sizeToFitFixedWidthTextField:messageLabel_];
350 NSRect windowFrame = [[self window] frame]; 401 NSRect windowFrame = [[self window] frame];
351 windowFrame.size.height += deltaY; 402 windowFrame.size.height += deltaY;
352 [[self window] setFrame:windowFrame display:NO]; 403 [[self window] setFrame:windowFrame display:NO];
353 NSRect messageFrame = [messageLabel_ frame]; 404 NSRect messageFrame = [messageLabel_ frame];
354 messageFrame.origin.y -= deltaY; 405 messageFrame.origin.y -= deltaY;
355 [messageLabel_ setFrame:messageFrame]; 406 [messageLabel_ setFrame:messageFrame];
356 } 407 }
357 408
409 - (void)initalizeManageCheckbox {
Robert Sesek 2017/05/02 21:51:47 spelling: initialize
shivanisha 2017/05/03 18:10:35 done. Also moved this to the subclass
410 if (!manageCheckbox_)
411 return;
412
413 NSString* label = base::SysUTF16ToNSString(
414 contentSettingBubbleModel_->bubble_content().manage_text);
415 [manageCheckbox_ setTitle:label];
416
417 CGFloat deltaY =
418 [GTMUILocalizerAndLayoutTweaker sizeToFitView:manageCheckbox_].height;
419 NSRect windowFrame = [[self window] frame];
420 windowFrame.size.height += deltaY;
421 [[self window] setFrame:windowFrame display:NO];
422 NSRect manageCheckboxFrame = [manageCheckbox_ frame];
423 manageCheckboxFrame.origin.y -= deltaY;
424 [manageCheckbox_ setFrame:manageCheckboxFrame];
425 }
426
358 - (void)initializeRadioGroup { 427 - (void)initializeRadioGroup {
359 // NOTE! Tags in the xib files must match the order of the radio buttons 428 // NOTE! Tags in the xib files must match the order of the radio buttons
360 // passed in the radio_group and be 1-based, not 0-based. 429 // passed in the radio_group and be 1-based, not 0-based.
361 const ContentSettingBubbleModel::BubbleContent& bubble_content = 430 const ContentSettingBubbleModel::BubbleContent& bubble_content =
362 contentSettingBubbleModel_->bubble_content(); 431 contentSettingBubbleModel_->bubble_content();
363 const ContentSettingBubbleModel::RadioGroup& radio_group = 432 const ContentSettingBubbleModel::RadioGroup& radio_group =
364 bubble_content.radio_group; 433 bubble_content.radio_group;
365 434
366 // Xcode 5.1 Interface Builder doesn't allow a font property to be set for 435 // Xcode 5.1 Interface Builder doesn't allow a font property to be set for
367 // NSMatrix. The implementation of GTMUILocalizerAndLayoutTweaker assumes that 436 // NSMatrix. The implementation of GTMUILocalizerAndLayoutTweaker assumes that
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 2 * NSMinX([loadButton_ frame]); 831 2 * NSMinX([loadButton_ frame]);
763 if (NSWidth(windowFrame) < widthNeeded) { 832 if (NSWidth(windowFrame) < widthNeeded) {
764 windowFrame.size.width = widthNeeded; 833 windowFrame.size.width = widthNeeded;
765 [[self window] setFrame:windowFrame display:NO]; 834 [[self window] setFrame:windowFrame display:NO];
766 } 835 }
767 } 836 }
768 837
769 - (void)initManageDoneButtons { 838 - (void)initManageDoneButtons {
770 const ContentSettingBubbleModel::BubbleContent& content = 839 const ContentSettingBubbleModel::BubbleContent& content =
771 contentSettingBubbleModel_->bubble_content(); 840 contentSettingBubbleModel_->bubble_content();
772 [manageButton_ setTitle:base::SysUTF16ToNSString(content.manage_text)]; 841
773 [GTMUILocalizerAndLayoutTweaker sizeToFitView:[manageButton_ superview]]; 842 CGFloat requiredWidthForManageButton = 0.0;
843 if (manageButton_) {
844 [manageButton_ setTitle:base::SysUTF16ToNSString(content.manage_text)];
845 [GTMUILocalizerAndLayoutTweaker sizeToFitView:[manageButton_ superview]];
846 requiredWidthForManageButton =
847 NSMaxX([manageButton_ frame]) + kManageDonePadding;
848 }
849
850 if (!manageButton_ && !doneButton_)
851 return;
852
853 NSString* doneLabel = base::SysUTF16ToNSString(content.done_button_text);
854 if ([doneLabel length] > 0u)
855 [doneButton_ setTitle:doneLabel];
774 856
775 CGFloat actualWidth = NSWidth([[[self window] contentView] frame]); 857 CGFloat actualWidth = NSWidth([[[self window] contentView] frame]);
776 CGFloat requiredWidth = NSMaxX([manageButton_ frame]) + kManageDonePadding + 858 CGFloat requiredWidth = requiredWidthForManageButton +
777 NSWidth([[doneButton_ superview] frame]) - NSMinX([doneButton_ frame]); 859 NSWidth([[doneButton_ superview] frame]) -
860 NSMinX([doneButton_ frame]);
778 if (requiredWidth <= actualWidth || !doneButton_ || !manageButton_) 861 if (requiredWidth <= actualWidth || !doneButton_ || !manageButton_)
779 return; 862 return;
780 863
781 // Resize window, autoresizing takes care of the rest. 864 // Resize window, autoresizing takes care of the rest.
782 NSSize size = NSMakeSize(requiredWidth - actualWidth, 0); 865 NSSize size = NSMakeSize(requiredWidth - actualWidth, 0);
783 size = [[[self window] contentView] convertSize:size toView:nil]; 866 size = [[[self window] contentView] convertSize:size toView:nil];
784 NSRect frame = [[self window] frame]; 867 NSRect frame = [[self window] frame];
785 frame.origin.x -= size.width; 868 frame.origin.x -= size.width;
786 frame.size.width += size.width; 869 frame.size.width += size.width;
787 [[self window] setFrame:frame display:NO]; 870 [[self window] setFrame:frame display:NO];
788 } 871 }
789 872
790 - (void)awakeFromNib { 873 - (void)awakeFromNib {
791 [super awakeFromNib]; 874 [super awakeFromNib];
792 875
793 ContentSettingSimpleBubbleModel* simple_bubble = 876 ContentSettingSimpleBubbleModel* simple_bubble =
794 contentSettingBubbleModel_->AsSimpleBubbleModel(); 877 contentSettingBubbleModel_->AsSimpleBubbleModel();
795 878
796 [[self bubble] setArrowLocation:info_bubble::kTopTrailing]; 879 [[self bubble] setArrowLocation:info_bubble::kTopTrailing];
797 880
798 // Adapt window size to bottom buttons. Do this before all other layouting. 881 // Adapt window size to bottom buttons. Do this before all other layouting.
799 if ((simple_bubble && !simple_bubble->bubble_content().manage_text.empty()) || 882 if ((simple_bubble && !simple_bubble->bubble_content().manage_text.empty()) ||
800 contentSettingBubbleModel_->AsDownloadsBubbleModel()) 883 contentSettingBubbleModel_->AsDownloadsBubbleModel() ||
884 contentSettingBubbleModel_->AsSubresourceFilterBubbleModel())
Robert Sesek 2017/05/02 21:51:47 nit: add braces since the condition is multi-line
shivanisha 2017/05/03 18:10:35 done
801 [self initManageDoneButtons]; 885 [self initManageDoneButtons];
802 886
803 [self initializeTitle]; 887 [self initializeTitle];
804 [self initializeMessage]; 888 [self initializeMessage];
889 [self initalizeManageCheckbox];
805 890
806 // Note that the per-content-type methods and |initializeRadioGroup| below 891 // Note that the per-content-type methods and |initializeRadioGroup| below
807 // must be kept in the correct order, as they make interdependent adjustments 892 // must be kept in the correct order, as they make interdependent adjustments
808 // of the bubble's height. 893 // of the bubble's height.
809 if (simple_bubble && 894 if (simple_bubble &&
810 simple_bubble->content_type() == CONTENT_SETTINGS_TYPE_PLUGINS) { 895 simple_bubble->content_type() == CONTENT_SETTINGS_TYPE_PLUGINS) {
811 if (!simple_bubble->bubble_content().custom_link.empty()) 896 if (!simple_bubble->bubble_content().custom_link.empty())
812 [self sizeToFitLoadButton]; 897 [self sizeToFitLoadButton];
813 898
814 [self initializeBlockedPluginsList]; 899 [self initializeBlockedPluginsList];
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 980
896 - (IBAction)manageBlocking:(id)sender { 981 - (IBAction)manageBlocking:(id)sender {
897 contentSettingBubbleModel_->OnManageLinkClicked(); 982 contentSettingBubbleModel_->OnManageLinkClicked();
898 } 983 }
899 984
900 - (IBAction)closeBubble:(id)sender { 985 - (IBAction)closeBubble:(id)sender {
901 contentSettingBubbleModel_->OnDoneClicked(); 986 contentSettingBubbleModel_->OnDoneClicked();
902 [self close]; 987 [self close];
903 } 988 }
904 989
990 - (IBAction)manageCheckboxChecked:(id)sender {
991 bool is_checked = [sender state] == NSOnState;
Robert Sesek 2017/05/02 21:51:47 naming: isChecked (use camelCase in ObjC methods)
shivanisha 2017/05/03 18:10:35 done
992 contentSettingBubbleModel_->OnManageCheckboxChecked(is_checked);
993 }
994
905 - (IBAction)mediaMenuChanged:(id)sender { 995 - (IBAction)mediaMenuChanged:(id)sender {
906 NSPopUpButton* button = static_cast<NSPopUpButton*>(sender); 996 NSPopUpButton* button = static_cast<NSPopUpButton*>(sender);
907 auto it = mediaMenus_.find(sender); 997 auto it = mediaMenus_.find(sender);
908 DCHECK(it != mediaMenus_.end()); 998 DCHECK(it != mediaMenus_.end());
909 NSInteger index = [[button selectedItem] tag]; 999 NSInteger index = [[button selectedItem] tag];
910 1000
911 SetTitleForPopUpButton( 1001 SetTitleForPopUpButton(
912 button, base::SysUTF16ToNSString(it->second->model->GetLabelAt(index))); 1002 button, base::SysUTF16ToNSString(it->second->model->GetLabelAt(index)));
913 1003
914 it->second->model->ExecuteCommand(index, 0); 1004 it->second->model->ExecuteCommand(index, 0);
915 } 1005 }
916 1006
917 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { 1007 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus {
918 return &mediaMenus_; 1008 return &mediaMenus_;
919 } 1009 }
920 1010
921 - (LocationBarDecoration*)decorationForBubble { 1011 - (LocationBarDecoration*)decorationForBubble {
922 return decoration_; 1012 return decoration_;
923 } 1013 }
924 1014
925 @end // ContentSettingBubbleController 1015 @end // ContentSettingBubbleController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698