Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: chrome/browser/ui/views/sad_tab_view.cc

Issue 9006003: Refactor and fix feedback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 2011 -> 2012 Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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>
8
7 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
8 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/feedback/feedback_util.h"
9 #include "chrome/browser/google/google_util.h" 12 #include "chrome/browser/google/google_util.h"
10 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/webui/bug_report_ui.h" 14 #include "chrome/browser/ui/webui/feedback_ui.h"
12 #include "chrome/browser/userfeedback/proto/extension.pb.h"
13 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
14 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
15 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
16 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
17 #include "grit/theme_resources.h" 19 #include "grit/theme_resources.h"
18 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/gfx/font.h" 22 #include "ui/gfx/font.h"
21 #include "ui/views/controls/button/text_button.h" 23 #include "ui/views/controls/button/text_button.h"
22 #include "ui/views/controls/image_view.h" 24 #include "ui/views/controls/image_view.h"
23 #include "ui/views/controls/label.h" 25 #include "ui/views/controls/label.h"
24 #include "ui/views/controls/link.h" 26 #include "ui/views/controls/link.h"
25 #include "ui/views/layout/grid_layout.h" 27 #include "ui/views/layout/grid_layout.h"
26 28
27 using content::OpenURLParams; 29 using content::OpenURLParams;
28 using content::WebContents; 30 using content::WebContents;
29 31
30 static const int kPadding = 20; 32 static const int kPadding = 20;
31 static const float kMessageSize = 0.65f; 33 static const float kMessageSize = 0.65f;
32 static const SkColor kTextColor = SK_ColorWHITE; 34 static const SkColor kTextColor = SK_ColorWHITE;
33 static const SkColor kCrashColor = SkColorSetRGB(35, 48, 64); 35 static const SkColor kCrashColor = SkColorSetRGB(35, 48, 64);
34 static const SkColor kKillColor = SkColorSetRGB(57, 48, 88); 36 static const SkColor kKillColor = SkColorSetRGB(57, 48, 88);
35 37
38 const char kCategoryTagCrash[] = "Crash";
39
36 // Font size correction. 40 // Font size correction.
37 #if defined(CROS_FONTS_USING_BCI) 41 #if defined(CROS_FONTS_USING_BCI)
38 static const int kTitleFontSizeDelta = 1; 42 static const int kTitleFontSizeDelta = 1;
39 static const int kMessageFontSizeDelta = 0; 43 static const int kMessageFontSizeDelta = 0;
40 #else 44 #else
41 static const int kTitleFontSizeDelta = 2; 45 static const int kTitleFontSizeDelta = 2;
42 static const int kMessageFontSizeDelta = 1; 46 static const int kMessageFontSizeDelta = 1;
43 #endif 47 #endif
44 48
45 SadTabView::SadTabView(WebContents* web_contents, Kind kind) 49 SadTabView::SadTabView(WebContents* web_contents, Kind kind)
(...skipping 26 matching lines...) Expand all
72 google_util::AppendGoogleLocaleParam(GURL(kind_ == CRASHED ? 76 google_util::AppendGoogleLocaleParam(GURL(kind_ == CRASHED ?
73 chrome::kCrashReasonURL : 77 chrome::kCrashReasonURL :
74 chrome::kKillReasonURL)); 78 chrome::kKillReasonURL));
75 web_contents_->OpenURL(OpenURLParams( 79 web_contents_->OpenURL(OpenURLParams(
76 help_url, 80 help_url,
77 content::Referrer(), 81 content::Referrer(),
78 CURRENT_TAB, 82 CURRENT_TAB,
79 content::PAGE_TRANSITION_LINK, 83 content::PAGE_TRANSITION_LINK,
80 false /* is renderer initiated */)); 84 false /* is renderer initiated */));
81 } else if (source == feedback_link_) { 85 } else if (source == feedback_link_) {
82 browser::ShowHtmlBugReportView( 86 browser::ShowHtmlFeedbackView(
83 Browser::GetBrowserForController(&web_contents_->GetController(), NULL), 87 Browser::GetBrowserForController(&web_contents_->GetController(), NULL),
84 l10n_util::GetStringUTF8(IDS_KILLED_TAB_FEEDBACK_MESSAGE), 88 l10n_util::GetStringUTF8(IDS_KILLED_TAB_FEEDBACK_MESSAGE),
85 userfeedback::ChromeOsData_ChromeOsCategory_CRASH); 89 std::string(kCategoryTagCrash));
86 } 90 }
87 } 91 }
88 92
89 void SadTabView::ButtonPressed(views::Button* source, 93 void SadTabView::ButtonPressed(views::Button* source,
90 const views::Event& event) { 94 const views::Event& event) {
91 DCHECK(web_contents_); 95 DCHECK(web_contents_);
92 DCHECK(source == reload_button_); 96 DCHECK(source == reload_button_);
93 web_contents_->GetController().Reload(true); 97 web_contents_->GetController().Reload(true);
94 } 98 }
95 99
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 200 }
197 201
198 views::Link* SadTabView::CreateLink(const string16& text) { 202 views::Link* SadTabView::CreateLink(const string16& text) {
199 views::Link* link = new views::Link(text); 203 views::Link* link = new views::Link(text);
200 link->SetFont(base_font_.DeriveFont(kMessageFontSizeDelta)); 204 link->SetFont(base_font_.DeriveFont(kMessageFontSizeDelta));
201 link->SetBackgroundColor(background()->get_color()); 205 link->SetBackgroundColor(background()->get_color());
202 link->SetEnabledColor(kTextColor); 206 link->SetEnabledColor(kTextColor);
203 link->set_listener(this); 207 link->set_listener(this);
204 return link; 208 return link;
205 } 209 }
206
207
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/webui/bidi_checker_web_ui_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698