| 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/browser/ui/browser_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
| 12 #include "chrome/browser/ui/chrome_pages.h" | 12 #include "chrome/browser/ui/chrome_pages.h" |
| 13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 15 #include "components/feedback/feedback_util.h" | 15 #include "components/feedback/feedback_util.h" |
| 16 #include "components/strings/grit/components_strings.h" | 16 #include "components/strings/grit/components_strings.h" |
| 17 #include "content/public/browser/navigation_controller.h" | 17 #include "content/public/browser/navigation_controller.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/gfx/color_palette.h" | 21 #include "ui/gfx/color_palette.h" |
| 22 #include "ui/gfx/paint_vector_icon.h" | 22 #include "ui/gfx/paint_vector_icon.h" |
| 23 #include "ui/gfx/vector_icons_public.h" | 23 #include "ui/gfx/vector_icons_public.h" |
| 24 #include "ui/native_theme/common_theme.h" | 24 #include "ui/native_theme/common_theme.h" |
| 25 #include "ui/native_theme/native_theme.h" | 25 #include "ui/native_theme/native_theme.h" |
| 26 #include "ui/views/background.h" | 26 #include "ui/views/background.h" |
| 27 #include "ui/views/controls/button/blue_button.h" | 27 #include "ui/views/controls/button/md_text_button.h" |
| 28 #include "ui/views/controls/image_view.h" | 28 #include "ui/views/controls/image_view.h" |
| 29 #include "ui/views/controls/label.h" | 29 #include "ui/views/controls/label.h" |
| 30 #include "ui/views/controls/link.h" | 30 #include "ui/views/controls/link.h" |
| 31 #include "ui/views/layout/grid_layout.h" | 31 #include "ui/views/layout/grid_layout.h" |
| 32 #include "ui/views/layout/layout_constants.h" | 32 #include "ui/views/layout/layout_constants.h" |
| 33 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
| 34 | 34 |
| 35 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
| 36 #include "chrome/browser/memory/oom_memory_details.h" | 36 #include "chrome/browser/memory/oom_memory_details.h" |
| 37 #endif | 37 #endif |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 layout->StartRowWithPadding(0, column_set_id, 0, views::kPanelVertMargin); | 179 layout->StartRowWithPadding(0, column_set_id, 0, views::kPanelVertMargin); |
| 180 layout->AddView(message_, 2, 1, views::GridLayout::LEADING, | 180 layout->AddView(message_, 2, 1, views::GridLayout::LEADING, |
| 181 views::GridLayout::LEADING); | 181 views::GridLayout::LEADING); |
| 182 | 182 |
| 183 if (web_contents_) { | 183 if (web_contents_) { |
| 184 // In the cases of multiple crashes in a session the 'Feedback' button | 184 // In the cases of multiple crashes in a session the 'Feedback' button |
| 185 // replaces the 'Reload' button as primary action. | 185 // replaces the 'Reload' button as primary action. |
| 186 int button_type = total_crashes_ > kCrashesBeforeFeedbackIsDisplayed ? | 186 int button_type = total_crashes_ > kCrashesBeforeFeedbackIsDisplayed ? |
| 187 SAD_TAB_BUTTON_FEEDBACK : SAD_TAB_BUTTON_RELOAD; | 187 SAD_TAB_BUTTON_FEEDBACK : SAD_TAB_BUTTON_RELOAD; |
| 188 action_button_ = new views::BlueButton(this, | 188 action_button_ = views::MdTextButton::CreateSecondaryUiBlueButton(this, |
| 189 l10n_util::GetStringUTF16(button_type == SAD_TAB_BUTTON_FEEDBACK | 189 l10n_util::GetStringUTF16(button_type == SAD_TAB_BUTTON_FEEDBACK |
| 190 ? IDS_CRASHED_TAB_FEEDBACK_LINK | 190 ? IDS_CRASHED_TAB_FEEDBACK_LINK |
| 191 : IDS_SAD_TAB_RELOAD_LABEL)); | 191 : IDS_SAD_TAB_RELOAD_LABEL)); |
| 192 action_button_->set_tag(button_type); | 192 action_button_->set_tag(button_type); |
| 193 help_link_ = | 193 help_link_ = |
| 194 CreateLink(l10n_util::GetStringUTF16(IDS_LEARN_MORE), text_color); | 194 CreateLink(l10n_util::GetStringUTF16(IDS_LEARN_MORE), text_color); |
| 195 layout->StartRowWithPadding(0, column_set_id, 0, | 195 layout->StartRowWithPadding(0, column_set_id, 0, |
| 196 views::kPanelVerticalSpacing); | 196 views::kPanelVerticalSpacing); |
| 197 layout->AddView(help_link_, 1, 1, views::GridLayout::LEADING, | 197 layout->AddView(help_link_, 1, 1, views::GridLayout::LEADING, |
| 198 views::GridLayout::CENTER); | 198 views::GridLayout::CENTER); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 319 } |
| 320 | 320 |
| 321 namespace chrome { | 321 namespace chrome { |
| 322 | 322 |
| 323 SadTab* SadTab::Create(content::WebContents* web_contents, | 323 SadTab* SadTab::Create(content::WebContents* web_contents, |
| 324 SadTabKind kind) { | 324 SadTabKind kind) { |
| 325 return new SadTabView(web_contents, kind); | 325 return new SadTabView(web_contents, kind); |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace chrome | 328 } // namespace chrome |
| OLD | NEW |