OLD | NEW |
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/web_intent_picker_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/web_intent_picker_cocoa.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 DCHECK(delegate); | 103 DCHECK(delegate); |
104 DCHECK(tab_contents); | 104 DCHECK(tab_contents); |
105 | 105 |
106 sheet_controller_ = [ | 106 sheet_controller_ = [ |
107 [WebIntentPickerSheetController alloc] initWithPicker:this]; | 107 [WebIntentPickerSheetController alloc] initWithPicker:this]; |
108 | 108 |
109 // Deleted when ConstrainedPickerSheetDelegate::DeleteDelegate() runs. | 109 // Deleted when ConstrainedPickerSheetDelegate::DeleteDelegate() runs. |
110 ConstrainedPickerSheetDelegate* constrained_delegate = | 110 ConstrainedPickerSheetDelegate* constrained_delegate = |
111 new ConstrainedPickerSheetDelegate(this, sheet_controller_); | 111 new ConstrainedPickerSheetDelegate(this, sheet_controller_); |
112 | 112 |
113 window_ = new ConstrainedWindowMac(tab_contents, constrained_delegate); | 113 window_ = new ConstrainedWindowMac(tab_contents->web_contents(), |
| 114 constrained_delegate); |
114 } | 115 } |
115 | 116 |
116 WebIntentPickerCocoa::~WebIntentPickerCocoa() { | 117 WebIntentPickerCocoa::~WebIntentPickerCocoa() { |
117 if (model_ != NULL) | 118 if (model_ != NULL) |
118 model_->set_observer(NULL); | 119 model_->set_observer(NULL); |
119 } | 120 } |
120 | 121 |
121 void WebIntentPickerCocoa::OnSheetDidEnd(NSWindow* sheet) { | 122 void WebIntentPickerCocoa::OnSheetDidEnd(NSWindow* sheet) { |
122 [sheet orderOut:sheet_controller_]; | 123 [sheet orderOut:sheet_controller_]; |
123 if (window_) | 124 if (window_) |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 248 } |
248 | 249 |
249 void WebIntentPickerCocoa::OnChooseAnotherService() { | 250 void WebIntentPickerCocoa::OnChooseAnotherService() { |
250 DCHECK(delegate_); | 251 DCHECK(delegate_); |
251 delegate_->OnChooseAnotherService(); | 252 delegate_->OnChooseAnotherService(); |
252 inline_disposition_tab_contents_.reset(); | 253 inline_disposition_tab_contents_.reset(); |
253 inline_disposition_delegate_.reset(); | 254 inline_disposition_delegate_.reset(); |
254 [sheet_controller_ setInlineDispositionTabContents:NULL]; | 255 [sheet_controller_ setInlineDispositionTabContents:NULL]; |
255 PerformLayout(); | 256 PerformLayout(); |
256 } | 257 } |
OLD | NEW |