| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ash/common/accelerators/exit_warning_handler.h" | 5 #include "ash/common/accelerators/exit_warning_handler.h" |
| 6 | 6 |
| 7 #include "ash/common/shell_delegate.h" | 7 #include "ash/common/shell_delegate.h" |
| 8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 const SkColor kTextColor = SK_ColorWHITE; | 33 const SkColor kTextColor = SK_ColorWHITE; |
| 34 // Color of the window background. | 34 // Color of the window background. |
| 35 const SkColor kWindowBackgroundColor = SkColorSetARGB(0xC0, 0x0, 0x0, 0x0); | 35 const SkColor kWindowBackgroundColor = SkColorSetARGB(0xC0, 0x0, 0x0, 0x0); |
| 36 // Radius of the rounded corners of the window. | 36 // Radius of the rounded corners of the window. |
| 37 const int kWindowCornerRadius = 2; | 37 const int kWindowCornerRadius = 2; |
| 38 const int kHorizontalMarginAroundText = 100; | 38 const int kHorizontalMarginAroundText = 100; |
| 39 const int kVerticalMarginAroundText = 100; | 39 const int kVerticalMarginAroundText = 100; |
| 40 | 40 |
| 41 class ExitWarningWidgetDelegateView : public views::WidgetDelegateView { | 41 class ExitWarningWidgetDelegateView : public views::WidgetDelegateView { |
| 42 public: | 42 public: |
| 43 ExitWarningWidgetDelegateView() : text_width_(0), width_(0), height_(0) { | 43 ExitWarningWidgetDelegateView() |
| 44 #ifdef OS_CHROMEOS | 44 : text_(l10n_util::GetStringUTF16(IDS_ASH_SIGN_OUT_WARNING_POPUP_TEXT)), |
| 45 text_ = l10n_util::GetStringUTF16(IDS_ASH_SIGN_OUT_WARNING_POPUP_TEXT); | 45 accessible_name_(l10n_util::GetStringUTF16( |
| 46 accessible_name_ = l10n_util::GetStringUTF16( | 46 IDS_ASH_SIGN_OUT_WARNING_POPUP_TEXT_ACCESSIBLE)), |
| 47 IDS_ASH_SIGN_OUT_WARNING_POPUP_TEXT_ACCESSIBLE); | 47 text_width_(0), |
| 48 #else | 48 width_(0), |
| 49 text_ = l10n_util::GetStringUTF16(IDS_ASH_EXIT_WARNING_POPUP_TEXT); | 49 height_(0) { |
| 50 accessible_name_ = | |
| 51 l10n_util::GetStringUTF16(IDS_ASH_EXIT_WARNING_POPUP_TEXT_ACCESSIBLE); | |
| 52 #endif | |
| 53 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 50 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 54 const gfx::FontList& font_list = | 51 const gfx::FontList& font_list = |
| 55 rb.GetFontList(ui::ResourceBundle::LargeFont); | 52 rb.GetFontList(ui::ResourceBundle::LargeFont); |
| 56 text_width_ = gfx::GetStringWidth(text_, font_list); | 53 text_width_ = gfx::GetStringWidth(text_, font_list); |
| 57 width_ = text_width_ + kHorizontalMarginAroundText; | 54 width_ = text_width_ + kHorizontalMarginAroundText; |
| 58 height_ = font_list.GetHeight() + kVerticalMarginAroundText; | 55 height_ = font_list.GetHeight() + kVerticalMarginAroundText; |
| 59 views::Label* label = new views::Label(); | 56 views::Label* label = new views::Label(); |
| 60 label->SetText(text_); | 57 label->SetText(text_); |
| 61 label->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 58 label->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 62 label->SetFontList(font_list); | 59 label->SetFontList(font_list); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 widget_->Show(); | 166 widget_->Show(); |
| 170 | 167 |
| 171 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 168 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 172 } | 169 } |
| 173 | 170 |
| 174 void ExitWarningHandler::Hide() { | 171 void ExitWarningHandler::Hide() { |
| 175 widget_.reset(); | 172 widget_.reset(); |
| 176 } | 173 } |
| 177 | 174 |
| 178 } // namespace ash | 175 } // namespace ash |
| OLD | NEW |