| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/external_cookie_handler.h" | 5 #include "chrome/browser/chromeos/external_cookie_handler.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/chromeos/pipe_reader.h" | 8 #include "chrome/browser/chromeos/pipe_reader.h" |
| 9 #include "chrome/browser/net/url_request_context_getter.h" | 9 #include "chrome/browser/net/url_request_context_getter.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "net/base/cookie_store.h" | 13 #include "net/base/cookie_store.h" |
| 14 #include "net/url_request/url_request_context.h" | 14 #include "net/url_request/url_request_context.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 void ExternalCookieHandler::GetCookies(const CommandLine& parsed_command_line, | 18 void ExternalCookieHandler::GetCookies(const CommandLine& parsed_command_line, |
| 19 Profile* profile) { | 19 Profile* profile) { |
| 20 // If there are Google External SSO cookies, add them to the cookie store. | 20 // If there are Google External SSO cookies, add them to the cookie store. |
| 21 if (parsed_command_line.HasSwitch(switches::kCookiePipe)) { | 21 if (parsed_command_line.HasSwitch(switches::kCookiePipe)) { |
| 22 std::string pipe_name = | 22 std::string pipe_name = |
| 23 WideToASCII(parsed_command_line.GetSwitchValue(switches::kCookiePipe)); | 23 parsed_command_line.GetSwitchValueASCII(switches::kCookiePipe); |
| 24 ExternalCookieHandler cookie_handler(new PipeReader(pipe_name)); | 24 ExternalCookieHandler cookie_handler(new PipeReader(pipe_name)); |
| 25 cookie_handler.HandleCookies( | 25 cookie_handler.HandleCookies( |
| 26 profile->GetRequestContext()->GetCookieStore()); | 26 profile->GetRequestContext()->GetCookieStore()); |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 // static | 30 // static |
| 31 const char ExternalCookieHandler::kGoogleAccountsUrl[] = | 31 const char ExternalCookieHandler::kGoogleAccountsUrl[] = |
| 32 "https://www.google.com/a/google.com/acs"; | 32 "https://www.google.com/a/google.com/acs"; |
| 33 | 33 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if (!cookie_store->SetCookieWithOptions(url, cookie_line, options)) | 67 if (!cookie_store->SetCookieWithOptions(url, cookie_line, options)) |
| 68 return false; | 68 return false; |
| 69 cookie_line = ReadLine(kChunkSize); | 69 cookie_line = ReadLine(kChunkSize); |
| 70 } | 70 } |
| 71 return true; | 71 return true; |
| 72 } | 72 } |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace chromeos | 76 } // namespace chromeos |
| OLD | NEW |