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

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

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

Powered by Google App Engine
This is Rietveld 408576698