 Chromium Code Reviews
 Chromium Code Reviews Issue 2919903002:
  Remove references to ui/views/layout/layout_constants.h  (Closed)
    
  
    Issue 2919903002:
  Remove references to ui/views/layout/layout_constants.h  (Closed) 
  | 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 "chrome/browser/chromeos/power/idle_action_warning_dialog_view.h" | 5 #include "chrome/browser/chromeos/power/idle_action_warning_dialog_view.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 | 8 | 
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" | 
| 10 #include "base/location.h" | 10 #include "base/location.h" | 
| 11 #include "base/macros.h" | 11 #include "base/macros.h" | 
| 12 #include "chrome/browser/ui/browser_dialogs.h" | 12 #include "chrome/browser/ui/browser_dialogs.h" | 
| 13 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" | 
| 14 #include "ui/aura/window_event_dispatcher.h" | 15 #include "ui/aura/window_event_dispatcher.h" | 
| 15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" | 
| 16 #include "ui/base/l10n/time_format.h" | 17 #include "ui/base/l10n/time_format.h" | 
| 17 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" | 
| 18 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" | 
| 19 #include "ui/gfx/text_constants.h" | 20 #include "ui/gfx/text_constants.h" | 
| 20 #include "ui/views/border.h" | 21 #include "ui/views/border.h" | 
| 21 #include "ui/views/controls/label.h" | 22 #include "ui/views/controls/label.h" | 
| 22 #include "ui/views/layout/fill_layout.h" | 23 #include "ui/views/layout/fill_layout.h" | 
| 23 #include "ui/views/layout/layout_constants.h" | |
| 24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" | 
| 25 #include "ui/views/window/dialog_client_view.h" | 25 #include "ui/views/window/dialog_client_view.h" | 
| 26 | 26 | 
| 27 namespace chromeos { | 27 namespace chromeos { | 
| 28 | 28 | 
| 29 namespace { | 29 namespace { | 
| 30 | 30 | 
| 31 const int kIdleActionWarningContentWidth = 300; | 31 const int kIdleActionWarningContentWidth = 300; | 
| 32 | 32 | 
| 33 const int kCountdownUpdateIntervalMs = 1000; // 1 second. | 33 const int kCountdownUpdateIntervalMs = 1000; // 1 second. | 
| (...skipping 23 matching lines...) Expand all Loading... | |
| 57 return gfx::Size(width_, GetHeightForWidth(width_)); | 57 return gfx::Size(width_, GetHeightForWidth(width_)); | 
| 58 } | 58 } | 
| 59 | 59 | 
| 60 } // namespace | 60 } // namespace | 
| 61 | 61 | 
| 62 IdleActionWarningDialogView::IdleActionWarningDialogView( | 62 IdleActionWarningDialogView::IdleActionWarningDialogView( | 
| 63 base::TimeTicks idle_action_time) | 63 base::TimeTicks idle_action_time) | 
| 64 : idle_action_time_(idle_action_time), | 64 : idle_action_time_(idle_action_time), | 
| 65 label_(NULL) { | 65 label_(NULL) { | 
| 66 label_ = new FixedWidthLabel(kIdleActionWarningContentWidth); | 66 label_ = new FixedWidthLabel(kIdleActionWarningContentWidth); | 
| 67 label_->SetBorder(views::CreateEmptyBorder( | 67 gfx::Insets dialog_insets = ChromeLayoutProvider::Get()->GetInsetsMetric( | 
| 68 views::kPanelVertMargin, views::kButtonHEdgeMarginNew, | 68 views::INSETS_DIALOG_CONTENTS); | 
| 69 views::kPanelVertMargin, views::kButtonHEdgeMarginNew)); | 69 label_->SetBorder( | 
| 70 views::CreateEmptyBorder(dialog_insets.top(), dialog_insets.left(), | |
| 
Peter Kasting
2017/06/01 23:59:56
Nit: Just pass |dialog_insets|.  You could even in
 
ananta
2017/06/02 00:16:36
Thanks done.
 | |
| 71 dialog_insets.bottom(), dialog_insets.right())); | |
| 70 AddChildView(label_); | 72 AddChildView(label_); | 
| 71 SetLayoutManager(new views::FillLayout()); | 73 SetLayoutManager(new views::FillLayout()); | 
| 72 | 74 | 
| 73 UpdateLabel(); | 75 UpdateLabel(); | 
| 74 | 76 | 
| 75 views::DialogDelegate::CreateDialogWidget( | 77 views::DialogDelegate::CreateDialogWidget( | 
| 76 this, ash::Shell::GetPrimaryRootWindow(), NULL)->Show(); | 78 this, ash::Shell::GetPrimaryRootWindow(), NULL)->Show(); | 
| 77 | 79 | 
| 78 update_timer_.Start( | 80 update_timer_.Start( | 
| 79 FROM_HERE, | 81 FROM_HERE, | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 base::TimeDelta()); | 120 base::TimeDelta()); | 
| 119 label_->SetText(l10n_util::GetStringFUTF16( | 121 label_->SetText(l10n_util::GetStringFUTF16( | 
| 120 IDS_IDLE_WARNING_LOGOUT_WARNING, | 122 IDS_IDLE_WARNING_LOGOUT_WARNING, | 
| 121 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, | 123 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, | 
| 122 ui::TimeFormat::LENGTH_LONG, | 124 ui::TimeFormat::LENGTH_LONG, | 
| 123 10, | 125 10, | 
| 124 time_until_idle_action))); | 126 time_until_idle_action))); | 
| 125 } | 127 } | 
| 126 | 128 | 
| 127 } // namespace chromeos | 129 } // namespace chromeos | 
| OLD | NEW |