| 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 #include "chrome/browser/content_setting_combo_model.h" | 5 #include "chrome/browser/content_setting_combo_model.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // offer the cookie prompt mode. | 24 // offer the cookie prompt mode. |
| 25 const ContentSetting kSessionAskSettings[] = { CONTENT_SETTING_ALLOW, | 25 const ContentSetting kSessionAskSettings[] = { CONTENT_SETTING_ALLOW, |
| 26 CONTENT_SETTING_ASK, | 26 CONTENT_SETTING_ASK, |
| 27 CONTENT_SETTING_SESSION_ONLY, | 27 CONTENT_SETTING_SESSION_ONLY, |
| 28 CONTENT_SETTING_BLOCK }; | 28 CONTENT_SETTING_BLOCK }; |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 ContentSettingComboModel::ContentSettingComboModel(bool show_session) | 32 ContentSettingComboModel::ContentSettingComboModel(bool show_session) |
| 33 : show_session_(show_session), | 33 : show_session_(show_session), |
| 34 disable_cookie_prompt_(CommandLine::ForCurrentProcess()->HasSwitch( | 34 disable_cookie_prompt_(!CommandLine::ForCurrentProcess()->HasSwitch( |
| 35 switches::kDisableCookiePrompt)) { | 35 switches::kEnableCookiePrompt)) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 ContentSettingComboModel::~ContentSettingComboModel() { | 38 ContentSettingComboModel::~ContentSettingComboModel() { |
| 39 } | 39 } |
| 40 | 40 |
| 41 int ContentSettingComboModel::GetItemCount() { | 41 int ContentSettingComboModel::GetItemCount() { |
| 42 if (show_session_) { | 42 if (show_session_) { |
| 43 return disable_cookie_prompt_ ? | 43 return disable_cookie_prompt_ ? |
| 44 arraysize(kSessionSettings) : arraysize(kSessionAskSettings); | 44 arraysize(kSessionSettings) : arraysize(kSessionAskSettings); |
| 45 } else { | 45 } else { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 int ContentSettingComboModel::IndexForSetting(ContentSetting setting) { | 75 int ContentSettingComboModel::IndexForSetting(ContentSetting setting) { |
| 76 for (int i = 0; i < GetItemCount(); ++i) | 76 for (int i = 0; i < GetItemCount(); ++i) |
| 77 if (SettingForIndex(i) == setting) | 77 if (SettingForIndex(i) == setting) |
| 78 return i; | 78 return i; |
| 79 NOTREACHED(); | 79 NOTREACHED(); |
| 80 return 0; | 80 return 0; |
| 81 } | 81 } |
| 82 | 82 |
| OLD | NEW |