/thirdparty/breakpad/client/mac/sender/crash_report_sender.h

http://github.com/tomahawk-player/tomahawk · C++ Header · 117 lines · 46 code · 13 blank · 58 comment · 0 complexity · ab38c5109a76760cb445d5686c2d3b89 MD5 · raw file

  1. // Copyright (c) 2006, Google Inc.
  2. // All rights reserved.
  3. //
  4. // Redistribution and use in source and binary forms, with or without
  5. // modification, are permitted provided that the following conditions are
  6. // met:
  7. //
  8. // * Redistributions of source code must retain the above copyright
  9. // notice, this list of conditions and the following disclaimer.
  10. // * Redistributions in binary form must reproduce the above
  11. // copyright notice, this list of conditions and the following disclaimer
  12. // in the documentation and/or other materials provided with the
  13. // distribution.
  14. // * Neither the name of Google Inc. nor the names of its
  15. // contributors may be used to endorse or promote products derived from
  16. // this software without specific prior written permission.
  17. //
  18. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. //
  30. // This component uses the HTTPMultipartUpload of the breakpad project to send
  31. // the minidump and associated data to the crash reporting servers.
  32. // It will perform throttling based on the parameters passed to it and will
  33. // prompt the user to send the minidump.
  34. #import <Cocoa/Cocoa.h>
  35. #include "client/mac/sender/uploader.h"
  36. #import "GTMDefines.h"
  37. // We're sublcassing NSTextField in order to override a particular
  38. // method (see the implementation) that lets us reject changes if they
  39. // are longer than a particular length. Bindings would normally solve
  40. // this problem, but when we implemented a validation method, and
  41. // returned NO for strings that were too long, the UI was not updated
  42. // right away, which was a poor user experience. The UI would be
  43. // updated as soon as the text field lost first responder status,
  44. // which isn't soon enough. It is a known bug that the UI KVO didn't
  45. // work in the middle of a validation.
  46. @interface LengthLimitingTextField : NSTextField {
  47. @private
  48. NSUInteger maximumLength_;
  49. }
  50. - (void)setMaximumLength:(NSUInteger)maxLength;
  51. @end
  52. @interface Reporter : NSObject {
  53. @public
  54. IBOutlet NSWindow *alertWindow_; // The alert window
  55. // Grouping boxes used for resizing.
  56. IBOutlet NSBox *headerBox_;
  57. IBOutlet NSBox *preEmailBox_;
  58. IBOutlet NSBox *emailSectionBox_;
  59. // Localized elements (or things that need to be moved during localization).
  60. IBOutlet NSTextField *dialogTitle_;
  61. IBOutlet NSTextField *commentMessage_;
  62. IBOutlet NSTextField *emailMessage_;
  63. IBOutlet NSTextField *emailLabel_;
  64. IBOutlet NSTextField *privacyLinkLabel_;
  65. IBOutlet NSButton *sendButton_;
  66. IBOutlet NSButton *cancelButton_;
  67. IBOutlet LengthLimitingTextField *emailEntryField_;
  68. IBOutlet LengthLimitingTextField *commentsEntryField_;
  69. IBOutlet NSTextField *countdownLabel_;
  70. IBOutlet NSView *privacyLinkArrow_;
  71. // Text field bindings, for user input.
  72. NSString *commentsValue_; // Comments from the user
  73. NSString *emailValue_; // Email from the user
  74. NSString *countdownMessage_; // Message indicating time
  75. // left for input.
  76. @private
  77. NSTimeInterval remainingDialogTime_; // Keeps track of how long
  78. // we have until we cancel
  79. // the dialog
  80. NSTimer *messageTimer_; // Timer we use to update
  81. // the dialog
  82. Uploader* uploader_; // Uploader we use to send the data.
  83. }
  84. // Stops the modal panel with an NSAlertDefaultReturn value. This is the action
  85. // invoked by the "Send Report" button.
  86. - (IBAction)sendReport:(id)sender;
  87. // Stops the modal panel with an NSAlertAlternateReturn value. This is the
  88. // action invoked by the "Cancel" button.
  89. - (IBAction)cancel:(id)sender;
  90. // Opens the Privacy Policy url in the default web browser.
  91. - (IBAction)showPrivacyPolicy:(id)sender;
  92. // Delegate methods for the NSTextField for comments. We want to capture the
  93. // Return key and use it to send the message when no text has been entered.
  94. // Otherwise, we want Return to add a carriage return to the comments field.
  95. - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView
  96. doCommandBySelector:(SEL)commandSelector;
  97. // Accessors to make bindings work
  98. - (NSString *)commentsValue;
  99. - (void)setCommentsValue:(NSString *)value;
  100. - (NSString *)emailValue;
  101. - (void)setEmailValue:(NSString *)value;
  102. - (NSString *)countdownMessage;
  103. - (void)setCountdownMessage:(NSString *)value;
  104. @end