OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/ntp/new_tab_page_sync_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 static const GoogleCookieFilter kGAIACookieFilters[] = { | 45 static const GoogleCookieFilter kGAIACookieFilters[] = { |
46 { "http://.google.com/", "SID=" }, // Gmail. | 46 { "http://.google.com/", "SID=" }, // Gmail. |
47 // Add filters here for other interesting cookies that should result in | 47 // Add filters here for other interesting cookies that should result in |
48 // showing the promotions (e.g ASIDAS for dasher accounts). | 48 // showing the promotions (e.g ASIDAS for dasher accounts). |
49 }; | 49 }; |
50 | 50 |
51 bool IsGoogleGAIACookieInstalled() { | 51 bool IsGoogleGAIACookieInstalled() { |
52 for (size_t i = 0; i < arraysize(kGAIACookieFilters); ++i) { | 52 for (size_t i = 0; i < arraysize(kGAIACookieFilters); ++i) { |
53 // Since we are running on the UI thread don't call GetURLRequestContext(). | 53 // Since we are running on the UI thread don't call GetURLRequestContext(). |
54 net::CookieStore* store = | 54 net::CookieStore* store = |
55 Profile::GetDefaultRequestContext()->DONTUSEME_GetCookieStore(); | 55 Profile::Deprecated::GetDefaultRequestContext()-> |
| 56 DONTUSEME_GetCookieStore(); |
56 GURL url(kGAIACookieFilters[i].url); | 57 GURL url(kGAIACookieFilters[i].url); |
57 net::CookieOptions options; | 58 net::CookieOptions options; |
58 options.set_include_httponly(); // The SID cookie might be httponly. | 59 options.set_include_httponly(); // The SID cookie might be httponly. |
59 std::string cookies = store->GetCookiesWithOptions(url, options); | 60 std::string cookies = store->GetCookiesWithOptions(url, options); |
60 std::vector<std::string> cookie_list; | 61 std::vector<std::string> cookie_list; |
61 base::SplitString(cookies, ';', &cookie_list); | 62 base::SplitString(cookies, ';', &cookie_list); |
62 for (std::vector<std::string>::iterator current = cookie_list.begin(); | 63 for (std::vector<std::string>::iterator current = cookie_list.begin(); |
63 current != cookie_list.end(); | 64 current != cookie_list.end(); |
64 ++current) { | 65 ++current) { |
65 size_t position = | 66 size_t position = |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 if (linkurl.empty()) { | 212 if (linkurl.empty()) { |
212 value.SetBoolean("linkurlisset", false); | 213 value.SetBoolean("linkurlisset", false); |
213 } else { | 214 } else { |
214 value.SetBoolean("linkurlisset", true); | 215 value.SetBoolean("linkurlisset", true); |
215 value.SetString("linkurl", linkurl); | 216 value.SetString("linkurl", linkurl); |
216 } | 217 } |
217 } | 218 } |
218 } | 219 } |
219 web_ui_->CallJavascriptFunction("syncMessageChanged", value); | 220 web_ui_->CallJavascriptFunction("syncMessageChanged", value); |
220 } | 221 } |
OLD | NEW |