Chromium Code Reviews| 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/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 Loading... | |
| 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:2]; |
|
msw
2012/08/23 21:26:39
s/2/NUM_TAB_IDS/
markusheintz_
2012/08/23 22:21:34
Done.
| |
| 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:0]; |
|
msw
2012/08/23 21:26:39
s/0/TAB_ID_PERMISSIONS/ here and similar for lines
markusheintz_
2012/08/23 22:21:34
Done.
| |
| 364 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding forSegment:0]; | 364 [segmentedControl_ setWidth:tabWidth + kTabStripXPadding forSegment:0]; |
| 365 | 365 |
| 366 // Create the "Connection" tab. | 366 // Create the "Connection" tab. |
| 367 label = l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION); | 367 label = l10n_util::GetNSString(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION); |
| 368 textSize = [label sizeWithAttributes:textAttributes]; | 368 textSize = [label sizeWithAttributes:textAttributes]; |
| 369 [segmentedControl_ setLabel:label forSegment:1]; | 369 [segmentedControl_ setLabel:label forSegment:1]; |
| 370 | 370 |
| 371 // Make both tabs the width of the widest. The first segment has some | 371 // 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 | 372 // additional padding that is not part of the tab, which is used for drawing |
| 373 // the background of the tab strip. | 373 // the background of the tab strip. |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1034 } | 1034 } |
| 1035 | 1035 |
| 1036 void WebsiteSettingsUIBridge::SetPermissionInfo( | 1036 void WebsiteSettingsUIBridge::SetPermissionInfo( |
| 1037 const PermissionInfoList& permission_info_list) { | 1037 const PermissionInfoList& permission_info_list) { |
| 1038 [bubble_controller_ setPermissionInfo:permission_info_list]; | 1038 [bubble_controller_ setPermissionInfo:permission_info_list]; |
| 1039 } | 1039 } |
| 1040 | 1040 |
| 1041 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { | 1041 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { |
| 1042 [bubble_controller_ setFirstVisit:first_visit]; | 1042 [bubble_controller_ setFirstVisit:first_visit]; |
| 1043 } | 1043 } |
| 1044 | |
| 1045 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { | |
| 1046 // TODO(dubroy): Implement this method. | |
| 1047 } | |
| OLD | NEW |