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/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 - (void)setTitleOfButton:(NSPopUpButton*)button { | 397 - (void)setTitleOfButton:(NSPopUpButton*)button { |
398 ContentSetting setting = [self contentSettingForButton:button]; | 398 ContentSetting setting = [self contentSettingForButton:button]; |
399 | 399 |
400 // All menu items are tagged with the default setting. | 400 // All menu items are tagged with the default setting. |
401 ContentSetting defaultSetting = static_cast<ContentSetting>( | 401 ContentSetting defaultSetting = static_cast<ContentSetting>( |
402 [[button selectedItem] tag]); | 402 [[button selectedItem] tag]); |
403 | 403 |
404 // Update the title to match the current permission setting. | 404 // Update the title to match the current permission setting. |
405 scoped_nsobject<NSMenuItem> titleItem([[NSMenuItem alloc] init]); | 405 scoped_nsobject<NSMenuItem> titleItem([[NSMenuItem alloc] init]); |
406 [titleItem setTitle:base::SysUTF16ToNSString( | 406 [titleItem setTitle:base::SysUTF16ToNSString( |
407 WebsiteSettingsUI::PermissionActionToUIString(setting, | 407 WebsiteSettingsUI::PermissionActionToUIString( |
408 defaultSetting))]; | 408 setting, defaultSetting, content_settings::SETTING_SOURCE_USER))]; |
409 [[button cell] setUsesItemFromMenu:NO]; | 409 [[button cell] setUsesItemFromMenu:NO]; |
410 [[button cell] setMenuItem:titleItem.get()]; | 410 [[button cell] setMenuItem:titleItem.get()]; |
411 [button sizeToFit]; | 411 [button sizeToFit]; |
412 } | 412 } |
413 | 413 |
414 - (ContentSetting)contentSettingForButton:(NSPopUpButton*)button { | 414 - (ContentSetting)contentSettingForButton:(NSPopUpButton*)button { |
415 // Determine the setting based on the index of the selected menu item. | 415 // Determine the setting based on the index of the selected menu item. |
416 NSUInteger buttonIndex = [button indexOfSelectedItem]; | 416 NSUInteger buttonIndex = [button indexOfSelectedItem]; |
417 if (buttonIndex >= arraysize(kPermissionsMenuSettings)) { | 417 if (buttonIndex >= arraysize(kPermissionsMenuSettings)) { |
418 NOTREACHED(); | 418 NOTREACHED(); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 } | 611 } |
612 | 612 |
613 void WebsiteSettingsUIBridge::SetIdentityInfo( | 613 void WebsiteSettingsUIBridge::SetIdentityInfo( |
614 const WebsiteSettingsUI::IdentityInfo& identity_info) { | 614 const WebsiteSettingsUI::IdentityInfo& identity_info) { |
615 [bubble_controller_ setIdentityInfo:identity_info]; | 615 [bubble_controller_ setIdentityInfo:identity_info]; |
616 } | 616 } |
617 | 617 |
618 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { | 618 void WebsiteSettingsUIBridge::SetFirstVisit(const string16& first_visit) { |
619 [bubble_controller_ setFirstVisit:first_visit]; | 619 [bubble_controller_ setFirstVisit:first_visit]; |
620 } | 620 } |
OLD | NEW |