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

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

Issue 9307086: [Web Intents, Mac] Allow re-open after cancellation/close of picker bubble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed review issues Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/web_intent_bubble_controller_unittest.mm ('k') | 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/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/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 parentWindow:parentWindow 86 parentWindow:parentWindow
87 anchoredAt:anchor]; 87 anchoredAt:anchor];
88 } 88 }
89 89
90 WebIntentPickerCocoa::~WebIntentPickerCocoa() { 90 WebIntentPickerCocoa::~WebIntentPickerCocoa() {
91 if (model_ != NULL) 91 if (model_ != NULL)
92 model_->set_observer(NULL); 92 model_->set_observer(NULL);
93 } 93 }
94 94
95 void WebIntentPickerCocoa::Close() { 95 void WebIntentPickerCocoa::Close() {
96 DCHECK(controller_);
97 [controller_ close];
98 if (inline_disposition_tab_contents_.get())
99 inline_disposition_tab_contents_->web_contents()->OnCloseStarted();
96 } 100 }
97 101
98 void WebIntentPickerCocoa::PerformDelayedLayout() { 102 void WebIntentPickerCocoa::PerformDelayedLayout() {
99 // Check to see if a layout has already been scheduled. 103 // Check to see if a layout has already been scheduled.
100 if (weak_ptr_factory_.HasWeakPtrs()) 104 if (weak_ptr_factory_.HasWeakPtrs())
101 return; 105 return;
102 106
103 // Delay performing layout by a second so that all the animations from 107 // Delay performing layout by a second so that all the animations from
104 // InfoBubbleWindow and origin updates from BaseBubbleController finish, so 108 // InfoBubbleWindow and origin updates from BaseBubbleController finish, so
105 // that we don't all race trying to change the frame's origin. 109 // that we don't all race trying to change the frame's origin.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 [controller_ setInlineDispositionTabContents: 157 [controller_ setInlineDispositionTabContents:
154 inline_disposition_tab_contents_.get()]; 158 inline_disposition_tab_contents_.get()];
155 PerformDelayedLayout(); 159 PerformDelayedLayout();
156 160
157 delegate_->OnInlineDispositionWebContentsCreated(web_contents); 161 delegate_->OnInlineDispositionWebContentsCreated(web_contents);
158 } 162 }
159 163
160 void WebIntentPickerCocoa::OnCancelled() { 164 void WebIntentPickerCocoa::OnCancelled() {
161 DCHECK(delegate_); 165 DCHECK(delegate_);
162 delegate_->OnCancelled(); 166 delegate_->OnCancelled();
163 controller_ = NULL; // Controller will be unusable soon, abandon. 167 delegate_->OnClosing();
168 delete this;
Robert Sesek 2012/02/07 00:28:17 Is this safe? Could anything access |this| after t
groby-ooo-7-16 2012/02/08 03:27:42 Done.
164 } 169 }
165 170
166 void WebIntentPickerCocoa::OnServiceChosen(size_t index) { 171 void WebIntentPickerCocoa::OnServiceChosen(size_t index) {
167 DCHECK(delegate_); 172 DCHECK(delegate_);
168 const WebIntentPickerModel::Item& item = model_->GetItemAt(index); 173 const WebIntentPickerModel::Item& item = model_->GetItemAt(index);
169 delegate_->OnServiceChosen(index, item.disposition); 174 delegate_->OnServiceChosen(index, item.disposition);
170 } 175 }
171 176
172 void WebIntentPickerCocoa::set_controller( 177 void WebIntentPickerCocoa::set_controller(
173 WebIntentBubbleController* controller) { 178 WebIntentBubbleController* controller) {
174 controller_ = controller; 179 controller_ = controller;
175 } 180 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/web_intent_bubble_controller_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698