| 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/views/options/exceptions_view.h" | 5 #include "chrome/browser/views/options/exceptions_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 return l10n_util::GetString(IDS_PLUGINS_EXCEPTION_TITLE); | 121 return l10n_util::GetString(IDS_PLUGINS_EXCEPTION_TITLE); |
| 122 case CONTENT_SETTINGS_TYPE_POPUPS: | 122 case CONTENT_SETTINGS_TYPE_POPUPS: |
| 123 return l10n_util::GetString(IDS_POPUP_EXCEPTION_TITLE); | 123 return l10n_util::GetString(IDS_POPUP_EXCEPTION_TITLE); |
| 124 default: | 124 default: |
| 125 NOTREACHED(); | 125 NOTREACHED(); |
| 126 } | 126 } |
| 127 return std::wstring(); | 127 return std::wstring(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void ExceptionsView::AcceptExceptionEdit( | 130 void ExceptionsView::AcceptExceptionEdit( |
| 131 const HostContentSettingsMap::Pattern& pattern, | 131 const ContentSettingsPattern& pattern, |
| 132 ContentSetting setting, | 132 ContentSetting setting, |
| 133 bool is_off_the_record, | 133 bool is_off_the_record, |
| 134 int index, | 134 int index, |
| 135 bool is_new) { | 135 bool is_new) { |
| 136 DCHECK(!is_off_the_record || allow_off_the_record_); | 136 DCHECK(!is_off_the_record || allow_off_the_record_); |
| 137 | 137 |
| 138 if (!is_new) | 138 if (!is_new) |
| 139 model_.RemoveException(index); | 139 model_.RemoveException(index); |
| 140 model_.AddException(pattern, setting, is_off_the_record); | 140 model_.AddException(pattern, setting, is_off_the_record); |
| 141 | 141 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 int selected_row_count = table_->SelectedRowCount(); | 227 int selected_row_count = table_->SelectedRowCount(); |
| 228 // TODO: 34177, support editing of more than one entry at a time. | 228 // TODO: 34177, support editing of more than one entry at a time. |
| 229 edit_button_->SetEnabled(selected_row_count == 1); | 229 edit_button_->SetEnabled(selected_row_count == 1); |
| 230 remove_button_->SetEnabled(selected_row_count >= 1); | 230 remove_button_->SetEnabled(selected_row_count >= 1); |
| 231 remove_all_button_->SetEnabled(model_.RowCount() > 0); | 231 remove_all_button_->SetEnabled(model_.RowCount() > 0); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void ExceptionsView::Add() { | 234 void ExceptionsView::Add() { |
| 235 ExceptionEditorView* view = | 235 ExceptionEditorView* view = |
| 236 new ExceptionEditorView(this, &model_, allow_off_the_record_, -1, | 236 new ExceptionEditorView(this, &model_, allow_off_the_record_, -1, |
| 237 HostContentSettingsMap::Pattern(), | 237 ContentSettingsPattern(), |
| 238 CONTENT_SETTING_BLOCK, false); | 238 CONTENT_SETTING_BLOCK, false); |
| 239 view->Show(window()->GetNativeWindow()); | 239 view->Show(window()->GetNativeWindow()); |
| 240 | 240 |
| 241 UpdateButtonState(); | 241 UpdateButtonState(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void ExceptionsView::Edit() { | 244 void ExceptionsView::Edit() { |
| 245 DCHECK(table_->FirstSelectedRow() != -1); | 245 DCHECK(table_->FirstSelectedRow() != -1); |
| 246 int index = table_->FirstSelectedRow(); | 246 int index = table_->FirstSelectedRow(); |
| 247 const HostContentSettingsMap::PatternSettingPair& entry = | 247 const HostContentSettingsMap::PatternSettingPair& entry = |
| (...skipping 18 matching lines...) Expand all Loading... |
| 266 } | 266 } |
| 267 | 267 |
| 268 UpdateButtonState(); | 268 UpdateButtonState(); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void ExceptionsView::RemoveAll() { | 271 void ExceptionsView::RemoveAll() { |
| 272 model_.RemoveAll(); | 272 model_.RemoveAll(); |
| 273 | 273 |
| 274 UpdateButtonState(); | 274 UpdateButtonState(); |
| 275 } | 275 } |
| OLD | NEW |