Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: athena/system/power_button_controller.cc

Issue 591803002: Add athena_strings.grd with athena specific strings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « athena/system/DEPS ('k') | athena/wm/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/system/power_button_controller.h" 5 #include "athena/system/power_button_controller.h"
6 6
7 #include "athena/screen/public/screen_manager.h" 7 #include "athena/screen/public/screen_manager.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "athena/strings/grit/athena_strings.h"
9 #include "chromeos/dbus/dbus_thread_manager.h" 9 #include "chromeos/dbus/dbus_thread_manager.h"
10 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/gfx/font_list.h" 11 #include "ui/gfx/font_list.h"
11 #include "ui/views/background.h" 12 #include "ui/views/background.h"
12 #include "ui/views/border.h" 13 #include "ui/views/border.h"
13 #include "ui/views/controls/label.h" 14 #include "ui/views/controls/label.h"
14 #include "ui/views/layout/box_layout.h" 15 #include "ui/views/layout/box_layout.h"
15 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
16 17
17 namespace athena { 18 namespace athena {
18 namespace { 19 namespace {
19 20
(...skipping 23 matching lines...) Expand all
43 void PowerButtonController::ShowShutdownWarningDialog() { 44 void PowerButtonController::ShowShutdownWarningDialog() {
44 state_ = STATE_SHUTDOWN_WARNING_VISIBLE; 45 state_ = STATE_SHUTDOWN_WARNING_VISIBLE;
45 46
46 shutdown_warning_message_.reset(new views::Widget); 47 shutdown_warning_message_.reset(new views::Widget);
47 48
48 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 49 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
49 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 50 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
50 params.parent = warning_message_container_; 51 params.parent = warning_message_container_;
51 shutdown_warning_message_->Init(params); 52 shutdown_warning_message_->Init(params);
52 53
53 // TODO(pkotwicz): Get text from the resource. 54 views::Label* label =
54 views::Label* label = new views::Label( 55 new views::Label(l10n_util::GetStringUTF16(IDS_ATHENA_SHUTDOWN_WARNING));
55 base::UTF8ToUTF16("Keep holding power button to shutdown."));
56 label->SetBackgroundColor(SK_ColorWHITE); 56 label->SetBackgroundColor(SK_ColorWHITE);
57 label->SetFontList(gfx::FontList().DeriveWithStyle(gfx::Font::BOLD)); 57 label->SetFontList(gfx::FontList().DeriveWithStyle(gfx::Font::BOLD));
58 58
59 views::View* container = new views::View; 59 views::View* container = new views::View;
60 container->AddChildView(label); 60 container->AddChildView(label);
61 61
62 const int kBorderSpacing = 50; 62 const int kBorderSpacing = 50;
63 container->SetLayoutManager(new views::BoxLayout( 63 container->SetLayoutManager(new views::BoxLayout(
64 views::BoxLayout::kHorizontal, kBorderSpacing, kBorderSpacing, 0)); 64 views::BoxLayout::kHorizontal, kBorderSpacing, kBorderSpacing, 0));
65 container->set_background( 65 container->set_background(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 ->GetPowerManagerClient() 117 ->GetPowerManagerClient()
118 ->RequestSuspend(); 118 ->RequestSuspend();
119 } 119 }
120 state_ = STATE_OTHER; 120 state_ = STATE_OTHER;
121 timer_.Stop(); 121 timer_.Stop();
122 shutdown_warning_message_.reset(); 122 shutdown_warning_message_.reset();
123 } 123 }
124 } 124 }
125 125
126 } // namespace athena 126 } // namespace athena
OLDNEW
« no previous file with comments | « athena/system/DEPS ('k') | athena/wm/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698