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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "skia/ext/image_operations.h" | 16 #include "skia/ext/image_operations.h" |
17 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/base/models/combobox_model.h" | 19 #include "ui/base/models/combobox_model.h" |
20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/compositor/layer_type.h" |
21 #include "ui/events/event_utils.h" | 22 #include "ui/events/event_utils.h" |
22 #include "ui/events/keycodes/keyboard_codes.h" | 23 #include "ui/events/keycodes/keyboard_codes.h" |
23 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
24 #include "ui/gfx/geometry/size.h" | 25 #include "ui/gfx/geometry/size.h" |
25 #include "ui/gfx/image/image.h" | 26 #include "ui/gfx/image/image.h" |
26 #include "ui/message_center/message_center_style.h" | 27 #include "ui/message_center/message_center_style.h" |
27 #include "ui/message_center/views/message_center_view.h" | 28 #include "ui/message_center/views/message_center_view.h" |
28 #include "ui/resources/grit/ui_resources.h" | 29 #include "ui/resources/grit/ui_resources.h" |
29 #include "ui/strings/grit/ui_strings.h" | 30 #include "ui/strings/grit/ui_strings.h" |
30 #include "ui/views/background.h" | 31 #include "ui/views/background.h" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 notifier_group_combobox_(nullptr), | 420 notifier_group_combobox_(nullptr), |
420 scroller_(nullptr), | 421 scroller_(nullptr), |
421 provider_(provider) { | 422 provider_(provider) { |
422 // |provider_| may be null in tests. | 423 // |provider_| may be null in tests. |
423 if (provider_) | 424 if (provider_) |
424 provider_->AddObserver(this); | 425 provider_->AddObserver(this); |
425 | 426 |
426 SetFocusBehavior(FocusBehavior::ALWAYS); | 427 SetFocusBehavior(FocusBehavior::ALWAYS); |
427 set_background( | 428 set_background( |
428 views::Background::CreateSolidBackground(kMessageCenterBackgroundColor)); | 429 views::Background::CreateSolidBackground(kMessageCenterBackgroundColor)); |
429 SetPaintToLayer(true); | 430 SetPaintToLayer(ui::LAYER_TEXTURED); |
430 | 431 |
431 title_label_ = new views::Label( | 432 title_label_ = new views::Label( |
432 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_SETTINGS_BUTTON_LABEL), | 433 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_SETTINGS_BUTTON_LABEL), |
433 ui::ResourceBundle::GetSharedInstance().GetFontList( | 434 ui::ResourceBundle::GetSharedInstance().GetFontList( |
434 ui::ResourceBundle::MediumFont)); | 435 ui::ResourceBundle::MediumFont)); |
435 title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 436 title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
436 title_label_->SetMultiLine(true); | 437 title_label_->SetMultiLine(true); |
437 title_label_->SetBorder( | 438 title_label_->SetBorder( |
438 views::CreateEmptyBorder(kComputedTitleTopMargin, kTitleMargin, | 439 views::CreateEmptyBorder(kComputedTitleTopMargin, kTitleMargin, |
439 kComputedTitleBottomMargin, kTitleMargin)); | 440 kComputedTitleBottomMargin, kTitleMargin)); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 provider_->SetNotifierEnabled((*iter)->notifier(), (*iter)->checked()); | 629 provider_->SetNotifierEnabled((*iter)->notifier(), (*iter)->checked()); |
629 } | 630 } |
630 | 631 |
631 void NotifierSettingsView::OnPerformAction(views::Combobox* combobox) { | 632 void NotifierSettingsView::OnPerformAction(views::Combobox* combobox) { |
632 provider_->SwitchToNotifierGroup(combobox->selected_index()); | 633 provider_->SwitchToNotifierGroup(combobox->selected_index()); |
633 MessageCenterView* center_view = static_cast<MessageCenterView*>(parent()); | 634 MessageCenterView* center_view = static_cast<MessageCenterView*>(parent()); |
634 center_view->OnSettingsChanged(); | 635 center_view->OnSettingsChanged(); |
635 } | 636 } |
636 | 637 |
637 } // namespace message_center | 638 } // namespace message_center |
OLD | NEW |