| 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/gtk/options/content_exceptions_window_gtk.h" | 5 #include "chrome/browser/gtk/options/content_exceptions_window_gtk.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 gtk_list_store_set(list_store_, iter, COL_ACTION, | 192 gtk_list_store_set(list_store_, iter, COL_ACTION, |
| 193 WideToUTF8(action).c_str(), -1); | 193 WideToUTF8(action).c_str(), -1); |
| 194 | 194 |
| 195 bool is_off_the_record = model_->entry_is_off_the_record(row); | 195 bool is_off_the_record = model_->entry_is_off_the_record(row); |
| 196 PangoStyle style = | 196 PangoStyle style = |
| 197 is_off_the_record ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL; | 197 is_off_the_record ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL; |
| 198 gtk_list_store_set(list_store_, iter, COL_OTR, style, -1); | 198 gtk_list_store_set(list_store_, iter, COL_OTR, style, -1); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void ContentExceptionsWindowGtk::AcceptExceptionEdit( | 201 void ContentExceptionsWindowGtk::AcceptExceptionEdit( |
| 202 const HostContentSettingsMap::Pattern& pattern, | 202 const ContentSettingsPattern& pattern, |
| 203 ContentSetting setting, | 203 ContentSetting setting, |
| 204 bool is_off_the_record, | 204 bool is_off_the_record, |
| 205 int index, | 205 int index, |
| 206 bool is_new) { | 206 bool is_new) { |
| 207 DCHECK(!is_off_the_record || allow_off_the_record_); | 207 DCHECK(!is_off_the_record || allow_off_the_record_); |
| 208 | 208 |
| 209 if (!is_new) | 209 if (!is_new) |
| 210 model_->RemoveException(index); | 210 model_->RemoveException(index); |
| 211 | 211 |
| 212 model_->AddException(pattern, setting, is_off_the_record); | 212 model_->AddException(pattern, setting, is_off_the_record); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 228 // TODO(erg): http://crbug.com/34177 , support editing of more than one entry | 228 // TODO(erg): http://crbug.com/34177 , support editing of more than one entry |
| 229 // at a time. | 229 // at a time. |
| 230 gtk_widget_set_sensitive(edit_button_, num_selected == 1); | 230 gtk_widget_set_sensitive(edit_button_, num_selected == 1); |
| 231 gtk_widget_set_sensitive(remove_button_, num_selected >= 1); | 231 gtk_widget_set_sensitive(remove_button_, num_selected >= 1); |
| 232 gtk_widget_set_sensitive(remove_all_button_, row_count > 0); | 232 gtk_widget_set_sensitive(remove_all_button_, row_count > 0); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void ContentExceptionsWindowGtk::Add(GtkWidget* widget) { | 235 void ContentExceptionsWindowGtk::Add(GtkWidget* widget) { |
| 236 new ContentExceptionEditor(GTK_WINDOW(dialog_), | 236 new ContentExceptionEditor(GTK_WINDOW(dialog_), |
| 237 this, model_.get(), allow_off_the_record_, -1, | 237 this, model_.get(), allow_off_the_record_, -1, |
| 238 HostContentSettingsMap::Pattern(), | 238 ContentSettingsPattern(), |
| 239 CONTENT_SETTING_BLOCK, false); | 239 CONTENT_SETTING_BLOCK, false); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void ContentExceptionsWindowGtk::Edit(GtkWidget* widget) { | 242 void ContentExceptionsWindowGtk::Edit(GtkWidget* widget) { |
| 243 std::set<std::pair<int, int> > indices; | 243 std::set<std::pair<int, int> > indices; |
| 244 GetSelectedModelIndices(&indices); | 244 GetSelectedModelIndices(&indices); |
| 245 DCHECK_GT(indices.size(), 0u); | 245 DCHECK_GT(indices.size(), 0u); |
| 246 int index = indices.begin()->first; | 246 int index = indices.begin()->first; |
| 247 const HostContentSettingsMap::PatternSettingPair& entry = | 247 const HostContentSettingsMap::PatternSettingPair& entry = |
| 248 model_->entry_at(index); | 248 model_->entry_at(index); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 void ContentExceptionsWindowGtk::OnWindowDestroy(GtkWidget* widget) { | 328 void ContentExceptionsWindowGtk::OnWindowDestroy(GtkWidget* widget) { |
| 329 instances[model_->content_type()] = NULL; | 329 instances[model_->content_type()] = NULL; |
| 330 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 330 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void ContentExceptionsWindowGtk::OnTreeSelectionChanged( | 333 void ContentExceptionsWindowGtk::OnTreeSelectionChanged( |
| 334 GtkWidget* selection) { | 334 GtkWidget* selection) { |
| 335 UpdateButtonState(); | 335 UpdateButtonState(); |
| 336 } | 336 } |
| OLD | NEW |