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

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: " Created 8 years, 4 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
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/ui/browser_dialogs.h" 9 #import "chrome/browser/ui/browser_dialogs.h"
10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 toView:contentView_ 338 toView:contentView_
339 atPoint:controlOrigin]; 339 atPoint:controlOrigin];
340 340
341 // Create the tab view and its two tabs. 341 // Create the tab view and its two tabs.
342 342
343 NSRect initialFrame = NSMakeRect(0, 0, kWindowWidth, kTabStripHeight); 343 NSRect initialFrame = NSMakeRect(0, 0, kWindowWidth, kTabStripHeight);
344 segmentedControl_.reset( 344 segmentedControl_.reset(
345 [[NSSegmentedControl alloc] initWithFrame:initialFrame]); 345 [[NSSegmentedControl alloc] initWithFrame:initialFrame]);
346 [segmentedControl_ setCell: 346 [segmentedControl_ setCell:
347 [[[WebsiteSettingsTabSegmentedCell alloc] init] autorelease]]; 347 [[[WebsiteSettingsTabSegmentedCell alloc] init] autorelease]];
348 [segmentedControl_ setSegmentCount:2]; 348 [segmentedControl_ setSegmentCount:NUM_TAB_IDS];
349 [segmentedControl_ setTarget:self]; 349 [segmentedControl_ setTarget:self];
350 [segmentedControl_ setAction:@selector(tabSelected:)]; 350 [segmentedControl_ setAction:@selector(tabSelected:)];
351 351
352 NSFont* smallSystemFont = 352 NSFont* smallSystemFont =
353 [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; 353 [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
354 NSDictionary* textAttributes = 354 NSDictionary* textAttributes =
355 [NSDictionary dictionaryWithObject:smallSystemFont 355 [NSDictionary dictionaryWithObject:smallSystemFont
356 forKey:NSFontAttributeName]; 356 forKey:NSFontAttributeName];
357 357
358 // Create the "Permissions" tab. 358 // Create the "Permissions" tab.
359 NSString* label = l10n_util::GetNSString( 359 NSString* label = l10n_util::GetNSString(
360 IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS); 360 IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS);
361 NSSize textSize = [label sizeWithAttributes:textAttributes]; 361 NSSize textSize = [label sizeWithAttributes:textAttributes];
362 CGFloat tabWidth = textSize.width + 2 * kTabLabelXPadding; 362 CGFloat tabWidth = textSize.width + 2 * kTabLabelXPadding;
363 [segmentedControl_ setLabel:label forSegment:0]; 363 [segmentedControl_ setLabel:label forSegment:TAB_ID_PERMISSIONS];
364 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding forSegment:0]; 364 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding
365 forSegment:TAB_ID_PERMISSIONS];
365 366
366 // Create the "Connection" tab. 367 // Create the "Connection" tab.
367 label = l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION); 368 label = l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION);
368 textSize = [label sizeWithAttributes:textAttributes]; 369 textSize = [label sizeWithAttributes:textAttributes];
369 [segmentedControl_ setLabel:label forSegment:1]; 370 [segmentedControl_ setLabel:label forSegment:TAB_ID_CONNECTION];
371
372 DCHECK_EQ( [segmentedControl_ segmentCount ], NUM_TAB_IDS);
msw 2012/08/24 18:59:14 nit: no space after open paren.
msw 2012/08/24 19:00:01 Doh, also no space before close square bracket
markusheintz_ 2012/08/27 09:09:30 Done.
markusheintz_ 2012/08/27 09:09:30 Done.
370 373
371 // Make both tabs the width of the widest. The first segment has some 374 // Make both tabs the width of the widest. The first segment has some
372 // additional padding that is not part of the tab, which is used for drawing 375 // additional padding that is not part of the tab, which is used for drawing
373 // the background of the tab strip. 376 // the background of the tab strip.
374 tabWidth = std::max(tabWidth, 377 tabWidth = std::max(tabWidth,
375 textSize.width + 2 * kTabLabelXPadding); 378 textSize.width + 2 * kTabLabelXPadding);
376 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding forSegment:0]; 379 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding
377 [segmentedControl_ setWidth:tabWidth forSegment:1]; 380 forSegment:TAB_ID_PERMISSIONS];
381 [segmentedControl_ setWidth:tabWidth forSegment:TAB_ID_CONNECTION];
378 382
379 [segmentedControl_ setFont:smallSystemFont]; 383 [segmentedControl_ setFont:smallSystemFont];
380 [segmentedControl_ setSelectedSegment:0]; 384 [segmentedControl_ setSelectedSegment:0];
381 [contentView_ addSubview:segmentedControl_]; 385 [contentView_ addSubview:segmentedControl_];
382 386
383 NSRect tabFrame = NSMakeRect(0, 0, kWindowWidth, 300); 387 NSRect tabFrame = NSMakeRect(0, 0, kWindowWidth, 300);
384 tabView_.reset([[NSTabView alloc] initWithFrame:tabFrame]); 388 tabView_.reset([[NSTabView alloc] initWithFrame:tabFrame]);
385 [tabView_ setTabViewType:NSNoTabsNoBorder]; 389 [tabView_ setTabViewType:NSNoTabsNoBorder];
386 [tabView_ setDrawsBackground:NO]; 390 [tabView_ setDrawsBackground:NO];
387 [tabView_ setControlSize:NSSmallControlSize]; 391 [tabView_ setControlSize:NSSmallControlSize];
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 } 1038 }
1035 1039
1036 void WebsiteSettingsUIBridge::SetPermissionInfo( 1040 void WebsiteSettingsUIBridge::SetPermissionInfo(
1037 const PermissionInfoList& permission_info_list) { 1041 const PermissionInfoList& permission_info_list) {
1038 [bubble_controller_ setPermissionInfo:permission_info_list]; 1042 [bubble_controller_ setPermissionInfo:permission_info_list];
1039 } 1043 }
1040 1044
1041 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { 1045 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) {
1042 [bubble_controller_ setFirstVisit:first_visit]; 1046 [bubble_controller_ setFirstVisit:first_visit];
1043 } 1047 }
1048
1049 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) {
1050 // TODO(dubroy): Implement this method.
1051 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698