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

Side by Side Diff: chrome/browser/views/bug_report_view.h

Issue 3061044: HTML UI implementation for the Google Feedback client for Chrome/ChromeOS.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 4 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
« no previous file with comments | « chrome/browser/views/browser_dialogs.h ('k') | chrome/browser/views/bug_report_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_
6 #define CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_
7 #pragma once
8
9 #include "chrome/common/net/url_fetcher.h"
10 #include "gfx/rect.h"
11 #include "googleurl/src/gurl.h"
12 #include "views/controls/button/radio_button.h"
13 #include "views/controls/combobox/combobox.h"
14 #include "views/controls/textfield/textfield.h"
15 #include "views/controls/link.h"
16 #include "views/controls/image_view.h"
17 #include "views/view.h"
18 #include "views/window/dialog_delegate.h"
19
20 #if defined(OS_CHROMEOS)
21 #include "chrome/browser/chromeos/cros/syslogs_library.h"
22 #include "chrome/browser/chromeos/cros/cros_library.h"
23 #endif
24
25 namespace views {
26 class Checkbox;
27 class Label;
28 class Throbber;
29 class Window;
30 class RadioButton;
31 class Link;
32 }
33
34 class Profile;
35 class TabContents;
36 class BugReportComboBoxModel;
37
38 // BugReportView draws the dialog that allows the user to report a
39 // bug in rendering a particular page (note: this is not a crash
40 // report, which are handled separately by Breakpad). It packages
41 // up the URL, a text description, system information and optionally
42 // a screenshot; then it submits the info through https to the google
43 // feedback chrome end-point.
44 //
45 // Note: This UI is being used for the Chrome OS dogfood release only
46 // In the very next iteration, this will be replaced by a HTML
47 // based UI, which will be common for all platforms
48 class BugReportView : public views::View,
49 public views::DialogDelegate,
50 public views::Combobox::Listener,
51 #if defined(OS_CHROMEOS)
52 public views::LinkController,
53 #endif
54 public views::Textfield::Controller {
55 public:
56 BugReportView(Profile* profile, TabContents* tab);
57 virtual ~BugReportView();
58
59 // NOTE: set_captured_image takes ownership of the vector
60 void set_captured_image(std::vector<unsigned char>* png_data) {
61 captured_image_.reset(png_data);
62 }
63
64 void set_screen_size(const gfx::Rect& screen_size) {
65 screen_size_ = screen_size;
66 }
67
68 // Set all additional reporting controls to disabled
69 // if phishing report
70 void UpdateReportingControls(bool is_phishing_report);
71
72 // Overridden from views::View:
73 virtual gfx::Size GetPreferredSize();
74
75 // views::Textfield::Controller implementation:
76 virtual void ContentsChanged(views::Textfield* sender,
77 const string16& new_contents);
78 virtual bool HandleKeystroke(views::Textfield* sender,
79 const views::Textfield::Keystroke& key);
80
81 // views::Combobox::Listener implementation:
82 virtual void ItemChanged(views::Combobox* combobox, int prev_index,
83 int new_index);
84
85 #if defined(OS_CHROMEOS)
86 // Overridden from views::LinkController:
87 virtual void LinkActivated(views::Link* source, int event_flags);
88
89 // Disable the include last image radio control
90 void DisableLastImageRadio() {
91 include_last_screen_image_radio_->SetEnabled(false);
92 }
93
94 // NOTE: set_last_image takes ownership of the vector
95 void set_last_image(std::vector<unsigned char>* png_data) {
96 last_image_.reset(png_data);
97 }
98 #endif
99
100 // Overridden from views::DialogDelegate:
101 virtual std::wstring GetDialogButtonLabel(
102 MessageBoxFlags::DialogButton button) const;
103 virtual int GetDefaultDialogButton() const;
104 virtual bool CanResize() const;
105 virtual bool CanMaximize() const;
106 virtual bool IsAlwaysOnTop() const;
107 virtual bool HasAlwaysOnTopMenu() const;
108 virtual bool IsModal() const;
109 virtual std::wstring GetWindowTitle() const;
110 virtual bool Accept();
111 virtual views::View* GetContentsView();
112
113 private:
114 class PostCleanup;
115
116 // Set OS Version information in a string (maj.minor.build SP)
117 void SetOSVersion(std::string *os_version);
118
119 // Initializes the controls on the dialog.
120 void SetupControl();
121 // helper function to create a MIME part boundary string
122 void CreateMimeBoundary(std::string *out);
123 // Sends the data via an HTTP POST
124 void SendReport();
125
126 // Redirects the user to Google's phishing reporting page.
127 void ReportPhishing();
128
129 views::Label* bug_type_label_;
130 views::Combobox* bug_type_combo_;
131 views::Label* page_title_label_;
132 views::Label* page_title_text_;
133 views::Label* page_url_label_;
134 views::Textfield* page_url_text_;
135 views::Label* description_label_;
136 views::Textfield* description_text_;
137 views::Checkbox* include_page_source_checkbox_;
138 #if defined(OS_CHROMEOS)
139 views::Label* user_email_label_;
140 views::Textfield* user_email_text_;
141 views::RadioButton* include_new_screen_image_radio_;
142 views::RadioButton* include_last_screen_image_radio_;
143 views::RadioButton* include_no_screen_image_radio_;
144 views::Link* system_information_url_control_;
145
146 scoped_ptr<chromeos::LogDictionaryType> sys_info_;
147 scoped_ptr< std::vector<unsigned char> > last_image_;
148 #endif
149 views::Checkbox* include_page_image_checkbox_;
150
151
152 scoped_ptr<BugReportComboBoxModel> bug_type_model_;
153
154 Profile* profile_;
155
156 std::wstring version_;
157 gfx::Rect screen_size_;
158 scoped_ptr< std::vector<unsigned char> > captured_image_;
159
160 TabContents* tab_;
161
162 // Used to distinguish the report type: Phishing or other.
163 int problem_type_;
164
165 // Save the description the user types in when we clear the dialog for the
166 // phishing option. If the user changes the report type back, we reinstate
167 // their original text so they don't have to type it again.
168 std::wstring old_report_text_;
169
170 DISALLOW_COPY_AND_ASSIGN(BugReportView);
171 };
172
173 #endif // CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/browser_dialogs.h ('k') | chrome/browser/views/bug_report_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698