toolkit/crashreporter/client/crashreporter_osx.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/crashreporter/client/crashreporter_osx.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,107 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef CRASHREPORTER_OSX_H__
    1.10 +#define CRASHREPORTER_OSX_H__
    1.11 +
    1.12 +#include <Cocoa/Cocoa.h>
    1.13 +#include "HTTPMultipartUpload.h"
    1.14 +#include "crashreporter.h"
    1.15 +
    1.16 +// Defined below
    1.17 +@class TextViewWithPlaceHolder;
    1.18 +
    1.19 +@interface CrashReporterUI : NSObject
    1.20 +{
    1.21 +    IBOutlet NSWindow* mWindow;
    1.22 +
    1.23 +    /* Crash reporter view */
    1.24 +    IBOutlet NSTextField* mHeaderLabel;
    1.25 +    IBOutlet NSTextField* mDescriptionLabel;
    1.26 +    IBOutlet NSButton* mViewReportButton;
    1.27 +    IBOutlet NSScrollView* mCommentScrollView;
    1.28 +    IBOutlet TextViewWithPlaceHolder* mCommentText;
    1.29 +    IBOutlet NSButton* mSubmitReportButton;
    1.30 +    IBOutlet NSButton* mIncludeURLButton;
    1.31 +    IBOutlet NSButton* mEmailMeButton;
    1.32 +    IBOutlet NSTextField* mEmailText;
    1.33 +    IBOutlet NSButton* mCloseButton;
    1.34 +    IBOutlet NSButton* mRestartButton;
    1.35 +    IBOutlet NSProgressIndicator* mProgressIndicator;
    1.36 +    IBOutlet NSTextField* mProgressText;
    1.37 +
    1.38 +    /* Error view */
    1.39 +    IBOutlet NSView* mErrorView;
    1.40 +    IBOutlet NSTextField* mErrorHeaderLabel;
    1.41 +    IBOutlet NSTextField* mErrorLabel;
    1.42 +    IBOutlet NSButton* mErrorCloseButton;
    1.43 +
    1.44 +    /* For "show info" alert */
    1.45 +    IBOutlet NSWindow* mViewReportWindow;
    1.46 +    IBOutlet NSTextView* mViewReportTextView;
    1.47 +    IBOutlet NSButton* mViewReportOkButton;
    1.48 +
    1.49 +    HTTPMultipartUpload* mPost;
    1.50 +}
    1.51 +
    1.52 +- (void)showCrashUI:(const std::string&)dumpfile
    1.53 +    queryParameters:(const StringTable&)queryParameters
    1.54 +            sendURL:(const std::string&)sendURL;
    1.55 +- (void)showErrorUI:(const std::string&)dumpfile;
    1.56 +- (void)showReportInfo;
    1.57 +- (void)maybeSubmitReport;
    1.58 +- (void)closeMeDown:(id)unused;
    1.59 +
    1.60 +- (IBAction)submitReportClicked:(id)sender;
    1.61 +- (IBAction)viewReportClicked:(id)sender;
    1.62 +- (IBAction)viewReportOkClicked:(id)sender;
    1.63 +- (IBAction)closeClicked:(id)sender;
    1.64 +- (IBAction)restartClicked:(id)sender;
    1.65 +- (IBAction)includeURLClicked:(id)sender;
    1.66 +- (IBAction)emailMeClicked:(id)sender;
    1.67 +
    1.68 +- (void)controlTextDidChange:(NSNotification *)note;
    1.69 +- (void)textDidChange:(NSNotification *)aNotification;
    1.70 +- (BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString;
    1.71 +
    1.72 +- (void)doInitialResizing;
    1.73 +- (float)setStringFitVertically:(NSControl*)control
    1.74 +                         string:(NSString*)str
    1.75 +                   resizeWindow:(BOOL)resizeWindow;
    1.76 +- (void)setView:(NSView*)v animate: (BOOL) animate;
    1.77 +- (void)enableControls:(BOOL)enabled;
    1.78 +- (void)updateSubmit;
    1.79 +- (void)updateURL;
    1.80 +- (void)updateEmail;
    1.81 +- (void)sendReport;
    1.82 +- (bool)setupPost;
    1.83 +- (void)uploadThread:(HTTPMultipartUpload*)post;
    1.84 +- (void)uploadComplete:(NSData*)data;
    1.85 +
    1.86 +-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication;
    1.87 +-(void)applicationWillTerminate:(NSNotification *)aNotification;
    1.88 +
    1.89 +@end
    1.90 +
    1.91 +/*
    1.92 + * Subclass NSTextView to provide a text view with placeholder text.
    1.93 + * Also provide a setEnabled implementation.
    1.94 + */
    1.95 +@interface TextViewWithPlaceHolder : NSTextView {
    1.96 +  NSMutableAttributedString *mPlaceHolderString;
    1.97 +}
    1.98 +
    1.99 +- (BOOL)becomeFirstResponder;
   1.100 +- (void)drawRect:(NSRect)rect;
   1.101 +- (BOOL)resignFirstResponder;  
   1.102 +- (void)setPlaceholder:(NSString*)placeholder;
   1.103 +- (void)insertTab:(id)sender;
   1.104 +- (void)insertBacktab:(id)sender;
   1.105 +- (void)setEnabled:(BOOL)enabled;
   1.106 +- (void)dealloc;
   1.107 +
   1.108 +@end
   1.109 +
   1.110 +#endif

mercurial