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

Unified Diff: chrome/browser/ui/cocoa/subresource_filter/subresource_filter_bubble_controller.mm

Issue 2826233002: [subresource_filter] Mac UI updated and xib replaced with code based layout. (Closed)
Patch Set: Initial patch Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/subresource_filter/subresource_filter_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/subresource_filter/subresource_filter_bubble_controller.mm b/chrome/browser/ui/cocoa/subresource_filter/subresource_filter_bubble_controller.mm
new file mode 100644
index 0000000000000000000000000000000000000000..f4b3f000ddb288fe42450d81b8c7039fd86e6fd0
--- /dev/null
+++ b/chrome/browser/ui/cocoa/subresource_filter/subresource_filter_bubble_controller.mm
@@ -0,0 +1,78 @@
+// 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
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h"
+#import "chrome/browser/ui/cocoa/subresource_filter/subresource_filter_bubble_controller.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
+#import "chrome/browser/ui/cocoa/info_bubble_window.h"
+#include "components/strings/grit/components_strings.h"
+#include "ui/base/l10n/l10n_util_mac.h"
+
+@interface SubresourceFilterBubbleController (Private)
+- (void)loadView;
+@end
+
+@implementation SubresourceFilterBubbleController
+
+- (void)awakeFromNib {
+ [self loadView];
+ [super awakeFromNib];
+}
+
+- (void)loadView {
+ 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
+ [[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
+ [titleLabel_ setEditable:NO];
+ [titleLabel_ setBordered:NO];
+ [self.window.contentView addSubview:titleLabel_];
+
+ messageLabel_ =
+ [[NSTextField alloc] initWithFrame:NSMakeRect(18, 85, 282, 28)];
+ [messageLabel_ setEditable:NO];
+ [messageLabel_ setBordered:NO];
+ [self.window.contentView addSubview:messageLabel_];
+
+ manageCheckbox_ =
+ [[NSButton alloc] initWithFrame:NSMakeRect(18, 35, 282, 28)];
+ [manageCheckbox_ setButtonType:NSSwitchButton];
+ [self.window.contentView addSubview:manageCheckbox_];
+ [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
+
+ doneButton_ = [[NSButton alloc] initWithFrame:NSMakeRect(210, 10, 90, 28)];
+ [doneButton_ setBezelStyle:NSRoundedBezelStyle];
+ [doneButton_ highlight:YES];
+ [doneButton_ setTitle:l10n_util::GetNSString(IDS_OK)];
+ [self.window.contentView addSubview:doneButton_];
+ [doneButton_ setAction:@selector(closeBubble:)];
+}
+
+- (id)initWithModel:(ContentSettingBubbleModel*)contentSettingBubbleModel
+ webContents:(content::WebContents*)webContents
+ parentWindow:(NSWindow*)parentWindow
+ decoration:(ContentSettingDecoration*)decoration
+ anchoredAt:(NSPoint)anchoredAt {
+ NSRect contentRect = NSMakeRect(196, 376, 316, 154);
+ base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc]
+ initWithContentRect:contentRect
+ styleMask:NSBorderlessWindowMask
+ backing:NSBackingStoreBuffered
+ defer:NO]);
+
+ // Disable animations - otherwise, the window/controller will outlive the web
+ // contents it's associated with.
+ [window setAllowedAnimations:info_bubble::kAnimateNone];
+ [super initWithModel:contentSettingBubbleModel
+ webContents:webContents
+ window:window
+ parentWindow:parentWindow
+ decoration:decoration
+ anchoredAt:anchoredAt];
+ return self;
+}
+
+- (IBAction)manageCheckboxChecked:(id)sender {
+ [super manageCheckboxChecked:sender];
+ [super initManageDoneButtons];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698