| 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/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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 picker_model_(new WebIntentPickerModel()), | 177 picker_model_(new WebIntentPickerModel()), |
| 178 pending_async_count_(0), | 178 pending_async_count_(0), |
| 179 picker_shown_(false), | 179 picker_shown_(false), |
| 180 intents_dispatcher_(NULL), | 180 intents_dispatcher_(NULL), |
| 181 service_tab_(NULL), | 181 service_tab_(NULL), |
| 182 weak_ptr_factory_(this) { | 182 weak_ptr_factory_(this) { |
| 183 content::NavigationController* controller = | 183 content::NavigationController* controller = |
| 184 &wrapper->web_contents()->GetController(); | 184 &wrapper->web_contents()->GetController(); |
| 185 registrar_.Add(this, content::NOTIFICATION_LOAD_START, | 185 registrar_.Add(this, content::NOTIFICATION_LOAD_START, |
| 186 content::Source<content::NavigationController>(controller)); | 186 content::Source<content::NavigationController>(controller)); |
| 187 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, | 187 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, |
| 188 content::Source<content::NavigationController>(controller)); | 188 content::Source<content::NavigationController>(controller)); |
| 189 } | 189 } |
| 190 | 190 |
| 191 WebIntentPickerController::~WebIntentPickerController() { | 191 WebIntentPickerController::~WebIntentPickerController() { |
| 192 } | 192 } |
| 193 | 193 |
| 194 void WebIntentPickerController::SetIntentsDispatcher( | 194 void WebIntentPickerController::SetIntentsDispatcher( |
| 195 content::WebIntentsDispatcher* intents_dispatcher) { | 195 content::WebIntentsDispatcher* intents_dispatcher) { |
| 196 intents_dispatcher_ = intents_dispatcher; | 196 intents_dispatcher_ = intents_dispatcher; |
| 197 intents_dispatcher_->RegisterReplyNotification( | 197 intents_dispatcher_->RegisterReplyNotification( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 action, type, | 235 action, type, |
| 236 base::Bind(&WebIntentPickerController::OnCWSIntentServicesAvailable, | 236 base::Bind(&WebIntentPickerController::OnCWSIntentServicesAvailable, |
| 237 weak_ptr_factory_.GetWeakPtr())); | 237 weak_ptr_factory_.GetWeakPtr())); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void WebIntentPickerController::Observe( | 240 void WebIntentPickerController::Observe( |
| 241 int type, | 241 int type, |
| 242 const content::NotificationSource& source, | 242 const content::NotificationSource& source, |
| 243 const content::NotificationDetails& details) { | 243 const content::NotificationDetails& details) { |
| 244 DCHECK(type == content::NOTIFICATION_LOAD_START || | 244 DCHECK(type == content::NOTIFICATION_LOAD_START || |
| 245 type == content::NOTIFICATION_TAB_CLOSING); | 245 type == chrome::NOTIFICATION_TAB_CLOSING); |
| 246 ClosePicker(); | 246 ClosePicker(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void WebIntentPickerController::OnServiceChosen(const GURL& url, | 249 void WebIntentPickerController::OnServiceChosen(const GURL& url, |
| 250 Disposition disposition) { | 250 Disposition disposition) { |
| 251 switch (disposition) { | 251 switch (disposition) { |
| 252 case WebIntentPickerModel::DISPOSITION_INLINE: | 252 case WebIntentPickerModel::DISPOSITION_INLINE: |
| 253 // Set the model to inline disposition. It will notify the picker which | 253 // Set the model to inline disposition. It will notify the picker which |
| 254 // will respond (via OnInlineDispositionWebContentsCreated) with the | 254 // will respond (via OnInlineDispositionWebContentsCreated) with the |
| 255 // WebContents to dispatch the intent to. | 255 // WebContents to dispatch the intent to. |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (--pending_async_count_ == 0) { | 566 if (--pending_async_count_ == 0) { |
| 567 if (picker_) | 567 if (picker_) |
| 568 picker_->OnPendingAsyncCompleted(); | 568 picker_->OnPendingAsyncCompleted(); |
| 569 } | 569 } |
| 570 } | 570 } |
| 571 | 571 |
| 572 void WebIntentPickerController::ClosePicker() { | 572 void WebIntentPickerController::ClosePicker() { |
| 573 if (picker_) | 573 if (picker_) |
| 574 picker_->Close(); | 574 picker_->Close(); |
| 575 } | 575 } |
| OLD | NEW |