| 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" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 15 #include "chrome/browser/extensions/component_loader.h" | 16 #include "chrome/browser/extensions/component_loader.h" |
| 16 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/extensions/api/identity_private.h" | 19 #include "chrome/common/extensions/api/identity_private.h" |
| 19 #include "chrome/common/extensions/extension_constants.h" | 20 #include "chrome/common/extensions/extension_constants.h" |
| 20 #include "components/guest_view/browser/guest_view_base.h" | 21 #include "components/guest_view/browser/guest_view_base.h" |
| 21 #include "content/public/browser/navigation_details.h" | 22 #include "content/public/browser/navigation_details.h" |
| 22 #include "content/public/browser/navigation_entry.h" | 23 #include "content/public/browser/navigation_entry.h" |
| 23 #include "content/public/browser/notification_details.h" | 24 #include "content/public/browser/notification_details.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST, | 104 IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST, |
| 104 base::FilePath(FILE_PATH_LITERAL("identity_scope_approval_dialog"))); | 105 base::FilePath(FILE_PATH_LITERAL("identity_scope_approval_dialog"))); |
| 105 } | 106 } |
| 106 | 107 |
| 107 EventRouter::Get(profile_)->DispatchEventWithLazyListener( | 108 EventRouter::Get(profile_)->DispatchEventWithLazyListener( |
| 108 extension_misc::kIdentityApiUiAppId, std::move(event)); | 109 extension_misc::kIdentityApiUiAppId, std::move(event)); |
| 109 } | 110 } |
| 110 | 111 |
| 111 void WebAuthFlow::DetachDelegateAndDelete() { | 112 void WebAuthFlow::DetachDelegateAndDelete() { |
| 112 delegate_ = NULL; | 113 delegate_ = NULL; |
| 113 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 114 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void WebAuthFlow::OnAppWindowAdded(AppWindow* app_window) { | 117 void WebAuthFlow::OnAppWindowAdded(AppWindow* app_window) { |
| 117 if (app_window->window_key() == app_window_key_ && | 118 if (app_window->window_key() == app_window_key_ && |
| 118 app_window->extension_id() == extension_misc::kIdentityApiUiAppId) { | 119 app_window->extension_id() == extension_misc::kIdentityApiUiAppId) { |
| 119 app_window_ = app_window; | 120 app_window_ = app_window; |
| 120 WebContentsObserver::Observe(app_window->web_contents()); | 121 WebContentsObserver::Observe(app_window->web_contents()); |
| 121 | 122 |
| 122 registrar_.Add( | 123 registrar_.Add( |
| 123 this, | 124 this, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 225 } |
| 225 | 226 |
| 226 void WebAuthFlow::DidNavigateMainFrame( | 227 void WebAuthFlow::DidNavigateMainFrame( |
| 227 const content::LoadCommittedDetails& details, | 228 const content::LoadCommittedDetails& details, |
| 228 const content::FrameNavigateParams& params) { | 229 const content::FrameNavigateParams& params) { |
| 229 if (delegate_ && details.http_status_code >= 400) | 230 if (delegate_ && details.http_status_code >= 400) |
| 230 delegate_->OnAuthFlowFailure(LOAD_FAILED); | 231 delegate_->OnAuthFlowFailure(LOAD_FAILED); |
| 231 } | 232 } |
| 232 | 233 |
| 233 } // namespace extensions | 234 } // namespace extensions |
| OLD | NEW |