| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/html_dialog_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/html_dialog_window_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 // BrowserCommandExecutor methods. | 72 // BrowserCommandExecutor methods. |
| 73 - (void)executeCommand:(int)command; | 73 - (void)executeCommand:(int)command; |
| 74 | 74 |
| 75 @end | 75 @end |
| 76 | 76 |
| 77 namespace browser { | 77 namespace browser { |
| 78 | 78 |
| 79 gfx::NativeWindow ShowHtmlDialog(gfx::NativeWindow parent, Profile* profile, | 79 gfx::NativeWindow ShowHtmlDialog(gfx::NativeWindow parent, Profile* profile, |
| 80 HtmlDialogUIDelegate* delegate) { | 80 HtmlDialogUIDelegate* delegate) { |
| 81 // It's not always safe to display an html dialog with an off the record |
| 82 // profile. If the last browser with that profile is closed it will go |
| 83 // away. |
| 84 // On most platforms we insist on the dialog being modal if we're off the |
| 85 // record to prevent that. That wont work on the Mac since we don't have |
| 86 // modal dialogs. |
| 87 // Fall back to the old (incorrect) behavior of grabbing the original |
| 88 // profile. |
| 81 // NOTE: Use the parent parameter once we implement modal dialogs. | 89 // NOTE: Use the parent parameter once we implement modal dialogs. |
| 82 return [HtmlDialogWindowController showHtmlDialog:delegate profile:profile]; | 90 return [HtmlDialogWindowController showHtmlDialog:delegate |
| 91 profile:profile->GetOriginalProfile()]; |
| 83 } | 92 } |
| 84 | 93 |
| 85 } // namespace html_dialog_window_controller | 94 } // namespace html_dialog_window_controller |
| 86 | 95 |
| 87 HtmlDialogWindowDelegateBridge::HtmlDialogWindowDelegateBridge( | 96 HtmlDialogWindowDelegateBridge::HtmlDialogWindowDelegateBridge( |
| 88 HtmlDialogWindowController* controller, Profile* profile, | 97 HtmlDialogWindowController* controller, Profile* profile, |
| 89 HtmlDialogUIDelegate* delegate) | 98 HtmlDialogUIDelegate* delegate) |
| 90 : HtmlDialogTabContentsDelegate(profile), | 99 : HtmlDialogTabContentsDelegate(profile), |
| 91 controller_(controller), delegate_(delegate) { | 100 controller_(controller), delegate_(delegate) { |
| 92 DCHECK(controller_); | 101 DCHECK(controller_); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 305 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
| 297 // to do the above doesn't work. | 306 // to do the above doesn't work. |
| 298 } | 307 } |
| 299 | 308 |
| 300 - (void)windowWillClose:(NSNotification*)notification { | 309 - (void)windowWillClose:(NSNotification*)notification { |
| 301 delegate_->WindowControllerClosed(); | 310 delegate_->WindowControllerClosed(); |
| 302 [self autorelease]; | 311 [self autorelease]; |
| 303 } | 312 } |
| 304 | 313 |
| 305 @end | 314 @end |
| OLD | NEW |