| OLD | NEW |
| 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" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 const ContentTypeToNibPath kNibPaths[] = { | 257 const ContentTypeToNibPath kNibPaths[] = { |
| 258 {CONTENT_SETTINGS_TYPE_COOKIES, @"ContentBlockedCookies"}, | 258 {CONTENT_SETTINGS_TYPE_COOKIES, @"ContentBlockedCookies"}, |
| 259 {CONTENT_SETTINGS_TYPE_IMAGES, @"ContentBlockedSimple"}, | 259 {CONTENT_SETTINGS_TYPE_IMAGES, @"ContentBlockedSimple"}, |
| 260 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, @"ContentBlockedSimple"}, | 260 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, @"ContentBlockedSimple"}, |
| 261 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, @"ContentBlockedSimple"}, | 261 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, @"ContentBlockedSimple"}, |
| 262 {CONTENT_SETTINGS_TYPE_PLUGINS, @"ContentBlockedPlugins"}, | 262 {CONTENT_SETTINGS_TYPE_PLUGINS, @"ContentBlockedPlugins"}, |
| 263 {CONTENT_SETTINGS_TYPE_POPUPS, @"ContentBlockedPopups"}, | 263 {CONTENT_SETTINGS_TYPE_POPUPS, @"ContentBlockedPopups"}, |
| 264 {CONTENT_SETTINGS_TYPE_GEOLOCATION, @"ContentBlockedGeolocation"}, | 264 {CONTENT_SETTINGS_TYPE_GEOLOCATION, @"ContentBlockedGeolocation"}, |
| 265 {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, @"ContentBlockedMixedScript"}, | 265 {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, @"ContentBlockedMixedScript"}, |
| 266 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, @"ContentProtocolHandlers"}, | 266 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, @"ContentProtocolHandlers"}, |
| 267 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, @"ContentBlockedDownloads"}, | |
| 268 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, @"ContentBlockedMIDISysEx"}, | 267 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, @"ContentBlockedMIDISysEx"}, |
| 269 }; | 268 }; |
| 270 | 269 |
| 271 - (id)initWithModel:(ContentSettingBubbleModel*)contentSettingBubbleModel | 270 - (id)initWithModel:(ContentSettingBubbleModel*)contentSettingBubbleModel |
| 272 webContents:(content::WebContents*)webContents | 271 webContents:(content::WebContents*)webContents |
| 273 parentWindow:(NSWindow*)parentWindow | 272 parentWindow:(NSWindow*)parentWindow |
| 274 decoration:(ContentSettingDecoration*)decoration | 273 decoration:(ContentSettingDecoration*)decoration |
| 275 anchoredAt:(NSPoint)anchoredAt { | 274 anchoredAt:(NSPoint)anchoredAt { |
| 276 // This method takes ownership of |contentSettingBubbleModel| in all cases. | 275 // This method takes ownership of |contentSettingBubbleModel| in all cases. |
| 277 std::unique_ptr<ContentSettingBubbleModel> model(contentSettingBubbleModel); | 276 std::unique_ptr<ContentSettingBubbleModel> model(contentSettingBubbleModel); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 306 break; | 305 break; |
| 307 } | 306 } |
| 308 } | 307 } |
| 309 } | 308 } |
| 310 | 309 |
| 311 if (model->AsMediaStreamBubbleModel()) | 310 if (model->AsMediaStreamBubbleModel()) |
| 312 nibPath = @"ContentBlockedMedia"; | 311 nibPath = @"ContentBlockedMedia"; |
| 313 | 312 |
| 314 if (model->AsSubresourceFilterBubbleModel()) | 313 if (model->AsSubresourceFilterBubbleModel()) |
| 315 nibPath = @"ContentSubresourceFilter"; | 314 nibPath = @"ContentSubresourceFilter"; |
| 315 |
| 316 if (model->AsDownloadsBubbleModel()) |
| 317 nibPath = @"ContentBlockedDownloads"; |
| 316 return nibPath; | 318 return nibPath; |
| 317 } | 319 } |
| 318 | 320 |
| 319 - (void)initializeTitle { | 321 - (void)initializeTitle { |
| 320 if (!titleLabel_) | 322 if (!titleLabel_) |
| 321 return; | 323 return; |
| 322 | 324 |
| 323 NSString* label = base::SysUTF16ToNSString( | 325 NSString* label = base::SysUTF16ToNSString( |
| 324 contentSettingBubbleModel_->bubble_content().title); | 326 contentSettingBubbleModel_->bubble_content().title); |
| 325 [titleLabel_ setStringValue:label]; | 327 [titleLabel_ setStringValue:label]; |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 | 789 |
| 788 - (void)awakeFromNib { | 790 - (void)awakeFromNib { |
| 789 [super awakeFromNib]; | 791 [super awakeFromNib]; |
| 790 | 792 |
| 791 ContentSettingSimpleBubbleModel* simple_bubble = | 793 ContentSettingSimpleBubbleModel* simple_bubble = |
| 792 contentSettingBubbleModel_->AsSimpleBubbleModel(); | 794 contentSettingBubbleModel_->AsSimpleBubbleModel(); |
| 793 | 795 |
| 794 [[self bubble] setArrowLocation:info_bubble::kTopTrailing]; | 796 [[self bubble] setArrowLocation:info_bubble::kTopTrailing]; |
| 795 | 797 |
| 796 // Adapt window size to bottom buttons. Do this before all other layouting. | 798 // Adapt window size to bottom buttons. Do this before all other layouting. |
| 797 if (simple_bubble && !simple_bubble->bubble_content().manage_text.empty()) | 799 if ((simple_bubble && !simple_bubble->bubble_content().manage_text.empty()) || |
| 800 contentSettingBubbleModel_->AsDownloadsBubbleModel()) |
| 798 [self initManageDoneButtons]; | 801 [self initManageDoneButtons]; |
| 799 | 802 |
| 800 [self initializeTitle]; | 803 [self initializeTitle]; |
| 801 [self initializeMessage]; | 804 [self initializeMessage]; |
| 802 | 805 |
| 803 // Note that the per-content-type methods and |initializeRadioGroup| below | 806 // Note that the per-content-type methods and |initializeRadioGroup| below |
| 804 // must be kept in the correct order, as they make interdependent adjustments | 807 // must be kept in the correct order, as they make interdependent adjustments |
| 805 // of the bubble's height. | 808 // of the bubble's height. |
| 806 if (simple_bubble && | 809 if (simple_bubble && |
| 807 simple_bubble->content_type() == CONTENT_SETTINGS_TYPE_PLUGINS) { | 810 simple_bubble->content_type() == CONTENT_SETTINGS_TYPE_PLUGINS) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 | 916 |
| 914 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { | 917 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus { |
| 915 return &mediaMenus_; | 918 return &mediaMenus_; |
| 916 } | 919 } |
| 917 | 920 |
| 918 - (LocationBarDecoration*)decorationForBubble { | 921 - (LocationBarDecoration*)decorationForBubble { |
| 919 return decoration_; | 922 return decoration_; |
| 920 } | 923 } |
| 921 | 924 |
| 922 @end // ContentSettingBubbleController | 925 @end // ContentSettingBubbleController |
| OLD | NEW |