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

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: Remove extra include. Created 9 years 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) 2011 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/browser/tab_contents/tab_contents.h" 16 #include "content/browser/tab_contents/tab_contents.h"
15 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
16 #include "grit/theme_resources.h" 18 #include "grit/theme_resources.h"
17 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/font.h" 21 #include "ui/gfx/font.h"
20 #include "ui/views/controls/button/text_button.h" 22 #include "ui/views/controls/button/text_button.h"
21 #include "ui/views/controls/image_view.h" 23 #include "ui/views/controls/image_view.h"
22 #include "ui/views/controls/label.h" 24 #include "ui/views/controls/label.h"
23 #include "ui/views/controls/link.h" 25 #include "ui/views/controls/link.h"
24 #include "ui/views/layout/grid_layout.h" 26 #include "ui/views/layout/grid_layout.h"
25 27
26 static const int kPadding = 20; 28 static const int kPadding = 20;
27 static const float kMessageSize = 0.65f; 29 static const float kMessageSize = 0.65f;
28 static const SkColor kTextColor = SK_ColorWHITE; 30 static const SkColor kTextColor = SK_ColorWHITE;
29 static const SkColor kCrashColor = SkColorSetRGB(35, 48, 64); 31 static const SkColor kCrashColor = SkColorSetRGB(35, 48, 64);
30 static const SkColor kKillColor = SkColorSetRGB(57, 48, 88); 32 static const SkColor kKillColor = SkColorSetRGB(57, 48, 88);
31 33
34 const char kCategoryTagCrash[] = "Crash";
xiyuan 2011/12/22 02:18:23 "static" if we don't use it outside this file.
rkc 2011/12/22 22:41:46 const = internal linkage, static is not needed.
35
32 // Font size correction. 36 // Font size correction.
33 #if defined(CROS_FONTS_USING_BCI) 37 #if defined(CROS_FONTS_USING_BCI)
34 static const int kTitleFontSizeDelta = 1; 38 static const int kTitleFontSizeDelta = 1;
35 static const int kMessageFontSizeDelta = 0; 39 static const int kMessageFontSizeDelta = 0;
36 #else 40 #else
37 static const int kTitleFontSizeDelta = 2; 41 static const int kTitleFontSizeDelta = 2;
38 static const int kMessageFontSizeDelta = 1; 42 static const int kMessageFontSizeDelta = 1;
39 #endif 43 #endif
40 44
41 SadTabView::SadTabView(TabContents* tab_contents, Kind kind) 45 SadTabView::SadTabView(TabContents* tab_contents, Kind kind)
(...skipping 25 matching lines...) Expand all
67 google_util::AppendGoogleLocaleParam(GURL(kind_ == CRASHED ? 71 google_util::AppendGoogleLocaleParam(GURL(kind_ == CRASHED ?
68 chrome::kCrashReasonURL : 72 chrome::kCrashReasonURL :
69 chrome::kKillReasonURL)); 73 chrome::kKillReasonURL));
70 tab_contents_->OpenURL(OpenURLParams( 74 tab_contents_->OpenURL(OpenURLParams(
71 help_url, 75 help_url,
72 content::Referrer(), 76 content::Referrer(),
73 CURRENT_TAB, 77 CURRENT_TAB,
74 content::PAGE_TRANSITION_LINK, 78 content::PAGE_TRANSITION_LINK,
75 false /* is renderer initiated */)); 79 false /* is renderer initiated */));
76 } else if (source == feedback_link_) { 80 } else if (source == feedback_link_) {
77 browser::ShowHtmlBugReportView( 81 browser::ShowHtmlFeedbackView(
78 Browser::GetBrowserForController(&tab_contents_->controller(), NULL), 82 Browser::GetBrowserForController(&tab_contents_->controller(), NULL),
79 l10n_util::GetStringUTF8(IDS_KILLED_TAB_FEEDBACK_MESSAGE), 83 l10n_util::GetStringUTF8(IDS_KILLED_TAB_FEEDBACK_MESSAGE),
80 userfeedback::ChromeOsData_ChromeOsCategory_CRASH); 84 std::string(kCategoryTagCrash));
81 } 85 }
82 } 86 }
83 87
84 void SadTabView::ButtonPressed(views::Button* source, 88 void SadTabView::ButtonPressed(views::Button* source,
85 const views::Event& event) { 89 const views::Event& event) {
86 DCHECK(tab_contents_); 90 DCHECK(tab_contents_);
87 DCHECK(source == reload_button_); 91 DCHECK(source == reload_button_);
88 tab_contents_->controller().Reload(true); 92 tab_contents_->controller().Reload(true);
89 } 93 }
90 94
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 195 }
192 196
193 views::Link* SadTabView::CreateLink(const string16& text) { 197 views::Link* SadTabView::CreateLink(const string16& text) {
194 views::Link* link = new views::Link(text); 198 views::Link* link = new views::Link(text);
195 link->SetFont(base_font_.DeriveFont(kMessageFontSizeDelta)); 199 link->SetFont(base_font_.DeriveFont(kMessageFontSizeDelta));
196 link->SetBackgroundColor(background()->get_color()); 200 link->SetBackgroundColor(background()->get_color());
197 link->SetEnabledColor(kTextColor); 201 link->SetEnabledColor(kTextColor);
198 link->set_listener(this); 202 link->set_listener(this);
199 return link; 203 return link;
200 } 204 }
201
202
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698