| 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 "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // identityPrivate.onWebFlowRequest(app_window_key, provider_url_, mode_) | 82 // identityPrivate.onWebFlowRequest(app_window_key, provider_url_, mode_) |
| 83 scoped_ptr<base::ListValue> args(new base::ListValue()); | 83 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 84 args->AppendString(app_window_key_); | 84 args->AppendString(app_window_key_); |
| 85 args->AppendString(provider_url_.spec()); | 85 args->AppendString(provider_url_.spec()); |
| 86 if (mode_ == WebAuthFlow::INTERACTIVE) | 86 if (mode_ == WebAuthFlow::INTERACTIVE) |
| 87 args->AppendString("interactive"); | 87 args->AppendString("interactive"); |
| 88 else | 88 else |
| 89 args->AppendString("silent"); | 89 args->AppendString("silent"); |
| 90 | 90 |
| 91 scoped_ptr<Event> event( | 91 scoped_ptr<Event> event( |
| 92 new Event(identity_private::OnWebFlowRequest::kEventName, args.Pass())); | 92 new Event(events::UNKNOWN, identity_private::OnWebFlowRequest::kEventName, |
| 93 args.Pass())); |
| 93 event->restrict_to_browser_context = profile_; | 94 event->restrict_to_browser_context = profile_; |
| 94 ExtensionSystem* system = ExtensionSystem::Get(profile_); | 95 ExtensionSystem* system = ExtensionSystem::Get(profile_); |
| 95 | 96 |
| 96 extensions::ComponentLoader* component_loader = | 97 extensions::ComponentLoader* component_loader = |
| 97 system->extension_service()->component_loader(); | 98 system->extension_service()->component_loader(); |
| 98 if (!component_loader->Exists(extension_misc::kIdentityApiUiAppId)) { | 99 if (!component_loader->Exists(extension_misc::kIdentityApiUiAppId)) { |
| 99 component_loader->Add( | 100 component_loader->Add( |
| 100 IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST, | 101 IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST, |
| 101 base::FilePath(FILE_PATH_LITERAL("identity_scope_approval_dialog"))); | 102 base::FilePath(FILE_PATH_LITERAL("identity_scope_approval_dialog"))); |
| 102 } | 103 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 238 } |
| 238 | 239 |
| 239 void WebAuthFlow::DidNavigateMainFrame( | 240 void WebAuthFlow::DidNavigateMainFrame( |
| 240 const content::LoadCommittedDetails& details, | 241 const content::LoadCommittedDetails& details, |
| 241 const content::FrameNavigateParams& params) { | 242 const content::FrameNavigateParams& params) { |
| 242 if (delegate_ && details.http_status_code >= 400) | 243 if (delegate_ && details.http_status_code >= 400) |
| 243 delegate_->OnAuthFlowFailure(LOAD_FAILED); | 244 delegate_->OnAuthFlowFailure(LOAD_FAILED); |
| 244 } | 245 } |
| 245 | 246 |
| 246 } // namespace extensions | 247 } // namespace extensions |
| OLD | NEW |