OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_COCOA_BUG_REPORT_WINDOW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_COCOA_BUG_REPORT_WINDOW_CONTROLLER_H_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 10 #include <vector> |
| 11 |
| 12 #include "base/scoped_ptr.h" |
| 13 |
| 14 class Profile; |
| 15 class TabContents; |
| 16 |
| 17 // A window controller for managing the "Report Bug" feature. Modally |
| 18 // presents a dialog that allows the user to either file a bug report on |
| 19 // a broken page, or go directly to Google's "Report Phishing" page and |
| 20 // file a report there. |
| 21 @interface BugReportWindowController : NSWindowController { |
| 22 @private |
| 23 TabContents* currentTab_; // Weak, owned by browser. |
| 24 Profile* profile_; // Weak, owned by browser. |
| 25 |
| 26 // Holds screenshot of current tab. |
| 27 std::vector<unsigned char> pngData_; |
| 28 |
| 29 // Values bound to data in the dialog box. These values cannot be boxed in |
| 30 // scoped_nsobjects because we use them for bindings. |
| 31 NSString* bugDescription_; // Strong. |
| 32 NSUInteger bugType_; |
| 33 NSString* pageTitle_; // Strong. |
| 34 NSString* pageURL_; // Strong. |
| 35 |
| 36 // We keep a pointer to this button so we can change its title. |
| 37 NSButton* sendReportButton_; // Weak. |
| 38 |
| 39 BOOL sendScreenshot_; |
| 40 |
| 41 // Disable screenshot if no browser window is open. |
| 42 BOOL disableScreenshot_; |
| 43 |
| 44 // Menu for the bug type popup button. We create it here instead of in |
| 45 // IB so that we can nicely check whether the phishing page is selected, |
| 46 // and so that we can create a menu without "page" options when no browser |
| 47 // window is open. |
| 48 NSArray* bugTypeList_; // Strong. |
| 49 } |
| 50 |
| 51 // Initialize with the contents of the tab to be reported as buggy / wrong. |
| 52 // If dialog is called without an open window, currentTab may be null; in |
| 53 // that case, a dialog is opened with options for reporting a bugs not |
| 54 // related to a specific page. Profile is passed to BugReportUtil, who |
| 55 // will not send a report if the value is null. |
| 56 - (id)initWithTabContents:(TabContents*)currentTab profile:(Profile*)profile; |
| 57 |
| 58 // Run the dialog with an application-modal event loop. If the user accepts, |
| 59 // send the report of the bug or broken web site. |
| 60 - (void)runModalDialog; |
| 61 |
| 62 // IBActions for the dialog buttons. |
| 63 - (IBAction)sendReport:(id)sender; |
| 64 - (IBAction)cancel:(id)sender; |
| 65 |
| 66 // YES if the user has selected the phishing report option. |
| 67 - (BOOL)isPhishingReport; |
| 68 |
| 69 // The "send report" button may need to change its title to reflect that it's |
| 70 // bouncing to the phish report page instead of sending a report directly |
| 71 // from the dialog box (or vice versa). Observe the menu of bug types |
| 72 // and change the button title along with the selected bug. |
| 73 - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item; |
| 74 |
| 75 // Properties for bindings. |
| 76 @property (copy, nonatomic) NSString* bugDescription; |
| 77 @property NSUInteger bugType; |
| 78 @property (copy, nonatomic) NSString* pageTitle; |
| 79 @property (copy, nonatomic) NSString* pageURL; |
| 80 @property (assign, nonatomic) IBOutlet NSButton* sendReportButton; |
| 81 @property BOOL sendScreenshot; |
| 82 @property BOOL disableScreenshot; |
| 83 @property (readonly, nonatomic) NSArray* bugTypeList; |
| 84 |
| 85 @end |
| 86 |
| 87 #endif // CHROME_BROWSER_COCOA_BUG_REPORT_WINDOW_CONTROLLER_H_ |
| 88 |
OLD | NEW |