| 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/web_auth_flow.h" | 5 #include "chrome/browser/extensions/api/identity/web_auth_flow.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 // identityPrivate.onWebFlowRequest(app_window_key, provider_url_, mode_) | 89 // identityPrivate.onWebFlowRequest(app_window_key, provider_url_, mode_) |
| 90 std::unique_ptr<base::ListValue> args(new base::ListValue()); | 90 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
| 91 args->AppendString(app_window_key_); | 91 args->AppendString(app_window_key_); |
| 92 args->AppendString(provider_url_.spec()); | 92 args->AppendString(provider_url_.spec()); |
| 93 if (mode_ == WebAuthFlow::INTERACTIVE) | 93 if (mode_ == WebAuthFlow::INTERACTIVE) |
| 94 args->AppendString("interactive"); | 94 args->AppendString("interactive"); |
| 95 else | 95 else |
| 96 args->AppendString("silent"); | 96 args->AppendString("silent"); |
| 97 | 97 |
| 98 std::unique_ptr<Event> event(new Event( | 98 auto event = |
| 99 events::IDENTITY_PRIVATE_ON_WEB_FLOW_REQUEST, | 99 base::MakeUnique<Event>(events::IDENTITY_PRIVATE_ON_WEB_FLOW_REQUEST, |
| 100 identity_private::OnWebFlowRequest::kEventName, std::move(args))); | 100 identity_private::OnWebFlowRequest::kEventName, |
| 101 event->restrict_to_browser_context = profile_; | 101 std::move(args), profile_); |
| 102 ExtensionSystem* system = ExtensionSystem::Get(profile_); | 102 ExtensionSystem* system = ExtensionSystem::Get(profile_); |
| 103 | 103 |
| 104 extensions::ComponentLoader* component_loader = | 104 extensions::ComponentLoader* component_loader = |
| 105 system->extension_service()->component_loader(); | 105 system->extension_service()->component_loader(); |
| 106 if (!component_loader->Exists(extension_misc::kIdentityApiUiAppId)) { | 106 if (!component_loader->Exists(extension_misc::kIdentityApiUiAppId)) { |
| 107 component_loader->Add( | 107 component_loader->Add( |
| 108 IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST, | 108 IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST, |
| 109 base::FilePath(FILE_PATH_LITERAL("identity_scope_approval_dialog"))); | 109 base::FilePath(FILE_PATH_LITERAL("identity_scope_approval_dialog"))); |
| 110 } | 110 } |
| 111 | 111 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 "identity", "WebAuthFlow", this, "DidFinishNavigationFailure", | 219 "identity", "WebAuthFlow", this, "DidFinishNavigationFailure", |
| 220 "response_code", | 220 "response_code", |
| 221 navigation_handle->GetResponseHeaders()->response_code()); | 221 navigation_handle->GetResponseHeaders()->response_code()); |
| 222 } | 222 } |
| 223 | 223 |
| 224 if (failed && delegate_) | 224 if (failed && delegate_) |
| 225 delegate_->OnAuthFlowFailure(LOAD_FAILED); | 225 delegate_->OnAuthFlowFailure(LOAD_FAILED); |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace extensions | 228 } // namespace extensions |
| OLD | NEW |