Chromium Code Reviews| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 ClosePicker(); | 412 ClosePicker(); |
| 413 } | 413 } |
| 414 | 414 |
| 415 void WebIntentPickerController::OnChooseAnotherService() { | 415 void WebIntentPickerController::OnChooseAnotherService() { |
| 416 DCHECK(intents_dispatcher_); | 416 DCHECK(intents_dispatcher_); |
| 417 | 417 |
| 418 intents_dispatcher_->ResetDispatch(); | 418 intents_dispatcher_->ResetDispatch(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 void WebIntentPickerController::OnClosing() { | 421 void WebIntentPickerController::OnClosing() { |
| 422 picker_shown_ = false; | 422 SetDialogState(kPickerHidden); |
| 423 picker_ = NULL; | 423 picker_ = NULL; |
| 424 } | 424 } |
| 425 | 425 |
| 426 void WebIntentPickerController::OnExtensionInstallSuccess( | 426 void WebIntentPickerController::OnExtensionInstallSuccess( |
| 427 const std::string& extension_id) { | 427 const std::string& extension_id) { |
| 428 // OnExtensionInstallSuccess is called via NotificationService::Notify before | 428 // OnExtensionInstallSuccess is called via NotificationService::Notify before |
| 429 // the extension is added to the ExtensionService. Dispatch via PostTask to | 429 // the extension is added to the ExtensionService. Dispatch via PostTask to |
| 430 // allow ExtensionService to update. | 430 // allow ExtensionService to update. |
| 431 MessageLoop::current()->PostTask( | 431 MessageLoop::current()->PostTask( |
| 432 FROM_HERE, | 432 FROM_HERE, |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 880 void WebIntentPickerController::SetDialogState(WebIntentPickerState state) { | 880 void WebIntentPickerController::SetDialogState(WebIntentPickerState state) { |
| 881 // Ignore events that don't change state. | 881 // Ignore events that don't change state. |
| 882 if (state == dialog_state_) | 882 if (state == dialog_state_) |
| 883 return; | 883 return; |
| 884 | 884 |
| 885 // Any pending timers are abandoned on state changes. | 885 // Any pending timers are abandoned on state changes. |
| 886 timer_factory_.InvalidateWeakPtrs(); | 886 timer_factory_.InvalidateWeakPtrs(); |
| 887 | 887 |
| 888 switch (state) { | 888 switch (state) { |
| 889 case kPickerSetup: | 889 case kPickerSetup: |
| 890 DCHECK(dialog_state_ == kPickerHidden); | 890 DCHECK(dialog_state_ == kPickerHidden); |
|
tfarina
2012/08/26 12:45:54
nit:
DCHECK_EQ(expected, actual);
so
DCHECK_EQ(kP
groby-ooo-7-16
2012/08/28 00:08:17
Done.
| |
| 891 | |
|
tfarina
2012/08/26 12:45:54
is necessary to remove this empty line? I think it
groby-ooo-7-16
2012/08/28 00:08:17
It doesn't add much clarity, either.
On 2012/08/26
| |
| 892 // Post timer CWS pending | 891 // Post timer CWS pending |
| 893 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 892 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 894 base::Bind(&WebIntentPickerController::OnPickerEvent, | 893 base::Bind(&WebIntentPickerController::OnPickerEvent, |
| 895 timer_factory_.GetWeakPtr(), | 894 timer_factory_.GetWeakPtr(), |
| 896 kPickerEventHiddenSetupTimeout), | 895 kPickerEventHiddenSetupTimeout), |
| 897 base::TimeDelta::FromMilliseconds(kMaxHiddenSetupTimeMs)); | 896 base::TimeDelta::FromMilliseconds(kMaxHiddenSetupTimeMs)); |
| 898 break; | 897 break; |
| 899 | 898 |
| 900 case kPickerWaiting: | 899 case kPickerWaiting: |
| 901 DCHECK(dialog_state_ == kPickerSetup); | 900 DCHECK(dialog_state_ == kPickerSetup); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 942 picker_->SetActionString(GetIntentActionString( | 941 picker_->SetActionString(GetIntentActionString( |
| 943 UTF16ToUTF8(picker_model_->action()))); | 942 UTF16ToUTF8(picker_model_->action()))); |
| 944 picker_shown_ = true; | 943 picker_shown_ = true; |
| 945 } | 944 } |
| 946 | 945 |
| 947 void WebIntentPickerController::ClosePicker() { | 946 void WebIntentPickerController::ClosePicker() { |
| 948 SetDialogState(kPickerHidden); | 947 SetDialogState(kPickerHidden); |
| 949 if (picker_) | 948 if (picker_) |
| 950 picker_->Close(); | 949 picker_->Close(); |
| 951 } | 950 } |
| OLD | NEW |