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

Side by Side Diff: chrome/browser/chromeos/login/helper.cc

Issue 2794493002: Add AuthPolicyLoginHelper (Closed)
Patch Set: Update after review Created 3 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/chromeos/login/helper.h" 5 #include "chrome/browser/chromeos/login/helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 content::WebContents* guest_contents = nullptr; 79 content::WebContents* guest_contents = nullptr;
80 manager->ForEachGuest(embedder, base::Bind(&FindGuestByPartitionName, 80 manager->ForEachGuest(embedder, base::Bind(&FindGuestByPartitionName,
81 partition_name, &guest_contents)); 81 partition_name, &guest_contents));
82 82
83 return guest_contents ? content::BrowserContext::GetStoragePartition( 83 return guest_contents ? content::BrowserContext::GetStoragePartition(
84 guest_contents->GetBrowserContext(), 84 guest_contents->GetBrowserContext(),
85 guest_contents->GetSiteInstance()) 85 guest_contents->GetSiteInstance())
86 : nullptr; 86 : nullptr;
87 } 87 }
88 88
89 base::ScopedFD GetDataReadPipe(const std::string& data) {
90 int pipe_fds[2];
91 if (!base::CreateLocalNonBlockingPipe(pipe_fds)) {
92 DLOG(ERROR) << "Failed to create pipe";
93 return base::ScopedFD();
94 }
95 base::ScopedFD pipe_read_end(pipe_fds[0]);
96 base::ScopedFD pipe_write_end(pipe_fds[1]);
97
98 if (!base::WriteFileDescriptor(pipe_write_end.get(), data.c_str(),
99 data.size())) {
100 DLOG(ERROR) << "Failed to write to pipe";
101 return base::ScopedFD();
102 }
103 return pipe_read_end;
104 }
105
106 } // namespace 89 } // namespace
107 90
108 gfx::Rect CalculateScreenBounds(const gfx::Size& size) { 91 gfx::Rect CalculateScreenBounds(const gfx::Size& size) {
109 gfx::Rect bounds = display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); 92 gfx::Rect bounds = display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
110 if (!size.IsEmpty()) { 93 if (!size.IsEmpty()) {
111 int horizontal_diff = bounds.width() - size.width(); 94 int horizontal_diff = bounds.width() - size.width();
112 int vertical_diff = bounds.height() - size.height(); 95 int vertical_diff = bounds.height() - size.height();
113 bounds.Inset(horizontal_diff / 2, vertical_diff / 2); 96 bounds.Inset(horizontal_diff / 2, vertical_diff / 2);
114 } 97 }
115 return bounds; 98 return bounds;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // webview instance. See http://crbug.com/477402 238 // webview instance. See http://crbug.com/477402
256 if (!signin_partition && !LoginDisplayHost::default_host()) 239 if (!signin_partition && !LoginDisplayHost::default_host())
257 return ProfileHelper::GetSigninProfile()->GetRequestContext(); 240 return ProfileHelper::GetSigninProfile()->GetRequestContext();
258 241
259 if (!signin_partition) 242 if (!signin_partition)
260 return nullptr; 243 return nullptr;
261 244
262 return signin_partition->GetURLRequestContext(); 245 return signin_partition->GetURLRequestContext();
263 } 246 }
264 247
265 void GetPipeReadEnd(const std::string& data,
266 const OnPipeReadyCallback& callback) {
267 base::PostTaskWithTraitsAndReplyWithResult(
268 FROM_HERE, base::TaskTraits().MayBlock().WithPriority(
269 base::TaskPriority::BACKGROUND),
270 base::Bind(&GetDataReadPipe, data), callback);
271 }
272
273 } // namespace login 248 } // namespace login
274 249
275 } // namespace chromeos 250 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/helper.h ('k') | chrome/browser/chromeos/login/login_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698