OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
Robert Sesek
2017/05/02 21:51:48
2017
shivanisha
2017/05/03 18:10:36
done
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h " | |
6 #import "chrome/browser/ui/cocoa/subresource_filter/subresource_filter_bubble_co ntroller.h" | |
Robert Sesek
2017/05/02 21:51:48
This should come first in the #import/#include blo
shivanisha
2017/05/03 18:10:36
done
| |
7 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | |
8 #include "components/strings/grit/components_strings.h" | |
9 #include "ui/base/l10n/l10n_util_mac.h" | |
10 | |
11 @interface SubresourceFilterBubbleController (Private) | |
12 - (void)loadView; | |
13 @end | |
14 | |
15 @implementation SubresourceFilterBubbleController | |
16 | |
17 - (void)awakeFromNib { | |
18 [self loadView]; | |
19 [super awakeFromNib]; | |
20 } | |
21 | |
22 - (void)loadView { | |
23 titleLabel_ = | |
Robert Sesek
2017/05/02 21:51:48
Each instance variable that is alloc/init'd here n
shivanisha
2017/05/03 18:10:36
Done
| |
24 [[NSTextField alloc] initWithFrame:NSMakeRect(17, 120, 282, 14)]; | |
Robert Sesek
2017/05/02 21:51:48
Should the x coordinate here be 18, so it's left-a
shivanisha
2017/05/03 18:10:36
done
| |
25 [titleLabel_ setEditable:NO]; | |
26 [titleLabel_ setBordered:NO]; | |
27 [self.window.contentView addSubview:titleLabel_]; | |
28 | |
29 messageLabel_ = | |
30 [[NSTextField alloc] initWithFrame:NSMakeRect(18, 85, 282, 28)]; | |
31 [messageLabel_ setEditable:NO]; | |
32 [messageLabel_ setBordered:NO]; | |
33 [self.window.contentView addSubview:messageLabel_]; | |
34 | |
35 manageCheckbox_ = | |
36 [[NSButton alloc] initWithFrame:NSMakeRect(18, 35, 282, 28)]; | |
37 [manageCheckbox_ setButtonType:NSSwitchButton]; | |
38 [self.window.contentView addSubview:manageCheckbox_]; | |
39 [manageCheckbox_ setAction:@selector(manageCheckboxChecked:)]; | |
Robert Sesek
2017/05/02 21:51:48
Should the on/off state of the checkbox be set fro
shivanisha
2017/05/03 18:10:36
Good idea, though currently the logic is simple en
| |
40 | |
41 doneButton_ = [[NSButton alloc] initWithFrame:NSMakeRect(210, 10, 90, 28)]; | |
42 [doneButton_ setBezelStyle:NSRoundedBezelStyle]; | |
43 [doneButton_ highlight:YES]; | |
44 [doneButton_ setTitle:l10n_util::GetNSString(IDS_OK)]; | |
45 [self.window.contentView addSubview:doneButton_]; | |
46 [doneButton_ setAction:@selector(closeBubble:)]; | |
47 } | |
48 | |
49 - (id)initWithModel:(ContentSettingBubbleModel*)contentSettingBubbleModel | |
50 webContents:(content::WebContents*)webContents | |
51 parentWindow:(NSWindow*)parentWindow | |
52 decoration:(ContentSettingDecoration*)decoration | |
53 anchoredAt:(NSPoint)anchoredAt { | |
54 NSRect contentRect = NSMakeRect(196, 376, 316, 154); | |
55 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc] | |
56 initWithContentRect:contentRect | |
57 styleMask:NSBorderlessWindowMask | |
58 backing:NSBackingStoreBuffered | |
59 defer:NO]); | |
60 | |
61 // Disable animations - otherwise, the window/controller will outlive the web | |
62 // contents it's associated with. | |
63 [window setAllowedAnimations:info_bubble::kAnimateNone]; | |
64 [super initWithModel:contentSettingBubbleModel | |
65 webContents:webContents | |
66 window:window | |
67 parentWindow:parentWindow | |
68 decoration:decoration | |
69 anchoredAt:anchoredAt]; | |
70 return self; | |
71 } | |
72 | |
73 - (IBAction)manageCheckboxChecked:(id)sender { | |
74 [super manageCheckboxChecked:sender]; | |
75 [super initManageDoneButtons]; | |
76 } | |
77 | |
78 @end | |
OLD | NEW |