| 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/accelerators/exit_warning_handler.h" | 5 #include "ash/accelerators/exit_warning_handler.h" |
| 6 | 6 |
| 7 #include "ash/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 text_bounds, | 55 text_bounds, |
| 56 flags | gfx::Canvas::NO_SUBPIXEL_RENDERING); | 56 flags | gfx::Canvas::NO_SUBPIXEL_RENDERING); |
| 57 } | 57 } |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(ExitWarningLabel); | 59 DISALLOW_COPY_AND_ASSIGN(ExitWarningLabel); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 class ExitWarningWidgetDelegateView : public views::WidgetDelegateView { | 62 class ExitWarningWidgetDelegateView : public views::WidgetDelegateView { |
| 63 public: | 63 public: |
| 64 ExitWarningWidgetDelegateView() : text_width_(0), width_(0), height_(0) { | 64 ExitWarningWidgetDelegateView() : text_width_(0), width_(0), height_(0) { |
| 65 #ifdef OS_CHROMEOS |
| 66 text_ = l10n_util::GetStringUTF16(IDS_ASH_SIGN_OUT_WARNING_POPUP_TEXT); |
| 67 accessible_name_ = l10n_util::GetStringUTF16( |
| 68 IDS_ASH_SIGN_OUT_WARNING_POPUP_TEXT_ACCESSIBLE); |
| 69 #else |
| 65 text_ = l10n_util::GetStringUTF16(IDS_ASH_EXIT_WARNING_POPUP_TEXT); | 70 text_ = l10n_util::GetStringUTF16(IDS_ASH_EXIT_WARNING_POPUP_TEXT); |
| 66 accessible_name_ = | 71 accessible_name_ = |
| 67 l10n_util::GetStringUTF16(IDS_ASH_EXIT_WARNING_POPUP_TEXT_ACCESSIBLE); | 72 l10n_util::GetStringUTF16(IDS_ASH_EXIT_WARNING_POPUP_TEXT_ACCESSIBLE); |
| 73 #endif |
| 68 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 74 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 69 const gfx::FontList& font_list = | 75 const gfx::FontList& font_list = |
| 70 rb.GetFontList(ui::ResourceBundle::LargeFont); | 76 rb.GetFontList(ui::ResourceBundle::LargeFont); |
| 71 text_width_ = gfx::GetStringWidth(text_, font_list); | 77 text_width_ = gfx::GetStringWidth(text_, font_list); |
| 72 width_ = text_width_ + kHorizontalMarginAroundText; | 78 width_ = text_width_ + kHorizontalMarginAroundText; |
| 73 height_ = font_list.GetHeight() + kVerticalMarginAroundText; | 79 height_ = font_list.GetHeight() + kVerticalMarginAroundText; |
| 74 views::Label* label = new ExitWarningLabel; | 80 views::Label* label = new ExitWarningLabel; |
| 75 label->SetText(text_); | 81 label->SetText(text_); |
| 76 label->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 82 label->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 77 label->SetFontList(font_list); | 83 label->SetFontList(font_list); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 widget_->Show(); | 201 widget_->Show(); |
| 196 | 202 |
| 197 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 203 delegate->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 198 } | 204 } |
| 199 | 205 |
| 200 void ExitWarningHandler::Hide() { | 206 void ExitWarningHandler::Hide() { |
| 201 widget_.reset(); | 207 widget_.reset(); |
| 202 } | 208 } |
| 203 | 209 |
| 204 } // namespace ash | 210 } // namespace ash |
| OLD | NEW |