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 { |
| 17 |
16 void ExternalCookieHandler::GetCookies(const CommandLine& parsed_command_line, | 18 void ExternalCookieHandler::GetCookies(const CommandLine& parsed_command_line, |
17 Profile* profile) { | 19 Profile* profile) { |
18 // 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. |
19 if (parsed_command_line.HasSwitch(switches::kCookiePipe)) { | 21 if (parsed_command_line.HasSwitch(switches::kCookiePipe)) { |
20 std::string pipe_name = | 22 std::string pipe_name = |
21 WideToASCII(parsed_command_line.GetSwitchValue(switches::kCookiePipe)); | 23 WideToASCII(parsed_command_line.GetSwitchValue(switches::kCookiePipe)); |
22 ExternalCookieHandler cookie_handler(new PipeReader(pipe_name)); | 24 ExternalCookieHandler cookie_handler(new PipeReader(pipe_name)); |
23 cookie_handler.HandleCookies( | 25 cookie_handler.HandleCookies( |
24 profile->GetRequestContext()->GetCookieStore()); | 26 profile->GetRequestContext()->GetCookieStore()); |
25 } | 27 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 std::string cookie_line = ReadLine(kChunkSize); | 65 std::string cookie_line = ReadLine(kChunkSize); |
64 while (!cookie_line.empty()) { | 66 while (!cookie_line.empty()) { |
65 if (!cookie_store->SetCookieWithOptions(url, cookie_line, options)) | 67 if (!cookie_store->SetCookieWithOptions(url, cookie_line, options)) |
66 return false; | 68 return false; |
67 cookie_line = ReadLine(kChunkSize); | 69 cookie_line = ReadLine(kChunkSize); |
68 } | 70 } |
69 return true; | 71 return true; |
70 } | 72 } |
71 return false; | 73 return false; |
72 } | 74 } |
| 75 |
| 76 } // namespace chromeos |
OLD | NEW |