| 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/browser/net/url_fetcher.h" | 8 #include "chrome/browser/net/url_fetcher.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "views/controls/combo_box.h" | 10 #include "views/controls/combobox/combobox.h" |
| 11 #include "views/controls/textfield/textfield.h" | 11 #include "views/controls/textfield/textfield.h" |
| 12 #include "views/view.h" | 12 #include "views/view.h" |
| 13 #include "views/window/dialog_delegate.h" | 13 #include "views/window/dialog_delegate.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 class Checkbox; | 16 class Checkbox; |
| 17 class Label; | 17 class Label; |
| 18 class Throbber; | 18 class Throbber; |
| 19 class Window; | 19 class Window; |
| 20 } | 20 } |
| 21 | 21 |
| 22 class Profile; | 22 class Profile; |
| 23 class TabContents; | 23 class TabContents; |
| 24 class BugReportComboBoxModel; | 24 class BugReportComboBoxModel; |
| 25 | 25 |
| 26 // BugReportView draws the dialog that allows the user to report a | 26 // BugReportView draws the dialog that allows the user to report a |
| 27 // bug in rendering a particular page (note: this is not a crash | 27 // bug in rendering a particular page (note: this is not a crash |
| 28 // report, which are handled separately by Breakpad). It packages | 28 // report, which are handled separately by Breakpad). It packages |
| 29 // up the URL, a text description, and optionally a screenshot and/or | 29 // 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 | 30 // the HTML page source, and submits them as an HTTP POST to the |
| 31 // URL stored in the string resource IDS_BUGREPORT_POST_URL. | 31 // URL stored in the string resource IDS_BUGREPORT_POST_URL. |
| 32 // | 32 // |
| 33 // Note: The UI team hasn't defined yet how the bug report UI will look like. | 33 // Note: The UI team hasn't defined yet how the bug report UI will look like. |
| 34 // So now use dialog as a placeholder. | 34 // So now use dialog as a placeholder. |
| 35 class BugReportView : public views::View, | 35 class BugReportView : public views::View, |
| 36 public views::DialogDelegate, | 36 public views::DialogDelegate, |
| 37 public views::ComboBox::Listener, | 37 public views::Combobox::Listener, |
| 38 public views::Textfield::Controller { | 38 public views::Textfield::Controller { |
| 39 public: | 39 public: |
| 40 explicit BugReportView(Profile* profile, TabContents* tab); | 40 explicit BugReportView(Profile* profile, TabContents* tab); |
| 41 virtual ~BugReportView(); | 41 virtual ~BugReportView(); |
| 42 | 42 |
| 43 // NOTE: set_png_data takes ownership of the vector | 43 // NOTE: set_png_data takes ownership of the vector |
| 44 void set_png_data(std::vector<unsigned char> *png_data) { | 44 void set_png_data(std::vector<unsigned char> *png_data) { |
| 45 png_data_.reset(png_data); | 45 png_data_.reset(png_data); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // Overridden from views::View: | 48 // Overridden from views::View: |
| 49 virtual gfx::Size GetPreferredSize(); | 49 virtual gfx::Size GetPreferredSize(); |
| 50 | 50 |
| 51 // views::Textfield::Controller implementation: | 51 // views::Textfield::Controller implementation: |
| 52 virtual void ContentsChanged(views::Textfield* sender, | 52 virtual void ContentsChanged(views::Textfield* sender, |
| 53 const std::wstring& new_contents); | 53 const std::wstring& new_contents); |
| 54 virtual bool HandleKeystroke(views::Textfield* sender, | 54 virtual bool HandleKeystroke(views::Textfield* sender, |
| 55 const views::Textfield::Keystroke& key); | 55 const views::Textfield::Keystroke& key); |
| 56 | 56 |
| 57 // views::ComboBox::Listener implementation: | 57 // views::Combobox::Listener implementation: |
| 58 virtual void ItemChanged(views::ComboBox* combo_box, int prev_index, | 58 virtual void ItemChanged(views::Combobox* combobox, int prev_index, |
| 59 int new_index); | 59 int new_index); |
| 60 | 60 |
| 61 // Overridden from views::DialogDelegate: | 61 // Overridden from views::DialogDelegate: |
| 62 virtual std::wstring GetDialogButtonLabel( | 62 virtual std::wstring GetDialogButtonLabel( |
| 63 MessageBoxFlags::DialogButton button) const; | 63 MessageBoxFlags::DialogButton button) const; |
| 64 virtual int GetDefaultDialogButton() const; | 64 virtual int GetDefaultDialogButton() const; |
| 65 virtual bool CanResize() const; | 65 virtual bool CanResize() const; |
| 66 virtual bool CanMaximize() const; | 66 virtual bool CanMaximize() const; |
| 67 virtual bool IsAlwaysOnTop() const; | 67 virtual bool IsAlwaysOnTop() const; |
| 68 virtual bool HasAlwaysOnTopMenu() const; | 68 virtual bool HasAlwaysOnTopMenu() const; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 81 void SetupControl(); | 81 void SetupControl(); |
| 82 // helper function to create a MIME part boundary string | 82 // helper function to create a MIME part boundary string |
| 83 void CreateMimeBoundary(std::string *out); | 83 void CreateMimeBoundary(std::string *out); |
| 84 // Sends the data via an HTTP POST | 84 // Sends the data via an HTTP POST |
| 85 void SendReport(); | 85 void SendReport(); |
| 86 | 86 |
| 87 // Redirects the user to Google's phishing reporting page. | 87 // Redirects the user to Google's phishing reporting page. |
| 88 void ReportPhishing(); | 88 void ReportPhishing(); |
| 89 | 89 |
| 90 views::Label* bug_type_label_; | 90 views::Label* bug_type_label_; |
| 91 views::ComboBox* bug_type_combo_; | 91 views::Combobox* bug_type_combo_; |
| 92 views::Label* page_title_label_; | 92 views::Label* page_title_label_; |
| 93 views::Label* page_title_text_; | 93 views::Label* page_title_text_; |
| 94 views::Label* page_url_label_; | 94 views::Label* page_url_label_; |
| 95 views::Textfield* page_url_text_; | 95 views::Textfield* page_url_text_; |
| 96 views::Label* description_label_; | 96 views::Label* description_label_; |
| 97 views::Textfield* description_text_; | 97 views::Textfield* description_text_; |
| 98 views::Checkbox* include_page_source_checkbox_; | 98 views::Checkbox* include_page_source_checkbox_; |
| 99 views::Checkbox* include_page_image_checkbox_; | 99 views::Checkbox* include_page_image_checkbox_; |
| 100 | 100 |
| 101 scoped_ptr<BugReportComboBoxModel> bug_type_model_; | 101 scoped_ptr<BugReportComboBoxModel> bug_type_model_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 114 | 114 |
| 115 // Save the description the user types in when we clear the dialog for the | 115 // Save the description the user types in when we clear the dialog for the |
| 116 // phishing option. If the user changes the report type back, we reinstate | 116 // phishing option. If the user changes the report type back, we reinstate |
| 117 // their original text so they don't have to type it again. | 117 // their original text so they don't have to type it again. |
| 118 std::wstring old_report_text_; | 118 std::wstring old_report_text_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(BugReportView); | 120 DISALLOW_COPY_AND_ASSIGN(BugReportView); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 #endif // CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_ | 123 #endif // CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_ |
| OLD | NEW |