| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/sad_tab_view.h" | 5 #include "chrome/browser/ui/views/sad_tab_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/app/vector_icons/vector_icons.h" | 11 #include "chrome/app/vector_icons/vector_icons.h" |
| 12 #include "chrome/browser/ui/views/harmony/layout_delegate.h" |
| 12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/gfx/color_palette.h" | 16 #include "ui/gfx/color_palette.h" |
| 16 #include "ui/gfx/paint_vector_icon.h" | 17 #include "ui/gfx/paint_vector_icon.h" |
| 17 #include "ui/native_theme/common_theme.h" | 18 #include "ui/native_theme/common_theme.h" |
| 18 #include "ui/native_theme/native_theme.h" | 19 #include "ui/native_theme/native_theme.h" |
| 19 #include "ui/views/background.h" | 20 #include "ui/views/background.h" |
| 20 #include "ui/views/controls/button/md_text_button.h" | 21 #include "ui/views/controls/button/md_text_button.h" |
| 21 #include "ui/views/controls/image_view.h" | 22 #include "ui/views/controls/image_view.h" |
| 22 #include "ui/views/controls/label.h" | 23 #include "ui/views/controls/label.h" |
| 23 #include "ui/views/controls/link.h" | 24 #include "ui/views/controls/link.h" |
| 24 #include "ui/views/layout/grid_layout.h" | 25 #include "ui/views/layout/grid_layout.h" |
| 25 #include "ui/views/layout/layout_constants.h" | 26 #include "ui/views/layout/layout_constants.h" |
| 26 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 const int kMaxContentWidth = 600; | 31 constexpr int kMaxContentWidth = 600; |
| 31 const int kMinColumnWidth = 120; | 32 constexpr int kMinColumnWidth = 120; |
| 33 constexpr int kTitleBottomSpacing = 13; |
| 32 | 34 |
| 33 } // namespace | 35 } // namespace |
| 34 | 36 |
| 35 SadTabView::SadTabView(content::WebContents* web_contents, | 37 SadTabView::SadTabView(content::WebContents* web_contents, |
| 36 chrome::SadTabKind kind) | 38 chrome::SadTabKind kind) |
| 37 : SadTab(web_contents, kind) { | 39 : SadTab(web_contents, kind) { |
| 38 // Set the background color. | 40 // Set the background color. |
| 39 set_background( | 41 set_background( |
| 40 views::Background::CreateSolidBackground(GetNativeTheme()->GetSystemColor( | 42 views::Background::CreateSolidBackground(GetNativeTheme()->GetSystemColor( |
| 41 ui::NativeTheme::kColorId_DialogBackground))); | 43 ui::NativeTheme::kColorId_DialogBackground))); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 72 const SkColor text_color = GetNativeTheme()->GetSystemColor( | 74 const SkColor text_color = GetNativeTheme()->GetSystemColor( |
| 73 ui::NativeTheme::kColorId_LabelDisabledColor); | 75 ui::NativeTheme::kColorId_LabelDisabledColor); |
| 74 | 76 |
| 75 message_ = CreateLabel(l10n_util::GetStringUTF16(GetMessage())); | 77 message_ = CreateLabel(l10n_util::GetStringUTF16(GetMessage())); |
| 76 | 78 |
| 77 message_->SetMultiLine(true); | 79 message_->SetMultiLine(true); |
| 78 message_->SetEnabledColor(text_color); | 80 message_->SetEnabledColor(text_color); |
| 79 message_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 81 message_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 80 message_->SetLineHeight(views::kPanelSubVerticalSpacing); | 82 message_->SetLineHeight(views::kPanelSubVerticalSpacing); |
| 81 | 83 |
| 82 layout->StartRowWithPadding(0, column_set_id, 0, views::kPanelVertMargin); | 84 layout->StartRowWithPadding(0, column_set_id, 0, kTitleBottomSpacing); |
| 83 layout->AddView(message_, 2, 1, views::GridLayout::LEADING, | 85 layout->AddView(message_, 2, 1, views::GridLayout::LEADING, |
| 84 views::GridLayout::LEADING); | 86 views::GridLayout::LEADING); |
| 85 | 87 |
| 86 action_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( | 88 action_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( |
| 87 this, l10n_util::GetStringUTF16(GetButtonTitle())); | 89 this, l10n_util::GetStringUTF16(GetButtonTitle())); |
| 88 help_link_ = | 90 help_link_ = |
| 89 CreateLink(l10n_util::GetStringUTF16(GetHelpLinkTitle()), text_color); | 91 CreateLink(l10n_util::GetStringUTF16(GetHelpLinkTitle()), text_color); |
| 90 layout->StartRowWithPadding(0, column_set_id, 0, | 92 layout->StartRowWithPadding(0, column_set_id, 0, |
| 91 views::kPanelVerticalSpacing); | 93 views::kPanelVerticalSpacing); |
| 92 layout->AddView(help_link_, 1, 1, views::GridLayout::LEADING, | 94 layout->AddView(help_link_, 1, 1, views::GridLayout::LEADING, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 167 } |
| 166 | 168 |
| 167 namespace chrome { | 169 namespace chrome { |
| 168 | 170 |
| 169 SadTab* SadTab::Create(content::WebContents* web_contents, | 171 SadTab* SadTab::Create(content::WebContents* web_contents, |
| 170 SadTabKind kind) { | 172 SadTabKind kind) { |
| 171 return new SadTabView(web_contents, kind); | 173 return new SadTabView(web_contents, kind); |
| 172 } | 174 } |
| 173 | 175 |
| 174 } // namespace chrome | 176 } // namespace chrome |
| OLD | NEW |