OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/single_web_contents_dialog_manager_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/single_web_contents_dialog_manager_cocoa.h" |
6 | 6 |
7 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" | 7 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" |
8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" | 9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" |
10 #include "components/web_modal/web_contents_modal_dialog_host.h" | 10 #include "components/web_modal/web_contents_modal_dialog_host.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 NSWindow* parent_window = | 51 NSWindow* parent_window = |
52 delegate_->GetWebContents()->GetTopLevelNativeWindow(); | 52 delegate_->GetWebContents()->GetTopLevelNativeWindow(); |
53 [[ConstrainedWindowSheetController controllerForParentWindow:parent_window] | 53 [[ConstrainedWindowSheetController controllerForParentWindow:parent_window] |
54 hideSheet]; | 54 hideSheet]; |
55 } | 55 } |
56 | 56 |
57 void SingleWebContentsDialogManagerCocoa::Close() { | 57 void SingleWebContentsDialogManagerCocoa::Close() { |
58 [[ConstrainedWindowSheetController controllerForSheet:sheet_] | 58 [[ConstrainedWindowSheetController controllerForSheet:sheet_] |
59 closeSheet:sheet_]; | 59 closeSheet:sheet_]; |
60 client_->set_manager(nullptr); | 60 client_->set_manager(nullptr); |
61 | |
61 client_->OnDialogClosing(); // |client_| might delete itself here. | 62 client_->OnDialogClosing(); // |client_| might delete itself here. |
62 delegate_->WillClose(dialog()); // Deletes |this|. | 63 |
64 if (client_->DialogWasShown()) | |
erikchen
2016/02/03 19:11:27
I don't understand why this code was changed. You
apacible
2016/02/03 19:17:27
Fixed. This should not have be changed.
| |
65 delegate_->WillClose(dialog()); // Deletes |this|. | |
63 } | 66 } |
64 | 67 |
65 void SingleWebContentsDialogManagerCocoa::Focus() { | 68 void SingleWebContentsDialogManagerCocoa::Focus() { |
66 } | 69 } |
67 | 70 |
68 void SingleWebContentsDialogManagerCocoa::Pulse() { | 71 void SingleWebContentsDialogManagerCocoa::Pulse() { |
69 [[ConstrainedWindowSheetController controllerForSheet:sheet_] | 72 [[ConstrainedWindowSheetController controllerForSheet:sheet_] |
70 pulseSheet:sheet_]; | 73 pulseSheet:sheet_]; |
71 } | 74 } |
72 | 75 |
73 void SingleWebContentsDialogManagerCocoa::HostChanged( | 76 void SingleWebContentsDialogManagerCocoa::HostChanged( |
74 web_modal::WebContentsModalDialogHost* new_host) { | 77 web_modal::WebContentsModalDialogHost* new_host) { |
75 // No need to observe the host. For Cocoa, the constrained window controller | 78 // No need to observe the host. For Cocoa, the constrained window controller |
76 // will reposition the dialog when necessary. The host can also never change. | 79 // will reposition the dialog when necessary. The host can also never change. |
77 // Tabs showing a dialog can not be dragged off a Cocoa browser window. | 80 // Tabs showing a dialog can not be dragged off a Cocoa browser window. |
78 // However, closing a tab with a dialog open will set the host back to null. | 81 // However, closing a tab with a dialog open will set the host back to null. |
79 DCHECK_NE(!!host_, !!new_host); | 82 DCHECK_NE(!!host_, !!new_host); |
80 host_ = new_host; | 83 host_ = new_host; |
81 } | 84 } |
82 | 85 |
83 gfx::NativeWindow SingleWebContentsDialogManagerCocoa::dialog() { | 86 gfx::NativeWindow SingleWebContentsDialogManagerCocoa::dialog() { |
84 return [sheet_ sheetWindow]; | 87 return [sheet_ sheetWindow]; |
85 } | 88 } |
OLD | NEW |