| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/views/notifier_settings_view.h" | 5 #include "ui/message_center/views/notifier_settings_view.h" |
| 6 | 6 |
| 7 #include "grit/ui_strings.h" | 7 #include "grit/ui_strings.h" |
| 8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "ui/base/keycodes/keyboard_codes.h" | 9 #include "ui/base/keycodes/keyboard_codes.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 views::View* content = child_at(0); | 69 views::View* content = child_at(0); |
| 70 int content_width = width() - kMarginWidth * 2; | 70 int content_width = width() - kMarginWidth * 2; |
| 71 int content_height = content->GetHeightForWidth(content_width); | 71 int content_height = content->GetHeightForWidth(content_width); |
| 72 int y = std::max((height() - content_height) / 2, 0); | 72 int y = std::max((height() - content_height) / 2, 0); |
| 73 content->SetBounds(kMarginWidth, y, content_width, content_height); | 73 content->SetBounds(kMarginWidth, y, content_width, content_height); |
| 74 } | 74 } |
| 75 | 75 |
| 76 gfx::Size EntryView::GetPreferredSize() { | 76 gfx::Size EntryView::GetPreferredSize() { |
| 77 DCHECK_EQ(1, child_count()); | 77 DCHECK_EQ(1, child_count()); |
| 78 gfx::Size size = child_at(0)->GetPreferredSize(); | 78 gfx::Size size = child_at(0)->GetPreferredSize(); |
| 79 size.ClampToMin(gfx::Size(kMinimumWindowWidth, kEntryHeight)); | 79 size.ClampToLowerBound(gfx::Size(kMinimumWindowWidth, kEntryHeight)); |
| 80 return size; | 80 return size; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void EntryView::OnFocus() { | 83 void EntryView::OnFocus() { |
| 84 ScrollRectToVisible(GetLocalBounds()); | 84 ScrollRectToVisible(GetLocalBounds()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void EntryView::OnPaintFocusBorder(gfx::Canvas* canvas) { | 87 void EntryView::OnPaintFocusBorder(gfx::Canvas* canvas) { |
| 88 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | 88 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { |
| 89 canvas->DrawRect(gfx::Rect(2, 1, width() - 4, height() - 3), | 89 canvas->DrawRect(gfx::Rect(2, 1, width() - 4, height() - 3), |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 std::set<NotifierButton*>::iterator iter = buttons_.find( | 366 std::set<NotifierButton*>::iterator iter = buttons_.find( |
| 367 static_cast<NotifierButton*>(sender)); | 367 static_cast<NotifierButton*>(sender)); |
| 368 DCHECK(iter != buttons_.end()); | 368 DCHECK(iter != buttons_.end()); |
| 369 | 369 |
| 370 (*iter)->SetChecked(!(*iter)->checked()); | 370 (*iter)->SetChecked(!(*iter)->checked()); |
| 371 if (delegate_) | 371 if (delegate_) |
| 372 delegate_->SetNotifierEnabled((*iter)->notifier(), (*iter)->checked()); | 372 delegate_->SetNotifierEnabled((*iter)->notifier(), (*iter)->checked()); |
| 373 } | 373 } |
| 374 | 374 |
| 375 } // namespace message_center | 375 } // namespace message_center |
| OLD | NEW |