| 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/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/feedback/feedback_util.h" | 12 #include "chrome/browser/feedback/feedback_util.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_finder.h" |
| 14 #include "chrome/browser/ui/webui/feedback_ui.h" | 15 #include "chrome/browser/ui/webui/feedback_ui.h" |
| 15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 16 #include "content/public/browser/navigation_controller.h" | 17 #include "content/public/browser/navigation_controller.h" |
| 17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 19 #include "grit/theme_resources.h" | 20 #include "grit/theme_resources.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/gfx/font.h" | 23 #include "ui/gfx/font.h" |
| 23 #include "ui/views/controls/button/text_button.h" | 24 #include "ui/views/controls/button/text_button.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 DCHECK(web_contents_); | 113 DCHECK(web_contents_); |
| 113 if (source == help_link_) { | 114 if (source == help_link_) { |
| 114 GURL help_url( | 115 GURL help_url( |
| 115 kind_ == CRASHED ? chrome::kCrashReasonURL : chrome::kKillReasonURL); | 116 kind_ == CRASHED ? chrome::kCrashReasonURL : chrome::kKillReasonURL); |
| 116 OpenURLParams params( | 117 OpenURLParams params( |
| 117 help_url, content::Referrer(), CURRENT_TAB, | 118 help_url, content::Referrer(), CURRENT_TAB, |
| 118 content::PAGE_TRANSITION_LINK, false); | 119 content::PAGE_TRANSITION_LINK, false); |
| 119 web_contents_->OpenURL(params); | 120 web_contents_->OpenURL(params); |
| 120 } else if (source == feedback_link_) { | 121 } else if (source == feedback_link_) { |
| 121 browser::ShowWebFeedbackView( | 122 browser::ShowWebFeedbackView( |
| 122 Browser::GetBrowserForController(&web_contents_->GetController(), NULL), | 123 browser::FindBrowserForController(&web_contents_->GetController(), |
| 124 NULL), |
| 123 l10n_util::GetStringUTF8(IDS_KILLED_TAB_FEEDBACK_MESSAGE), | 125 l10n_util::GetStringUTF8(IDS_KILLED_TAB_FEEDBACK_MESSAGE), |
| 124 std::string(kCategoryTagCrash)); | 126 std::string(kCategoryTagCrash)); |
| 125 } | 127 } |
| 126 } | 128 } |
| 127 | 129 |
| 128 void SadTabView::ButtonPressed(views::Button* source, | 130 void SadTabView::ButtonPressed(views::Button* source, |
| 129 const views::Event& event) { | 131 const views::Event& event) { |
| 130 DCHECK(web_contents_); | 132 DCHECK(web_contents_); |
| 131 DCHECK(source == reload_button_); | 133 DCHECK(source == reload_button_); |
| 132 web_contents_->GetController().Reload(true); | 134 web_contents_->GetController().Reload(true); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 259 } |
| 258 | 260 |
| 259 views::Link* SadTabView::CreateLink(const string16& text) { | 261 views::Link* SadTabView::CreateLink(const string16& text) { |
| 260 views::Link* link = new views::Link(text); | 262 views::Link* link = new views::Link(text); |
| 261 link->SetFont(base_font_.DeriveFont(kMessageFontSizeDelta)); | 263 link->SetFont(base_font_.DeriveFont(kMessageFontSizeDelta)); |
| 262 link->SetBackgroundColor(background()->get_color()); | 264 link->SetBackgroundColor(background()->get_color()); |
| 263 link->SetEnabledColor(kTextColor); | 265 link->SetEnabledColor(kTextColor); |
| 264 link->set_listener(this); | 266 link->set_listener(this); |
| 265 return link; | 267 return link; |
| 266 } | 268 } |
| OLD | NEW |