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

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

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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> 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void WebAuthFlow::Start() { 75 void WebAuthFlow::Start() {
76 AppWindowRegistry::Get(profile_)->AddObserver(this); 76 AppWindowRegistry::Get(profile_)->AddObserver(this);
77 77
78 // Attach a random ID string to the window so we can recognize it 78 // Attach a random ID string to the window so we can recognize it
79 // in OnAppWindowAdded. 79 // in OnAppWindowAdded.
80 std::string random_bytes; 80 std::string random_bytes;
81 crypto::RandBytes(base::WriteInto(&random_bytes, 33), 32); 81 crypto::RandBytes(base::WriteInto(&random_bytes, 33), 32);
82 base::Base64Encode(random_bytes, &app_window_key_); 82 base::Base64Encode(random_bytes, &app_window_key_);
83 83
84 // identityPrivate.onWebFlowRequest(app_window_key, provider_url_, mode_) 84 // identityPrivate.onWebFlowRequest(app_window_key, provider_url_, mode_)
85 scoped_ptr<base::ListValue> args(new base::ListValue()); 85 std::unique_ptr<base::ListValue> args(new base::ListValue());
86 args->AppendString(app_window_key_); 86 args->AppendString(app_window_key_);
87 args->AppendString(provider_url_.spec()); 87 args->AppendString(provider_url_.spec());
88 if (mode_ == WebAuthFlow::INTERACTIVE) 88 if (mode_ == WebAuthFlow::INTERACTIVE)
89 args->AppendString("interactive"); 89 args->AppendString("interactive");
90 else 90 else
91 args->AppendString("silent"); 91 args->AppendString("silent");
92 92
93 scoped_ptr<Event> event(new Event( 93 std::unique_ptr<Event> event(new Event(
94 events::IDENTITY_PRIVATE_ON_WEB_FLOW_REQUEST, 94 events::IDENTITY_PRIVATE_ON_WEB_FLOW_REQUEST,
95 identity_private::OnWebFlowRequest::kEventName, std::move(args))); 95 identity_private::OnWebFlowRequest::kEventName, std::move(args)));
96 event->restrict_to_browser_context = profile_; 96 event->restrict_to_browser_context = profile_;
97 ExtensionSystem* system = ExtensionSystem::Get(profile_); 97 ExtensionSystem* system = ExtensionSystem::Get(profile_);
98 98
99 extensions::ComponentLoader* component_loader = 99 extensions::ComponentLoader* component_loader =
100 system->extension_service()->component_loader(); 100 system->extension_service()->component_loader();
101 if (!component_loader->Exists(extension_misc::kIdentityApiUiAppId)) { 101 if (!component_loader->Exists(extension_misc::kIdentityApiUiAppId)) {
102 component_loader->Add( 102 component_loader->Add(
103 IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST, 103 IDR_IDENTITY_API_SCOPE_APPROVAL_MANIFEST,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 224 }
225 225
226 void WebAuthFlow::DidNavigateMainFrame( 226 void WebAuthFlow::DidNavigateMainFrame(
227 const content::LoadCommittedDetails& details, 227 const content::LoadCommittedDetails& details,
228 const content::FrameNavigateParams& params) { 228 const content::FrameNavigateParams& params) {
229 if (delegate_ && details.http_status_code >= 400) 229 if (delegate_ && details.http_status_code >= 400)
230 delegate_->OnAuthFlowFailure(LOAD_FAILED); 230 delegate_->OnAuthFlowFailure(LOAD_FAILED);
231 } 231 }
232 232
233 } // namespace extensions 233 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698