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/ui/cocoa/bug_report_window_controller.h" | 5 #import "chrome/browser/ui/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/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" |
11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
12 #include "chrome/browser/tab_contents/tab_contents_view.h" | 12 #include "chrome/browser/tab_contents/tab_contents_view.h" |
13 #include "grit/chromium_strings.h" | 13 #include "grit/chromium_strings.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 15 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
16 | 16 |
17 @implementation BugReportWindowController | 17 @implementation BugReportWindowController |
18 | 18 |
19 @synthesize bugDescription = bugDescription_; | 19 @synthesize bugDescription = bugDescription_; |
20 @synthesize bugTypeIndex = bugTypeIndex_; | 20 @synthesize bugTypeIndex = bugTypeIndex_; |
21 @synthesize pageURL = pageURL_; | 21 @synthesize pageURL = pageURL_; |
22 @synthesize pageTitle = pageTitle_; | 22 @synthesize pageTitle = pageTitle_; |
23 @synthesize sendScreenshot = sendScreenshot_; | 23 @synthesize sendScreenshot = sendScreenshot_; |
24 @synthesize disableScreenshotCheckbox = disableScreenshotCheckbox_; | 24 @synthesize disableScreenshotCheckbox = disableScreenshotCheckbox_; |
25 @synthesize bugTypeList = bugTypeList_; | 25 @synthesize bugTypeList = bugTypeList_; |
26 | 26 |
27 - (id)initWithTabContents:(TabContents*)currentTab | 27 - (id)initWithTabContents:(TabContents*)currentTab |
28 profile:(Profile*)profile { | 28 profile:(Profile*)profile { |
29 NSString* nibpath = [mac_util::MainAppBundle() pathForResource:@"ReportBug" | 29 NSString* nibpath = [base::mac::MainAppBundle() pathForResource:@"ReportBug" |
30 ofType:@"nib"]; | 30 ofType:@"nib"]; |
31 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { | 31 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { |
32 currentTab_ = currentTab; | 32 currentTab_ = currentTab; |
33 profile_ = profile; | 33 profile_ = profile; |
34 | 34 |
35 // The order of strings in this array must match the order of the bug types | 35 // The order of strings in this array must match the order of the bug types |
36 // declared below in the bugTypeFromIndex function. | 36 // declared below in the bugTypeFromIndex function. |
37 bugTypeList_ = [[NSMutableArray alloc] initWithObjects: | 37 bugTypeList_ = [[NSMutableArray alloc] initWithObjects: |
38 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_CHROME_MISBEHAVES), | 38 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_CHROME_MISBEHAVES), |
39 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_SOMETHING_MISSING), | 39 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_SOMETHING_MISSING), |
(...skipping 15 matching lines...) Expand all Loading... |
55 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_PAGE_WONT_LOAD), | 55 l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_PAGE_WONT_LOAD), |
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 base::mac::GrabWindowSnapshot( |
66 currentTab_->view()->GetTopLevelNativeWindow(), &pngData_, | 66 currentTab_->view()->GetTopLevelNativeWindow(), &pngData_, |
67 &pngWidth_, &pngHeight_); | 67 &pngWidth_, &pngHeight_); |
68 } else { | 68 } else { |
69 // 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" |
70 // options, with page URL and title empty, and screenshot disabled. | 70 // options, with page URL and title empty, and screenshot disabled. |
71 [self setSendScreenshot:NO]; | 71 [self setSendScreenshot:NO]; |
72 [self setDisableScreenshotCheckbox:YES]; | 72 [self setDisableScreenshotCheckbox:YES]; |
73 } | 73 } |
74 | 74 |
75 pngHeight_ = 0; | 75 pngHeight_ = 0; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 + (NSSet*)keyPathsForValuesAffectingValueForKey:(NSString*)key { | 222 + (NSSet*)keyPathsForValuesAffectingValueForKey:(NSString*)key { |
223 NSSet* paths = [super keyPathsForValuesAffectingValueForKey:key]; | 223 NSSet* paths = [super keyPathsForValuesAffectingValueForKey:key]; |
224 if ([key isEqualToString:@"isPhishingReport"]) { | 224 if ([key isEqualToString:@"isPhishingReport"]) { |
225 paths = [paths setByAddingObject:@"bugTypeIndex"]; | 225 paths = [paths setByAddingObject:@"bugTypeIndex"]; |
226 } | 226 } |
227 return paths; | 227 return paths; |
228 } | 228 } |
229 | 229 |
230 @end | 230 @end |
231 | 231 |
OLD | NEW |