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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings_bubble_controller.mm

Issue 10829452: Auto select the connection tab of the Website Settings UI in case of an https error or mixed content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build issues. Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/website_settings/website_settings_popup_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/website_settings_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/website_settings_bubble_controller.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #import "chrome/browser/certificate_viewer.h" 9 #import "chrome/browser/certificate_viewer.h"
10 #import "chrome/browser/ui/browser_dialogs.h" 10 #import "chrome/browser/ui/browser_dialogs.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 toView:contentView_ 339 toView:contentView_
340 atPoint:controlOrigin]; 340 atPoint:controlOrigin];
341 341
342 // Create the tab view and its two tabs. 342 // Create the tab view and its two tabs.
343 343
344 NSRect initialFrame = NSMakeRect(0, 0, kWindowWidth, kTabStripHeight); 344 NSRect initialFrame = NSMakeRect(0, 0, kWindowWidth, kTabStripHeight);
345 segmentedControl_.reset( 345 segmentedControl_.reset(
346 [[NSSegmentedControl alloc] initWithFrame:initialFrame]); 346 [[NSSegmentedControl alloc] initWithFrame:initialFrame]);
347 [segmentedControl_ setCell: 347 [segmentedControl_ setCell:
348 [[[WebsiteSettingsTabSegmentedCell alloc] init] autorelease]]; 348 [[[WebsiteSettingsTabSegmentedCell alloc] init] autorelease]];
349 [segmentedControl_ setSegmentCount:2]; 349 [segmentedControl_ setSegmentCount:WebsiteSettingsUI::NUM_TAB_IDS];
350 [segmentedControl_ setTarget:self]; 350 [segmentedControl_ setTarget:self];
351 [segmentedControl_ setAction:@selector(tabSelected:)]; 351 [segmentedControl_ setAction:@selector(tabSelected:)];
352 352
353 NSFont* smallSystemFont = 353 NSFont* smallSystemFont =
354 [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; 354 [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
355 NSDictionary* textAttributes = 355 NSDictionary* textAttributes =
356 [NSDictionary dictionaryWithObject:smallSystemFont 356 [NSDictionary dictionaryWithObject:smallSystemFont
357 forKey:NSFontAttributeName]; 357 forKey:NSFontAttributeName];
358 358
359 // Create the "Permissions" tab. 359 // Create the "Permissions" tab.
360 NSString* label = l10n_util::GetNSString( 360 NSString* label = l10n_util::GetNSString(
361 IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS); 361 IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS);
362 [segmentedControl_ setLabel:label 362 [segmentedControl_ setLabel:label
363 forSegment:WebsiteSettingsUI::TAB_ID_PERMISSIONS]; 363 forSegment:WebsiteSettingsUI::TAB_ID_PERMISSIONS];
364 NSSize textSize = [label sizeWithAttributes:textAttributes]; 364 NSSize textSize = [label sizeWithAttributes:textAttributes];
365 CGFloat tabWidth = textSize.width + 2 * kTabLabelXPadding; 365 CGFloat tabWidth = textSize.width + 2 * kTabLabelXPadding;
366 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding
367 forSegment:WebsiteSettingsUI::TAB_ID_PERMISSIONS];
366 368
367 // Create the "Connection" tab. 369 // Create the "Connection" tab.
368 label = l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION); 370 label = l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION);
369 textSize = [label sizeWithAttributes:textAttributes]; 371 textSize = [label sizeWithAttributes:textAttributes];
370 [segmentedControl_ setLabel:label 372 [segmentedControl_ setLabel:label
371 forSegment:WebsiteSettingsUI::TAB_ID_CONNECTION]; 373 forSegment:WebsiteSettingsUI::TAB_ID_CONNECTION];
372 374
375 DCHECK_EQ([segmentedControl_ segmentCount], WebsiteSettingsUI::NUM_TAB_IDS);
376
373 // Make both tabs the width of the widest. The first segment has some 377 // Make both tabs the width of the widest. The first segment has some
374 // additional padding that is not part of the tab, which is used for drawing 378 // additional padding that is not part of the tab, which is used for drawing
375 // the background of the tab strip. 379 // the background of the tab strip.
376 tabWidth = std::max(tabWidth, 380 tabWidth = std::max(tabWidth,
377 textSize.width + 2 * kTabLabelXPadding); 381 textSize.width + 2 * kTabLabelXPadding);
378 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding forSegment:0]; 382 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding
379 [segmentedControl_ setWidth:tabWidth forSegment:1]; 383 forSegment:WebsiteSettingsUI::TAB_ID_PERMISSIONS];
384 [segmentedControl_ setWidth:tabWidth
385 forSegment:WebsiteSettingsUI::TAB_ID_CONNECTION];
380 386
381 [segmentedControl_ setFont:smallSystemFont]; 387 [segmentedControl_ setFont:smallSystemFont];
382 [contentView_ addSubview:segmentedControl_]; 388 [contentView_ addSubview:segmentedControl_];
383 389
384 NSRect tabFrame = NSMakeRect(0, 0, kWindowWidth, 300); 390 NSRect tabFrame = NSMakeRect(0, 0, kWindowWidth, 300);
385 tabView_.reset([[NSTabView alloc] initWithFrame:tabFrame]); 391 tabView_.reset([[NSTabView alloc] initWithFrame:tabFrame]);
386 [tabView_ setTabViewType:NSNoTabsNoBorder]; 392 [tabView_ setTabViewType:NSNoTabsNoBorder];
387 [tabView_ setDrawsBackground:NO]; 393 [tabView_ setDrawsBackground:NO];
388 [tabView_ setControlSize:NSSmallControlSize]; 394 [tabView_ setControlSize:NSSmallControlSize];
389 [contentView_ addSubview:tabView_.get()]; 395 [contentView_ addSubview:tabView_.get()];
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 [bubble_controller_ setPermissionInfo:permission_info_list]; 1079 [bubble_controller_ setPermissionInfo:permission_info_list];
1074 } 1080 }
1075 1081
1076 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { 1082 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) {
1077 [bubble_controller_ setFirstVisit:first_visit]; 1083 [bubble_controller_ setFirstVisit:first_visit];
1078 } 1084 }
1079 1085
1080 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { 1086 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) {
1081 [bubble_controller_ setSelectedTab:tab_id]; 1087 [bubble_controller_ setSelectedTab:tab_id];
1082 } 1088 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/website_settings/website_settings_popup_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698