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

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_controller.cc

Issue 10969016: web intents. Fix callbacks to restore tab management on service exit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move invalidation Created 8 years, 3 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/intents/web_intent_picker_controller.h ('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/intents/web_intent_picker_controller.h" 5 #include "chrome/browser/ui/intents/web_intent_picker_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 uma_reporter_(new UMAReporter()), 192 uma_reporter_(new UMAReporter()),
193 pending_async_count_(0), 193 pending_async_count_(0),
194 pending_registry_calls_count_(0), 194 pending_registry_calls_count_(0),
195 pending_cws_request_(false), 195 pending_cws_request_(false),
196 picker_shown_(false), 196 picker_shown_(false),
197 window_disposition_source_(NULL), 197 window_disposition_source_(NULL),
198 source_intents_dispatcher_(NULL), 198 source_intents_dispatcher_(NULL),
199 intents_dispatcher_(NULL), 199 intents_dispatcher_(NULL),
200 service_tab_(NULL), 200 service_tab_(NULL),
201 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), 201 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
202 ALLOW_THIS_IN_INITIALIZER_LIST(timer_factory_(this)) { 202 ALLOW_THIS_IN_INITIALIZER_LIST(timer_factory_(this)),
203 ALLOW_THIS_IN_INITIALIZER_LIST(dispatcher_factory_(this)) {
203 content::NavigationController* controller = 204 content::NavigationController* controller =
204 &tab_contents->web_contents()->GetController(); 205 &tab_contents->web_contents()->GetController();
205 registrar_.Add(this, content::NOTIFICATION_LOAD_START, 206 registrar_.Add(this, content::NOTIFICATION_LOAD_START,
206 content::Source<content::NavigationController>(controller)); 207 content::Source<content::NavigationController>(controller));
207 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, 208 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING,
208 content::Source<content::NavigationController>(controller)); 209 content::Source<content::NavigationController>(controller));
209 #if defined(TOOLKIT_VIEWS) 210 #if defined(TOOLKIT_VIEWS)
210 cancelled_ = true; 211 cancelled_ = true;
211 #endif 212 #endif
212 } 213 }
213 214
214 WebIntentPickerController::~WebIntentPickerController() { 215 WebIntentPickerController::~WebIntentPickerController() {
215 } 216 }
216 217
217 // TODO(gbillock): combine this with ShowDialog. 218 // TODO(gbillock): combine this with ShowDialog.
218 void WebIntentPickerController::SetIntentsDispatcher( 219 void WebIntentPickerController::SetIntentsDispatcher(
219 content::WebIntentsDispatcher* intents_dispatcher) { 220 content::WebIntentsDispatcher* intents_dispatcher) {
221 // TODO(gbillock): This is to account for multiple dispatches in the same tab.
222 // That is currently not a well-handled case, and this is a band-aid.
223 dispatcher_factory_.InvalidateWeakPtrs();
220 intents_dispatcher_ = intents_dispatcher; 224 intents_dispatcher_ = intents_dispatcher;
221 intents_dispatcher_->RegisterReplyNotification( 225 intents_dispatcher_->RegisterReplyNotification(
222 base::Bind(&WebIntentPickerController::OnSendReturnMessage, 226 base::Bind(&WebIntentPickerController::OnSendReturnMessage,
223 weak_ptr_factory_.GetWeakPtr())); 227 dispatcher_factory_.GetWeakPtr()));
224 228
225 // Initialize the reporting bucket. 229 // Initialize the reporting bucket.
226 const webkit_glue::WebIntentData& intent = intents_dispatcher_->GetIntent(); 230 const webkit_glue::WebIntentData& intent = intents_dispatcher_->GetIntent();
227 uma_bucket_ = web_intents::ToUMABucket(intent.action, intent.type); 231 uma_bucket_ = web_intents::ToUMABucket(intent.action, intent.type);
228 } 232 }
229 233
230 // TODO(smckay): rename this "StartActivity". 234 // TODO(smckay): rename this "StartActivity".
231 void WebIntentPickerController::ShowDialog(const string16& action, 235 void WebIntentPickerController::ShowDialog(const string16& action,
232 const string16& type) { 236 const string16& type) {
233 ShowDialog(false); 237 ShowDialog(false);
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 web_intents::RecordPickerShow( 1055 web_intents::RecordPickerShow(
1052 uma_bucket_, picker_model_->GetInstalledServiceCount()); 1056 uma_bucket_, picker_model_->GetInstalledServiceCount());
1053 picker_shown_ = true; 1057 picker_shown_ = true;
1054 } 1058 }
1055 1059
1056 void WebIntentPickerController::ClosePicker() { 1060 void WebIntentPickerController::ClosePicker() {
1057 SetDialogState(kPickerHidden); 1061 SetDialogState(kPickerHidden);
1058 if (picker_) 1062 if (picker_)
1059 picker_->Close(); 1063 picker_->Close();
1060 } 1064 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698