| 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 #import "chrome/browser/cocoa/bug_report_window_controller.h" | 5 #import "chrome/browser/cocoa/bug_report_window_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/bug_report_util.h" | 10 #include "chrome/browser/bug_report_util.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_PAGE_LOOKS_ODD), | 56 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_PAGE_LOOKS_ODD), |
| 57 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_PHISHING_PAGE), | 57 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_PHISHING_PAGE), |
| 58 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_CANT_SIGN_IN), | 58 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_CANT_SIGN_IN), |
| 59 nil] | 59 nil] |
| 60 atIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 4)]]; | 60 atIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 4)]]; |
| 61 | 61 |
| 62 [self setPageURL:base::SysUTF8ToNSString( | 62 [self setPageURL:base::SysUTF8ToNSString( |
| 63 currentTab_->controller().GetActiveEntry()->url().spec())]; | 63 currentTab_->controller().GetActiveEntry()->url().spec())]; |
| 64 [self setPageTitle:base::SysUTF16ToNSString(currentTab_->GetTitle())]; | 64 [self setPageTitle:base::SysUTF16ToNSString(currentTab_->GetTitle())]; |
| 65 mac_util::GrabWindowSnapshot( | 65 mac_util::GrabWindowSnapshot( |
| 66 currentTab_->view()->GetTopLevelNativeWindow(), &pngData_); | 66 currentTab_->view()->GetTopLevelNativeWindow(), &pngData_, |
| 67 &pngWidth_, &pngHeight_); |
| 67 } else { | 68 } else { |
| 68 // If no current tab exists, create a menu without the "broken page" | 69 // If no current tab exists, create a menu without the "broken page" |
| 69 // options, with page URL and title empty, and screenshot disabled. | 70 // options, with page URL and title empty, and screenshot disabled. |
| 70 [self setSendScreenshot:NO]; | 71 [self setSendScreenshot:NO]; |
| 71 [self setDisableScreenshotCheckbox:YES]; | 72 [self setDisableScreenshotCheckbox:YES]; |
| 72 } | 73 } |
| 74 |
| 75 pngHeight_ = 0; |
| 76 pngWidth_ = 0; |
| 73 } | 77 } |
| 74 return self; | 78 return self; |
| 75 } | 79 } |
| 76 | 80 |
| 77 - (void)dealloc { | 81 - (void)dealloc { |
| 78 [pageURL_ release]; | 82 [pageURL_ release]; |
| 79 [pageTitle_ release]; | 83 [pageTitle_ release]; |
| 80 [bugDescription_ release]; | 84 [bugDescription_ release]; |
| 81 [bugTypeList_ release]; | 85 [bugTypeList_ release]; |
| 82 [bugTypeDictionary_ release]; | 86 [bugTypeDictionary_ release]; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 105 pageURL_ ? base::SysNSStringToUTF8(pageURL_) : ""); | 109 pageURL_ ? base::SysNSStringToUTF8(pageURL_) : ""); |
| 106 } else { | 110 } else { |
| 107 BugReportUtil::SendReport( | 111 BugReportUtil::SendReport( |
| 108 profile_, | 112 profile_, |
| 109 base::SysNSStringToUTF8(pageTitle_), | 113 base::SysNSStringToUTF8(pageTitle_), |
| 110 [self bugTypeFromIndex], | 114 [self bugTypeFromIndex], |
| 111 base::SysNSStringToUTF8(pageURL_), | 115 base::SysNSStringToUTF8(pageURL_), |
| 112 base::SysNSStringToUTF8(bugDescription_), | 116 base::SysNSStringToUTF8(bugDescription_), |
| 113 sendScreenshot_ && !pngData_.empty() ? | 117 sendScreenshot_ && !pngData_.empty() ? |
| 114 reinterpret_cast<const char *>(&(pngData_[0])) : NULL, | 118 reinterpret_cast<const char *>(&(pngData_[0])) : NULL, |
| 115 pngData_.size()); | 119 pngData_.size(), pngWidth_, pngHeight_); |
| 116 } | 120 } |
| 117 [self closeDialog]; | 121 [self closeDialog]; |
| 118 } | 122 } |
| 119 | 123 |
| 120 - (IBAction)cancel:(id)sender { | 124 - (IBAction)cancel:(id)sender { |
| 121 [self closeDialog]; | 125 [self closeDialog]; |
| 122 } | 126 } |
| 123 | 127 |
| 124 - (BOOL)isPhishingReport { | 128 - (BOOL)isPhishingReport { |
| 125 return [self bugTypeFromIndex] == BugReportUtil::PHISHING_PAGE; | 129 return [self bugTypeFromIndex] == BugReportUtil::PHISHING_PAGE; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 + (NSSet*)keyPathsForValuesAffectingValueForKey:(NSString*)key { | 222 + (NSSet*)keyPathsForValuesAffectingValueForKey:(NSString*)key { |
| 219 NSSet* paths = [super keyPathsForValuesAffectingValueForKey:key]; | 223 NSSet* paths = [super keyPathsForValuesAffectingValueForKey:key]; |
| 220 if ([key isEqualToString:@"isPhishingReport"]) { | 224 if ([key isEqualToString:@"isPhishingReport"]) { |
| 221 paths = [paths setByAddingObject:@"bugTypeIndex"]; | 225 paths = [paths setByAddingObject:@"bugTypeIndex"]; |
| 222 } | 226 } |
| 223 return paths; | 227 return paths; |
| 224 } | 228 } |
| 225 | 229 |
| 226 @end | 230 @end |
| 227 | 231 |
| OLD | NEW |