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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 DCHECK(dialog_state_ == kPickerWaiting); | 865 DCHECK(dialog_state_ == kPickerWaiting); |
866 break; | 866 break; |
867 | 867 |
868 case kPickerMain: | 868 case kPickerMain: |
869 // No DCHECK - main state can be reached from any state. | 869 // No DCHECK - main state can be reached from any state. |
870 // Ready to display data. | 870 // Ready to display data. |
871 picker_model_->SetWaitingForSuggestions(false); | 871 picker_model_->SetWaitingForSuggestions(false); |
872 break; | 872 break; |
873 | 873 |
874 case kPickerHidden: | 874 case kPickerHidden: |
| 875 // Once the picker dialog is closed, abandon all pending callbacks. |
| 876 weak_ptr_factory_.InvalidateWeakPtrs(); |
875 break; | 877 break; |
876 | 878 |
877 default: | 879 default: |
878 NOTREACHED(); | 880 NOTREACHED(); |
879 break; | 881 break; |
880 | 882 |
881 } | 883 } |
882 | 884 |
883 dialog_state_ = state; | 885 dialog_state_ = state; |
884 | 886 |
(...skipping 10 matching lines...) Expand all Loading... |
895 picker_->SetActionString(GetIntentActionString( | 897 picker_->SetActionString(GetIntentActionString( |
896 UTF16ToUTF8(picker_model_->action()))); | 898 UTF16ToUTF8(picker_model_->action()))); |
897 picker_shown_ = true; | 899 picker_shown_ = true; |
898 } | 900 } |
899 | 901 |
900 void WebIntentPickerController::ClosePicker() { | 902 void WebIntentPickerController::ClosePicker() { |
901 SetDialogState(kPickerHidden); | 903 SetDialogState(kPickerHidden); |
902 if (picker_) | 904 if (picker_) |
903 picker_->Close(); | 905 picker_->Close(); |
904 } | 906 } |
OLD | NEW |