Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/browser/extensions/api/identity/web_auth_flow.cc

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
8
7 #include "base/base64.h" 9 #include "base/base64.h"
8 #include "base/location.h" 10 #include "base/location.h"
9 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
12 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
13 #include "chrome/browser/extensions/component_loader.h" 15 #include "chrome/browser/extensions/component_loader.h"
14 #include "chrome/browser/extensions/extension_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/extensions/api/identity_private.h" 18 #include "chrome/common/extensions/api/identity_private.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 83
82 // identityPrivate.onWebFlowRequest(app_window_key, provider_url_, mode_) 84 // identityPrivate.onWebFlowRequest(app_window_key, provider_url_, mode_)
83 scoped_ptr<base::ListValue> args(new base::ListValue()); 85 scoped_ptr<base::ListValue> args(new base::ListValue());
84 args->AppendString(app_window_key_); 86 args->AppendString(app_window_key_);
85 args->AppendString(provider_url_.spec()); 87 args->AppendString(provider_url_.spec());
86 if (mode_ == WebAuthFlow::INTERACTIVE) 88 if (mode_ == WebAuthFlow::INTERACTIVE)
87 args->AppendString("interactive"); 89 args->AppendString("interactive");
88 else 90 else
89 args->AppendString("silent"); 91 args->AppendString("silent");
90 92
91 scoped_ptr<Event> event( 93 scoped_ptr<Event> event(new Event(
92 new Event(events::IDENTITY_PRIVATE_ON_WEB_FLOW_REQUEST, 94 events::IDENTITY_PRIVATE_ON_WEB_FLOW_REQUEST,
93 identity_private::OnWebFlowRequest::kEventName, args.Pass())); 95 identity_private::OnWebFlowRequest::kEventName, std::move(args)));
94 event->restrict_to_browser_context = profile_; 96 event->restrict_to_browser_context = profile_;
95 ExtensionSystem* system = ExtensionSystem::Get(profile_); 97 ExtensionSystem* system = ExtensionSystem::Get(profile_);
96 98
97 extensions::ComponentLoader* component_loader = 99 extensions::ComponentLoader* component_loader =
98 system->extension_service()->component_loader(); 100 system->extension_service()->component_loader();
99 if (!component_loader->Exists(extension_misc::kIdentityApiUiAppId)) { 101 if (!component_loader->Exists(extension_misc::kIdentityApiUiAppId)) {
100 component_loader->Add( 102 component_loader->Add(
101 IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST, 103 IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST,
102 base::FilePath(FILE_PATH_LITERAL("identity_scope_approval_dialog"))); 104 base::FilePath(FILE_PATH_LITERAL("identity_scope_approval_dialog")));
103 } 105 }
104 106
105 EventRouter::Get(profile_)->DispatchEventWithLazyListener( 107 EventRouter::Get(profile_)->DispatchEventWithLazyListener(
106 extension_misc::kIdentityApiUiAppId, event.Pass()); 108 extension_misc::kIdentityApiUiAppId, std::move(event));
107 } 109 }
108 110
109 void WebAuthFlow::DetachDelegateAndDelete() { 111 void WebAuthFlow::DetachDelegateAndDelete() {
110 delegate_ = NULL; 112 delegate_ = NULL;
111 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 113 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
112 } 114 }
113 115
114 void WebAuthFlow::OnAppWindowAdded(AppWindow* app_window) { 116 void WebAuthFlow::OnAppWindowAdded(AppWindow* app_window) {
115 if (app_window->window_key() == app_window_key_ && 117 if (app_window->window_key() == app_window_key_ &&
116 app_window->extension_id() == extension_misc::kIdentityApiUiAppId) { 118 app_window->extension_id() == extension_misc::kIdentityApiUiAppId) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 224 }
223 225
224 void WebAuthFlow::DidNavigateMainFrame( 226 void WebAuthFlow::DidNavigateMainFrame(
225 const content::LoadCommittedDetails& details, 227 const content::LoadCommittedDetails& details,
226 const content::FrameNavigateParams& params) { 228 const content::FrameNavigateParams& params) {
227 if (delegate_ && details.http_status_code >= 400) 229 if (delegate_ && details.http_status_code >= 400)
228 delegate_->OnAuthFlowFailure(LOAD_FAILED); 230 delegate_->OnAuthFlowFailure(LOAD_FAILED);
229 } 231 }
230 232
231 } // namespace extensions 233 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698