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

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

Issue 1223983002: Move WriteInto to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 "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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 app_window_->web_contents()->Close(); 69 app_window_->web_contents()->Close();
70 } 70 }
71 } 71 }
72 72
73 void WebAuthFlow::Start() { 73 void WebAuthFlow::Start() {
74 AppWindowRegistry::Get(profile_)->AddObserver(this); 74 AppWindowRegistry::Get(profile_)->AddObserver(this);
75 75
76 // Attach a random ID string to the window so we can recoginize it 76 // Attach a random ID string to the window so we can recoginize it
77 // in OnAppWindowAdded. 77 // in OnAppWindowAdded.
78 std::string random_bytes; 78 std::string random_bytes;
79 crypto::RandBytes(WriteInto(&random_bytes, 33), 32); 79 crypto::RandBytes(base::WriteInto(&random_bytes, 33), 32);
80 base::Base64Encode(random_bytes, &app_window_key_); 80 base::Base64Encode(random_bytes, &app_window_key_);
81 81
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");
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 240
241 void WebAuthFlow::DidNavigateMainFrame( 241 void WebAuthFlow::DidNavigateMainFrame(
242 const content::LoadCommittedDetails& details, 242 const content::LoadCommittedDetails& details,
243 const content::FrameNavigateParams& params) { 243 const content::FrameNavigateParams& params) {
244 if (delegate_ && details.http_status_code >= 400) 244 if (delegate_ && details.http_status_code >= 400)
245 delegate_->OnAuthFlowFailure(LOAD_FAILED); 245 delegate_->OnAuthFlowFailure(LOAD_FAILED);
246 } 246 }
247 247
248 } // namespace extensions 248 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc ('k') | chrome/browser/internal_auth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698