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

Side by Side Diff: content/shell/browser/shell_javascript_dialog_mac.mm

Issue 102593002: Convert string16 to base::string16 in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell_javascript_dialog.h" 5 #include "content/shell/browser/shell_javascript_dialog.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #import "base/mac/scoped_nsobject.h" 9 #import "base/mac/scoped_nsobject.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 return textField_; 59 return textField_;
60 } 60 }
61 61
62 - (void)alertDidEnd:(NSAlert*)alert 62 - (void)alertDidEnd:(NSAlert*)alert
63 returnCode:(int)returnCode 63 returnCode:(int)returnCode
64 contextInfo:(void*)contextInfo { 64 contextInfo:(void*)contextInfo {
65 if (returnCode == NSRunStoppedResponse) 65 if (returnCode == NSRunStoppedResponse)
66 return; 66 return;
67 67
68 bool success = returnCode == NSAlertFirstButtonReturn; 68 bool success = returnCode == NSAlertFirstButtonReturn;
69 string16 input; 69 base::string16 input;
70 if (textField_) 70 if (textField_)
71 input = base::SysNSStringToUTF16([textField_ stringValue]); 71 input = base::SysNSStringToUTF16([textField_ stringValue]);
72 72
73 content::ShellJavaScriptDialog* native_dialog = 73 content::ShellJavaScriptDialog* native_dialog =
74 reinterpret_cast<content::ShellJavaScriptDialog*>(contextInfo); 74 reinterpret_cast<content::ShellJavaScriptDialog*>(contextInfo);
75 callback_.Run(success, input); 75 callback_.Run(success, input);
76 manager_->DialogClosed(native_dialog); 76 manager_->DialogClosed(native_dialog);
77 } 77 }
78 78
79 - (void)cancel { 79 - (void)cancel {
80 [NSApp endSheet:[alert_ window]]; 80 [NSApp endSheet:[alert_ window]];
81 alert_.reset(); 81 alert_.reset();
82 } 82 }
83 83
84 @end 84 @end
85 85
86 namespace content { 86 namespace content {
87 87
88 ShellJavaScriptDialog::ShellJavaScriptDialog( 88 ShellJavaScriptDialog::ShellJavaScriptDialog(
89 ShellJavaScriptDialogManager* manager, 89 ShellJavaScriptDialogManager* manager,
90 gfx::NativeWindow parent_window, 90 gfx::NativeWindow parent_window,
91 JavaScriptMessageType message_type, 91 JavaScriptMessageType message_type,
92 const string16& message_text, 92 const base::string16& message_text,
93 const string16& default_prompt_text, 93 const base::string16& default_prompt_text,
94 const JavaScriptDialogManager::DialogClosedCallback& callback) 94 const JavaScriptDialogManager::DialogClosedCallback& callback)
95 : manager_(manager), 95 : manager_(manager),
96 callback_(callback) { 96 callback_(callback) {
97 bool text_field = message_type == JAVASCRIPT_MESSAGE_TYPE_PROMPT; 97 bool text_field = message_type == JAVASCRIPT_MESSAGE_TYPE_PROMPT;
98 bool one_button = message_type == JAVASCRIPT_MESSAGE_TYPE_ALERT; 98 bool one_button = message_type == JAVASCRIPT_MESSAGE_TYPE_ALERT;
99 99
100 helper_ = 100 helper_ =
101 [[ShellJavaScriptDialogHelper alloc] initHelperWithManager:manager 101 [[ShellJavaScriptDialogHelper alloc] initHelperWithManager:manager
102 andCallback:callback]; 102 andCallback:callback];
103 103
(...skipping 25 matching lines...) Expand all
129 129
130 ShellJavaScriptDialog::~ShellJavaScriptDialog() { 130 ShellJavaScriptDialog::~ShellJavaScriptDialog() {
131 [helper_ release]; 131 [helper_ release];
132 } 132 }
133 133
134 void ShellJavaScriptDialog::Cancel() { 134 void ShellJavaScriptDialog::Cancel() {
135 [helper_ cancel]; 135 [helper_ cancel];
136 } 136 }
137 137
138 } // namespace content 138 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_javascript_dialog_gtk.cc ('k') | content/shell/browser/shell_javascript_dialog_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698