| 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/exception_editor_view.h" | 5 #include "chrome/browser/views/options/exception_editor_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/content_exceptions_table_model.h" | 10 #include "chrome/browser/content_exceptions_table_model.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return this; | 88 return this; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void ExceptionEditorView::ContentsChanged(views::Textfield* sender, | 91 void ExceptionEditorView::ContentsChanged(views::Textfield* sender, |
| 92 const std::wstring& new_contents) { | 92 const std::wstring& new_contents) { |
| 93 GetDialogClientView()->UpdateDialogButtons(); | 93 GetDialogClientView()->UpdateDialogButtons(); |
| 94 UpdateImageView(pattern_iv_, IsPatternValid(ContentSettingsPattern( | 94 UpdateImageView(pattern_iv_, IsPatternValid(ContentSettingsPattern( |
| 95 UTF16ToUTF8(pattern_tf_->text())), incognito_cb_->checked())); | 95 UTF16ToUTF8(pattern_tf_->text())), incognito_cb_->checked())); |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool ExceptionEditorView::HandleKeystroke( | 98 bool ExceptionEditorView::HandleKeyEvent(views::Textfield* sender, |
| 99 views::Textfield* sender, | 99 const views::KeyEvent& key_event) { |
| 100 const views::Textfield::Keystroke& key) { | |
| 101 return false; | 100 return false; |
| 102 } | 101 } |
| 103 | 102 |
| 104 void ExceptionEditorView::Init() { | 103 void ExceptionEditorView::Init() { |
| 105 using views::GridLayout; | 104 using views::GridLayout; |
| 106 | 105 |
| 107 pattern_tf_ = new views::Textfield(); | 106 pattern_tf_ = new views::Textfield(); |
| 108 pattern_tf_->SetText(UTF8ToUTF16(pattern_.AsString())); | 107 pattern_tf_->SetText(UTF8ToUTF16(pattern_.AsString())); |
| 109 pattern_tf_->SetController(this); | 108 pattern_tf_->SetController(this); |
| 110 | 109 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 return is_new() ? is_valid_pattern : (!pattern.AsString().empty() && | 165 return is_new() ? is_valid_pattern : (!pattern.AsString().empty() && |
| 167 ((pattern_ == pattern) || is_valid_pattern)); | 166 ((pattern_ == pattern) || is_valid_pattern)); |
| 168 } | 167 } |
| 169 | 168 |
| 170 void ExceptionEditorView::UpdateImageView(views::ImageView* image_view, | 169 void ExceptionEditorView::UpdateImageView(views::ImageView* image_view, |
| 171 bool is_valid) { | 170 bool is_valid) { |
| 172 return image_view->SetImage( | 171 return image_view->SetImage( |
| 173 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 172 ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 174 is_valid ? IDR_INPUT_GOOD : IDR_INPUT_ALERT)); | 173 is_valid ? IDR_INPUT_GOOD : IDR_INPUT_ALERT)); |
| 175 } | 174 } |
| OLD | NEW |