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/extensions/api/identity/identity_api.h" | 5 #include "chrome/browser/extensions/api/identity/identity_api.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 break; | 936 break; |
937 case WebAuthFlow::LOAD_FAILED: | 937 case WebAuthFlow::LOAD_FAILED: |
938 error_ = identity_constants::kPageLoadFailure; | 938 error_ = identity_constants::kPageLoadFailure; |
939 break; | 939 break; |
940 default: | 940 default: |
941 NOTREACHED() << "Unexpected error from web auth flow: " << failure; | 941 NOTREACHED() << "Unexpected error from web auth flow: " << failure; |
942 error_ = identity_constants::kInvalidRedirect; | 942 error_ = identity_constants::kInvalidRedirect; |
943 break; | 943 break; |
944 } | 944 } |
945 SendResponse(false); | 945 SendResponse(false); |
| 946 if (auth_flow_) |
| 947 auth_flow_.release()->DetachDelegateAndDelete(); |
946 Release(); // Balanced in RunAsync. | 948 Release(); // Balanced in RunAsync. |
947 } | 949 } |
948 | 950 |
949 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( | 951 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( |
950 const GURL& redirect_url) { | 952 const GURL& redirect_url) { |
951 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { | 953 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { |
952 SetResult(new base::StringValue(redirect_url.spec())); | 954 SetResult(new base::StringValue(redirect_url.spec())); |
953 SendResponse(true); | 955 SendResponse(true); |
| 956 if (auth_flow_) |
| 957 auth_flow_.release()->DetachDelegateAndDelete(); |
954 Release(); // Balanced in RunAsync. | 958 Release(); // Balanced in RunAsync. |
955 } | 959 } |
956 } | 960 } |
957 | 961 |
958 } // namespace extensions | 962 } // namespace extensions |
OLD | NEW |