summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/content_blocked_bubble_controller.h4
-rw-r--r--chrome/browser/cocoa/content_blocked_bubble_controller.mm54
2 files changed, 52 insertions, 6 deletions
diff --git a/chrome/browser/cocoa/content_blocked_bubble_controller.h b/chrome/browser/cocoa/content_blocked_bubble_controller.h
index 74b23ce..56f2313 100644
--- a/chrome/browser/cocoa/content_blocked_bubble_controller.h
+++ b/chrome/browser/cocoa/content_blocked_bubble_controller.h
@@ -29,6 +29,7 @@ typedef std::map<NSButton*, int> PopupLinks;
IBOutlet NSButton* manageButton_;
IBOutlet NSButton* doneButton_;
+ IBOutlet NSButton* loadAllPluginsButton_;
// The container for the bubble contents of the geolocation bubble.
IBOutlet NSView* contentsContainer_;
@@ -59,4 +60,7 @@ typedef std::map<NSButton*, int> PopupLinks;
// Callback for "info" link.
- (IBAction)showMoreInfo:(id)sender;
+// Callback for "load all plugins" button.
+- (IBAction)loadAllPlugins:(id)sender;
+
@end
diff --git a/chrome/browser/cocoa/content_blocked_bubble_controller.mm b/chrome/browser/cocoa/content_blocked_bubble_controller.mm
index 8f3d613..494a3c9 100644
--- a/chrome/browser/cocoa/content_blocked_bubble_controller.mm
+++ b/chrome/browser/cocoa/content_blocked_bubble_controller.mm
@@ -46,6 +46,10 @@ const int kGeoLabelHeight = 14;
// Height of the "Clear" button in the geolocation bubble.
const int kGeoClearButtonHeight = 17;
+// Padding between radio buttons and "Load all plugins" button
+// in the plugin bubble.
+const int kLoadAllPluginsButtonVerticalPadding = 8;
+
// General padding between elements in the geolocation bubble.
const int kGeoPadding = 8;
@@ -87,6 +91,7 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
- (void)initializeRadioGroup;
- (void)initializePopupList;
- (void)initializeGeoLists;
+- (void)sizeToFitLoadPluginsButton;
- (void)sizeToFitManageDoneButtons;
- (void)removeInfoButton;
- (void)popupLinkClicked:(id)sender;
@@ -345,6 +350,36 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
[contentsContainer_ setFrame:containerFrame];
}
+- (void)sizeToFitLoadPluginsButton {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableClickToPlay)) {
+ const ContentSettingBubbleModel::BubbleContent& content =
+ contentSettingBubbleModel_->bubble_content();
+ [loadAllPluginsButton_ setEnabled:content.load_plugins_link_enabled];
+
+ // Resize horizontally to fit button if necessary.
+ NSRect windowFrame = [[self window] frame];
+ int widthNeeded = NSWidth([loadAllPluginsButton_ frame]) +
+ 2 * NSMinX([loadAllPluginsButton_ frame]);
+ if (NSWidth(windowFrame) < widthNeeded) {
+ windowFrame.size.width = widthNeeded;
+ [[self window] setFrame:windowFrame display:NO];
+ }
+ } else {
+ // Remove button and resize vertically.
+ int deltaY = kLoadAllPluginsButtonVerticalPadding +
+ NSHeight([loadAllPluginsButton_ frame]);
+ [loadAllPluginsButton_ removeFromSuperview];
+ NSRect frame = [[self window] frame];
+ frame.size.height -= deltaY;
+ [[self window] setFrame:frame display:NO];
+ NSPoint radioOrigin = [allowBlockRadioGroup_ frame].origin;
+ radioOrigin.y -= deltaY;
+ [allowBlockRadioGroup_ setFrameOrigin:radioOrigin];
+ [allowBlockRadioGroup_ setNeedsDisplay];
+ }
+}
+
- (void)sizeToFitManageDoneButtons {
CGFloat actualWidth = NSWidth([[[self window] contentView] frame]);
CGFloat requiredWidth = NSMaxX([manageButton_ frame]) + kManageDonePadding +
@@ -381,16 +416,18 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
[self sizeToFitManageDoneButtons];
[self initializeTitle];
- if (contentSettingBubbleModel_->content_type() ==
- CONTENT_SETTINGS_TYPE_COOKIES)
+
+ ContentSettingsType type = contentSettingBubbleModel_->content_type();
+ if (type == CONTENT_SETTINGS_TYPE_PLUGINS)
+ [self sizeToFitLoadPluginsButton];
+ if (type == CONTENT_SETTINGS_TYPE_COOKIES)
[self removeInfoButton];
if (allowBlockRadioGroup_) // not bound in cookie bubble xib
[self initializeRadioGroup];
- if (contentSettingBubbleModel_->content_type() ==
- CONTENT_SETTINGS_TYPE_POPUPS)
+
+ if (type == CONTENT_SETTINGS_TYPE_POPUPS)
[self initializePopupList];
- if (contentSettingBubbleModel_->content_type() ==
- CONTENT_SETTINGS_TYPE_GEOLOCATION)
+ if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION)
[self initializeGeoLists];
}
@@ -416,6 +453,11 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
[self close];
}
+- (IBAction)loadAllPlugins:(id)sender {
+ contentSettingBubbleModel_->OnLoadPluginsLinkClicked();
+ [self close];
+}
+
- (void)popupLinkClicked:(id)sender {
content_blocked_bubble::PopupLinks::iterator i(popupLinks_.find(sender));
DCHECK(i != popupLinks_.end());