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

Side by Side Diff: chrome/browser/cocoa/content_exceptions_window_controller.mm

Issue 3299020: Remove vestigial cookie/web app permissions prompting UI now that the async U... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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
OLDNEW
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.h" 7 #include "app/l10n_util.h"
8 #include "app/l10n_util_mac.h" 8 #include "app/l10n_util_mac.h"
9 #include "app/table_model_observer.h" 9 #include "app/table_model_observer.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 // The settings shown in the combobox if showSession_ is false; 129 // The settings shown in the combobox if showSession_ is false;
130 const ContentSetting kNoSessionSettings[] = { CONTENT_SETTING_ALLOW, 130 const ContentSetting kNoSessionSettings[] = { CONTENT_SETTING_ALLOW,
131 CONTENT_SETTING_BLOCK }; 131 CONTENT_SETTING_BLOCK };
132 132
133 // The settings shown in the combobox if showSession_ is true; 133 // The settings shown in the combobox if showSession_ is true;
134 const ContentSetting kSessionSettings[] = { CONTENT_SETTING_ALLOW, 134 const ContentSetting kSessionSettings[] = { CONTENT_SETTING_ALLOW,
135 CONTENT_SETTING_SESSION_ONLY, 135 CONTENT_SETTING_SESSION_ONLY,
136 CONTENT_SETTING_BLOCK }; 136 CONTENT_SETTING_BLOCK };
137 137
138 // The settings shown in the combobox if show_session_ is true, and we still
139 // offer the cookie prompt mode.
140 const ContentSetting kSessionAskSettings[] = { CONTENT_SETTING_ALLOW,
141 CONTENT_SETTING_ASK,
142 CONTENT_SETTING_SESSION_ONLY,
143 CONTENT_SETTING_BLOCK };
144
145 } // namespace 138 } // namespace
146 139
147 //////////////////////////////////////////////////////////////////////////////// 140 ////////////////////////////////////////////////////////////////////////////////
148 // ContentExceptionsWindowController implementation 141 // ContentExceptionsWindowController implementation
149 142
150 static ContentExceptionsWindowController* 143 static ContentExceptionsWindowController*
151 g_exceptionWindows[CONTENT_SETTINGS_NUM_TYPES] = { nil }; 144 g_exceptionWindows[CONTENT_SETTINGS_NUM_TYPES] = { nil };
152 145
153 @implementation ContentExceptionsWindowController 146 @implementation ContentExceptionsWindowController
154 147
(...skipping 16 matching lines...) Expand all
171 NSString* nibpath = 164 NSString* nibpath =
172 [mac_util::MainAppBundle() pathForResource:@"ContentExceptionsWindow" 165 [mac_util::MainAppBundle() pathForResource:@"ContentExceptionsWindow"
173 ofType:@"nib"]; 166 ofType:@"nib"];
174 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { 167 if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
175 settingsType_ = settingsType; 168 settingsType_ = settingsType;
176 settingsMap_ = settingsMap; 169 settingsMap_ = settingsMap;
177 otrSettingsMap_ = otrSettingsMap; 170 otrSettingsMap_ = otrSettingsMap;
178 model_.reset(new ContentExceptionsTableModel( 171 model_.reset(new ContentExceptionsTableModel(
179 settingsMap_, otrSettingsMap_, settingsType_)); 172 settingsMap_, otrSettingsMap_, settingsType_));
180 showSession_ = settingsType_ == CONTENT_SETTINGS_TYPE_COOKIES; 173 showSession_ = settingsType_ == CONTENT_SETTINGS_TYPE_COOKIES;
181 disableCookiePrompt_ = !CommandLine::ForCurrentProcess()->HasSwitch(
182 switches::kEnableCookiePrompt);
183 otrAllowed_ = otrSettingsMap != NULL; 174 otrAllowed_ = otrSettingsMap != NULL;
184 tableObserver_.reset(new UpdatingContentSettingsObserver(self)); 175 tableObserver_.reset(new UpdatingContentSettingsObserver(self));
185 updatesEnabled_ = YES; 176 updatesEnabled_ = YES;
186 177
187 // TODO(thakis): autoremember window rect. 178 // TODO(thakis): autoremember window rect.
188 // TODO(thakis): sorting support. 179 // TODO(thakis): sorting support.
189 } 180 }
190 return self; 181 return self;
191 } 182 }
192 183
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 489
499 // The model caches its data, meaning we need to recreate it on every change. 490 // The model caches its data, meaning we need to recreate it on every change.
500 model_.reset(new ContentExceptionsTableModel( 491 model_.reset(new ContentExceptionsTableModel(
501 settingsMap_, otrSettingsMap_, settingsType_)); 492 settingsMap_, otrSettingsMap_, settingsType_));
502 493
503 [tableView_ reloadData]; 494 [tableView_ reloadData];
504 [self adjustEditingButtons]; 495 [self adjustEditingButtons];
505 } 496 }
506 497
507 - (size_t)menuItemCount { 498 - (size_t)menuItemCount {
508 if (showSession_) { 499 return showSession_ ? arraysize(kSessionSettings)
509 return disableCookiePrompt_ ? 500 : arraysize(kNoSessionSettings);
510 arraysize(kSessionSettings) : arraysize(kSessionAskSettings);
511 } else {
512 return arraysize(kNoSessionSettings);
513 }
514 } 501 }
515 502
516 - (NSString*)titleForIndex:(size_t)index { 503 - (NSString*)titleForIndex:(size_t)index {
517 switch ([self settingForIndex:index]) { 504 switch ([self settingForIndex:index]) {
518 case CONTENT_SETTING_ALLOW: 505 case CONTENT_SETTING_ALLOW:
519 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_ALLOW_BUTTON); 506 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_ALLOW_BUTTON);
520 case CONTENT_SETTING_BLOCK: 507 case CONTENT_SETTING_BLOCK:
521 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_BLOCK_BUTTON); 508 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_BLOCK_BUTTON);
522 case CONTENT_SETTING_ASK:
523 return l10n_util::GetNSStringWithFixup(IDS_EXCEPTIONS_ASK_BUTTON);
524 case CONTENT_SETTING_SESSION_ONLY: 509 case CONTENT_SETTING_SESSION_ONLY:
525 return l10n_util::GetNSStringWithFixup( 510 return l10n_util::GetNSStringWithFixup(
526 IDS_EXCEPTIONS_SESSION_ONLY_BUTTON); 511 IDS_EXCEPTIONS_SESSION_ONLY_BUTTON);
527 default: 512 default:
528 NOTREACHED(); 513 NOTREACHED();
529 } 514 }
530 return @""; 515 return @"";
531 } 516 }
532 517
533 - (ContentSetting)settingForIndex:(size_t)index { 518 - (ContentSetting)settingForIndex:(size_t)index {
534 if (showSession_) { 519 return showSession_ ? kSessionSettings[index] : kNoSessionSettings[index];
535 return disableCookiePrompt_ ?
536 kSessionSettings[index] : kSessionAskSettings[index];
537 } else {
538 return kNoSessionSettings[index];
539 }
540 } 520 }
541 521
542 - (size_t)indexForSetting:(ContentSetting)setting { 522 - (size_t)indexForSetting:(ContentSetting)setting {
543 for (size_t i = 0; i < [self menuItemCount]; ++i) { 523 for (size_t i = 0; i < [self menuItemCount]; ++i) {
544 if ([self settingForIndex:i] == setting) 524 if ([self settingForIndex:i] == setting)
545 return i; 525 return i;
546 } 526 }
547 NOTREACHED(); 527 NOTREACHED();
548 return 0; 528 return 0;
549 } 529 }
550 530
551 @end 531 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698