OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/content_exceptions_window_controller.h" | 5 #import "chrome/browser/cocoa/content_exceptions_window_controller.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "app/table_model_observer.h" | 8 #include "app/table_model_observer.h" |
9 #import "base/mac_util.h" | 9 #import "base/mac_util.h" |
10 #import "base/scoped_nsobject.h" | 10 #import "base/scoped_nsobject.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 const CGFloat kButtonBarHeight = 35.0; | 122 const CGFloat kButtonBarHeight = 35.0; |
123 | 123 |
124 // The settings shown in the combobox if showAsk_ is false; | 124 // The settings shown in the combobox if showAsk_ is false; |
125 const ContentSetting kNoAskSettings[] = { CONTENT_SETTING_ALLOW, | 125 const ContentSetting kNoAskSettings[] = { CONTENT_SETTING_ALLOW, |
126 CONTENT_SETTING_BLOCK }; | 126 CONTENT_SETTING_BLOCK }; |
127 | 127 |
128 // The settings shown in the combobox if showAsk_ is true; | 128 // The settings shown in the combobox if showAsk_ is true; |
129 const ContentSetting kAskSettings[] = { CONTENT_SETTING_ALLOW, | 129 const ContentSetting kAskSettings[] = { CONTENT_SETTING_ALLOW, |
130 CONTENT_SETTING_ASK, | 130 CONTENT_SETTING_ASK, |
| 131 CONTENT_SETTING_SESSION_ONLY, |
131 CONTENT_SETTING_BLOCK }; | 132 CONTENT_SETTING_BLOCK }; |
132 | 133 |
133 } // namespace | 134 } // namespace |
134 | 135 |
135 //////////////////////////////////////////////////////////////////////////////// | 136 //////////////////////////////////////////////////////////////////////////////// |
136 // ContentExceptionsWindowController implementation | 137 // ContentExceptionsWindowController implementation |
137 | 138 |
138 static ContentExceptionsWindowController* | 139 static ContentExceptionsWindowController* |
139 g_exceptionWindows[CONTENT_SETTINGS_NUM_TYPES] = { nil }; | 140 g_exceptionWindows[CONTENT_SETTINGS_NUM_TYPES] = { nil }; |
140 | 141 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 } | 470 } |
470 | 471 |
471 - (NSString*)titleForIndex:(size_t)index { | 472 - (NSString*)titleForIndex:(size_t)index { |
472 switch ([self settingForIndex:index]) { | 473 switch ([self settingForIndex:index]) { |
473 case CONTENT_SETTING_ALLOW: | 474 case CONTENT_SETTING_ALLOW: |
474 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_ALLOW_BUTTON); | 475 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_ALLOW_BUTTON); |
475 case CONTENT_SETTING_BLOCK: | 476 case CONTENT_SETTING_BLOCK: |
476 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_BLOCK_BUTTON); | 477 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_BLOCK_BUTTON); |
477 case CONTENT_SETTING_ASK: | 478 case CONTENT_SETTING_ASK: |
478 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_ASK_BUTTON); | 479 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_ASK_BUTTON); |
| 480 case CONTENT_SETTING_SESSION_ONLY: |
| 481 return l10n_util::GetNSStringWithFixup( |
| 482 IDS_EXCEPTIONS_SESSION_ONLY_BUTTON); |
479 default: | 483 default: |
480 NOTREACHED(); | 484 NOTREACHED(); |
481 } | 485 } |
482 return @""; | 486 return @""; |
483 } | 487 } |
484 | 488 |
485 - (ContentSetting)settingForIndex:(size_t)index { | 489 - (ContentSetting)settingForIndex:(size_t)index { |
486 return showAsk_ ? kAskSettings[index] : kNoAskSettings[index]; | 490 return showAsk_ ? kAskSettings[index] : kNoAskSettings[index]; |
487 } | 491 } |
488 | 492 |
489 - (size_t)indexForSetting:(ContentSetting)setting { | 493 - (size_t)indexForSetting:(ContentSetting)setting { |
490 for (size_t i = 0; i < [self menuItemCount]; ++i) { | 494 for (size_t i = 0; i < [self menuItemCount]; ++i) { |
491 if ([self settingForIndex:i] == setting) | 495 if ([self settingForIndex:i] == setting) |
492 return i; | 496 return i; |
493 } | 497 } |
494 NOTREACHED(); | 498 NOTREACHED(); |
495 return 0; | 499 return 0; |
496 } | 500 } |
497 | 501 |
498 @end | 502 @end |
OLD | NEW |