| 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 "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 constexpr int kBulletWidth = 20; | 36 constexpr int kBulletWidth = 20; |
| 37 constexpr int kBulletPadding = 13; | 37 constexpr int kBulletPadding = 13; |
| 38 | 38 |
| 39 views::Label* CreateFormattedLabel(const base::string16& message) { | 39 views::Label* CreateFormattedLabel(const base::string16& message) { |
| 40 views::Label* label = | 40 views::Label* label = |
| 41 new views::Label(message, views::style::CONTEXT_LABEL, STYLE_SECONDARY); | 41 new views::Label(message, views::style::CONTEXT_LABEL, STYLE_SECONDARY); |
| 42 | 42 |
| 43 label->SetMultiLine(true); | 43 label->SetMultiLine(true); |
| 44 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 44 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 45 label->SetLineHeight(ChromeLayoutProvider::Get()->GetDistanceMetric( | 45 label->SetLineHeight(ChromeLayoutProvider::Get()->GetDistanceMetric( |
| 46 DISTANCE_UNRELATED_CONTROL_VERTICAL)); | 46 views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
| 47 return label; | 47 return label; |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 SadTabView::SadTabView(content::WebContents* web_contents, | 52 SadTabView::SadTabView(content::WebContents* web_contents, |
| 53 chrome::SadTabKind kind) | 53 chrome::SadTabKind kind) |
| 54 : SadTab(web_contents, kind) { | 54 : SadTab(web_contents, kind) { |
| 55 SetBackground(views::CreateThemedSolidBackground( | 55 SetBackground(views::CreateThemedSolidBackground( |
| 56 this, ui::NativeTheme::kColorId_DialogBackground)); | 56 this, ui::NativeTheme::kColorId_DialogBackground)); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 help_link_ = new views::Link(l10n_util::GetStringUTF16(GetHelpLinkTitle())); | 136 help_link_ = new views::Link(l10n_util::GetStringUTF16(GetHelpLinkTitle())); |
| 137 help_link_->set_listener(this); | 137 help_link_->set_listener(this); |
| 138 layout->StartRowWithPadding(0, column_set_id, 0, | 138 layout->StartRowWithPadding(0, column_set_id, 0, |
| 139 unrelated_vertical_spacing_large); | 139 unrelated_vertical_spacing_large); |
| 140 layout->AddView(help_link_, 1, 1, views::GridLayout::LEADING, | 140 layout->AddView(help_link_, 1, 1, views::GridLayout::LEADING, |
| 141 views::GridLayout::CENTER); | 141 views::GridLayout::CENTER); |
| 142 layout->AddView(action_button_, 1, 1, views::GridLayout::TRAILING, | 142 layout->AddView(action_button_, 1, 1, views::GridLayout::TRAILING, |
| 143 views::GridLayout::LEADING); | 143 views::GridLayout::LEADING); |
| 144 | 144 |
| 145 layout->AddPaddingRow(2, provider->GetDistanceMetric( | 145 layout->AddPaddingRow(2, provider->GetDistanceMetric( |
| 146 DISTANCE_UNRELATED_CONTROL_VERTICAL)); | 146 views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
| 147 | 147 |
| 148 views::Widget::InitParams sad_tab_params( | 148 views::Widget::InitParams sad_tab_params( |
| 149 views::Widget::InitParams::TYPE_CONTROL); | 149 views::Widget::InitParams::TYPE_CONTROL); |
| 150 | 150 |
| 151 // It is not possible to create a native_widget_win that has no parent in | 151 // It is not possible to create a native_widget_win that has no parent in |
| 152 // and later re-parent it. | 152 // and later re-parent it. |
| 153 // TODO(avi): This is a cheat. Can this be made cleaner? | 153 // TODO(avi): This is a cheat. Can this be made cleaner? |
| 154 sad_tab_params.parent = web_contents->GetNativeView(); | 154 sad_tab_params.parent = web_contents->GetNativeView(); |
| 155 | 155 |
| 156 set_owned_by_client(); | 156 set_owned_by_client(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 205 } |
| 206 | 206 |
| 207 namespace chrome { | 207 namespace chrome { |
| 208 | 208 |
| 209 SadTab* SadTab::Create(content::WebContents* web_contents, | 209 SadTab* SadTab::Create(content::WebContents* web_contents, |
| 210 SadTabKind kind) { | 210 SadTabKind kind) { |
| 211 return new SadTabView(web_contents, kind); | 211 return new SadTabView(web_contents, kind); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace chrome | 214 } // namespace chrome |
| OLD | NEW |