Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: chrome/browser/ui/cocoa/javascript_app_modal_dialog_cocoa.mm

Issue 1668283002: Set empty icon to alert dialogs on mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/cocoa/javascript_app_modal_dialog_cocoa.h" 5 #include "chrome/browser/ui/cocoa/javascript_app_modal_dialog_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 - (instancetype)initWithNativeDialog:(JavaScriptAppModalDialogCocoa*)dialog { 75 - (instancetype)initWithNativeDialog:(JavaScriptAppModalDialogCocoa*)dialog {
76 DCHECK(dialog); 76 DCHECK(dialog);
77 self = [super init]; 77 self = [super init];
78 if (self) 78 if (self)
79 nativeDialog_ = dialog; 79 nativeDialog_ = dialog;
80 return self; 80 return self;
81 } 81 }
82 82
83 - (NSAlert*)alert { 83 - (NSAlert*)alert {
84 if (!alert_) 84 if (!alert_) {
85 alert_.reset([[NSAlert alloc] init]); 85 alert_.reset([[NSAlert alloc] init]);
86 [alert_ setIcon:[NSImage new]];
meacer 2016/02/04 22:17:58 Not sure about the ownership here, does alert own
droger 2016/02/05 10:33:01 Drive-by. I expect this to be a memory leak. Does
Avi (use Gerrit) 2016/02/05 17:06:09 It'll make its own reference, so you're leaking he
Avi (use Gerrit) 2016/02/05 17:11:23 Gah, yes. I replied but forgot to mail my comments
meacer 2016/02/05 19:37:16 Done, thanks for the snippet.
87 }
86 return alert_; 88 return alert_;
87 } 89 }
88 90
89 - (void)addTextFieldWithPrompt:(NSString*)prompt { 91 - (void)addTextFieldWithPrompt:(NSString*)prompt {
90 DCHECK(!textField_); 92 DCHECK(!textField_);
91 textField_.reset( 93 textField_.reset(
92 [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 300, 22)]); 94 [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 300, 22)]);
93 [[textField_ cell] setLineBreakMode:NSLineBreakByTruncatingTail]; 95 [[textField_ cell] setLineBreakMode:NSLineBreakByTruncatingTail];
94 [[self alert] setAccessoryView:textField_]; 96 [[self alert] setAccessoryView:textField_];
95 [[alert_ window] setInitialFirstResponder:textField_]; 97 [[alert_ window] setInitialFirstResponder:textField_];
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 DISALLOW_COPY_AND_ASSIGN(ChromeJavaScriptNativeDialogCocoaFactory); 461 DISALLOW_COPY_AND_ASSIGN(ChromeJavaScriptNativeDialogCocoaFactory);
460 }; 462 };
461 463
462 } // namespace 464 } // namespace
463 465
464 void InstallChromeJavaScriptNativeDialogFactory() { 466 void InstallChromeJavaScriptNativeDialogFactory() {
465 app_modal::JavaScriptDialogManager::GetInstance()-> 467 app_modal::JavaScriptDialogManager::GetInstance()->
466 SetNativeDialogFactory( 468 SetNativeDialogFactory(
467 make_scoped_ptr(new ChromeJavaScriptNativeDialogCocoaFactory)); 469 make_scoped_ptr(new ChromeJavaScriptNativeDialogCocoaFactory));
468 } 470 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698