| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_ |
| 7 | 7 |
| 8 #include "chrome/common/net/url_fetcher.h" | 8 #include "chrome/common/net/url_fetcher.h" |
| 9 #include "gfx/rect.h" |
| 9 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 #include "views/controls/button/radio_button.h" |
| 10 #include "views/controls/combobox/combobox.h" | 12 #include "views/controls/combobox/combobox.h" |
| 11 #include "views/controls/textfield/textfield.h" | 13 #include "views/controls/textfield/textfield.h" |
| 14 #include "views/controls/link.h" |
| 15 #include "views/controls/image_view.h" |
| 12 #include "views/view.h" | 16 #include "views/view.h" |
| 13 #include "views/window/dialog_delegate.h" | 17 #include "views/window/dialog_delegate.h" |
| 14 | 18 |
| 15 namespace views { | 19 namespace views { |
| 16 class Checkbox; | 20 class Checkbox; |
| 17 class Label; | 21 class Label; |
| 18 class Throbber; | 22 class Throbber; |
| 19 class Window; | 23 class Window; |
| 24 class RadioButton; |
| 25 class Link; |
| 20 } | 26 } |
| 21 | 27 |
| 22 class Profile; | 28 class Profile; |
| 23 class TabContents; | 29 class TabContents; |
| 24 class BugReportComboBoxModel; | 30 class BugReportComboBoxModel; |
| 25 | 31 |
| 26 // BugReportView draws the dialog that allows the user to report a | 32 // BugReportView draws the dialog that allows the user to report a |
| 27 // bug in rendering a particular page (note: this is not a crash | 33 // bug in rendering a particular page (note: this is not a crash |
| 28 // report, which are handled separately by Breakpad). It packages | 34 // report, which are handled separately by Breakpad). It packages |
| 29 // up the URL, a text description, and optionally a screenshot and/or | 35 // up the URL, a text description, and optionally a screenshot and/or |
| 30 // the HTML page source, and submits them as an HTTP POST to the | 36 // the HTML page source, and submits them as an HTTP POST to the |
| 31 // URL stored in the string resource IDS_BUGREPORT_POST_URL. | 37 // URL stored in the string resource IDS_BUGREPORT_POST_URL. |
| 32 // | 38 // |
| 33 // Note: The UI team hasn't defined yet how the bug report UI will look like. | 39 // Note: The UI team hasn't defined yet how the bug report UI will look like. |
| 34 // So now use dialog as a placeholder. | 40 // So now use dialog as a placeholder. |
| 35 class BugReportView : public views::View, | 41 class BugReportView : public views::View, |
| 36 public views::DialogDelegate, | 42 public views::DialogDelegate, |
| 37 public views::Combobox::Listener, | 43 public views::Combobox::Listener, |
| 44 #if defined(OS_CHROMEOS) |
| 45 public views::LinkController, |
| 46 #endif |
| 38 public views::Textfield::Controller { | 47 public views::Textfield::Controller { |
| 39 public: | 48 public: |
| 40 explicit BugReportView(Profile* profile, TabContents* tab); | 49 explicit BugReportView(Profile* profile, TabContents* tab); |
| 41 virtual ~BugReportView(); | 50 virtual ~BugReportView(); |
| 42 | 51 |
| 43 // NOTE: set_png_data takes ownership of the vector | 52 // NOTE: set_png_data takes ownership of the vector |
| 44 void set_png_data(std::vector<unsigned char> *png_data) { | 53 void set_png_data(std::vector<unsigned char> *png_data) { |
| 45 png_data_.reset(png_data); | 54 png_data_.reset(png_data); |
| 46 }; | 55 }; |
| 56 void set_screenshot_size(const gfx::Rect& screenshot_size) { |
| 57 screenshot_size_ = screenshot_size; |
| 58 }; |
| 59 // Set all additional reporting controls to disabled |
| 60 // if phishing report |
| 61 void UpdateReportingControls(bool is_phishing_report); |
| 47 | 62 |
| 48 // Overridden from views::View: | 63 // Overridden from views::View: |
| 49 virtual gfx::Size GetPreferredSize(); | 64 virtual gfx::Size GetPreferredSize(); |
| 50 | 65 |
| 51 // views::Textfield::Controller implementation: | 66 // views::Textfield::Controller implementation: |
| 52 virtual void ContentsChanged(views::Textfield* sender, | 67 virtual void ContentsChanged(views::Textfield* sender, |
| 53 const string16& new_contents); | 68 const string16& new_contents); |
| 54 virtual bool HandleKeystroke(views::Textfield* sender, | 69 virtual bool HandleKeystroke(views::Textfield* sender, |
| 55 const views::Textfield::Keystroke& key); | 70 const views::Textfield::Keystroke& key); |
| 56 | 71 |
| 57 // views::Combobox::Listener implementation: | 72 // views::Combobox::Listener implementation: |
| 58 virtual void ItemChanged(views::Combobox* combobox, int prev_index, | 73 virtual void ItemChanged(views::Combobox* combobox, int prev_index, |
| 59 int new_index); | 74 int new_index); |
| 60 | 75 |
| 76 #if defined(OS_CHROMEOS) |
| 77 // Overridden from views::LinkController: |
| 78 virtual void LinkActivated(views::Link* source, int event_flags); |
| 79 #endif |
| 80 |
| 61 // Overridden from views::DialogDelegate: | 81 // Overridden from views::DialogDelegate: |
| 62 virtual std::wstring GetDialogButtonLabel( | 82 virtual std::wstring GetDialogButtonLabel( |
| 63 MessageBoxFlags::DialogButton button) const; | 83 MessageBoxFlags::DialogButton button) const; |
| 64 virtual int GetDefaultDialogButton() const; | 84 virtual int GetDefaultDialogButton() const; |
| 65 virtual bool CanResize() const; | 85 virtual bool CanResize() const; |
| 66 virtual bool CanMaximize() const; | 86 virtual bool CanMaximize() const; |
| 67 virtual bool IsAlwaysOnTop() const; | 87 virtual bool IsAlwaysOnTop() const; |
| 68 virtual bool HasAlwaysOnTopMenu() const; | 88 virtual bool HasAlwaysOnTopMenu() const; |
| 69 virtual bool IsModal() const; | 89 virtual bool IsModal() const; |
| 70 virtual std::wstring GetWindowTitle() const; | 90 virtual std::wstring GetWindowTitle() const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 89 | 109 |
| 90 views::Label* bug_type_label_; | 110 views::Label* bug_type_label_; |
| 91 views::Combobox* bug_type_combo_; | 111 views::Combobox* bug_type_combo_; |
| 92 views::Label* page_title_label_; | 112 views::Label* page_title_label_; |
| 93 views::Label* page_title_text_; | 113 views::Label* page_title_text_; |
| 94 views::Label* page_url_label_; | 114 views::Label* page_url_label_; |
| 95 views::Textfield* page_url_text_; | 115 views::Textfield* page_url_text_; |
| 96 views::Label* description_label_; | 116 views::Label* description_label_; |
| 97 views::Textfield* description_text_; | 117 views::Textfield* description_text_; |
| 98 views::Checkbox* include_page_source_checkbox_; | 118 views::Checkbox* include_page_source_checkbox_; |
| 119 #if defined(OS_CHROMEOS) |
| 120 views::RadioButton* include_last_screen_image_radio_; |
| 121 views::ImageView* last_screenshot_iv_; |
| 122 views::RadioButton* include_new_screen_image_radio_; |
| 123 views::Checkbox* include_system_information_checkbox_; |
| 124 views::Link* system_information_url_; |
| 125 #endif |
| 126 // TODO: #else this once the BugReport function is fixed up |
| 99 views::Checkbox* include_page_image_checkbox_; | 127 views::Checkbox* include_page_image_checkbox_; |
| 100 | 128 |
| 129 |
| 101 scoped_ptr<BugReportComboBoxModel> bug_type_model_; | 130 scoped_ptr<BugReportComboBoxModel> bug_type_model_; |
| 102 | 131 |
| 103 Profile* profile_; | 132 Profile* profile_; |
| 104 | 133 |
| 105 std::wstring version_; | 134 std::wstring version_; |
| 135 gfx::Rect screenshot_size_; |
| 106 scoped_ptr< std::vector<unsigned char> > png_data_; | 136 scoped_ptr< std::vector<unsigned char> > png_data_; |
| 107 | 137 |
| 108 TabContents* tab_; | 138 TabContents* tab_; |
| 109 | 139 |
| 110 // Used to distinguish the report type: Phishing or other. | 140 // Used to distinguish the report type: Phishing or other. |
| 111 int problem_type_; | 141 int problem_type_; |
| 112 | 142 |
| 113 // Save the description the user types in when we clear the dialog for the | 143 // Save the description the user types in when we clear the dialog for the |
| 114 // phishing option. If the user changes the report type back, we reinstate | 144 // phishing option. If the user changes the report type back, we reinstate |
| 115 // their original text so they don't have to type it again. | 145 // their original text so they don't have to type it again. |
| 116 std::wstring old_report_text_; | 146 std::wstring old_report_text_; |
| 117 | 147 |
| 118 DISALLOW_COPY_AND_ASSIGN(BugReportView); | 148 DISALLOW_COPY_AND_ASSIGN(BugReportView); |
| 119 }; | 149 }; |
| 120 | 150 |
| 121 #endif // CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_ | 151 #endif // CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_ |
| OLD | NEW |