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

Side by Side Diff: chrome/browser/importer/toolbar_importer_utils.cc

Issue 6750010: importer: Cleanup ToolbarImporter code a little bit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/importer/toolbar_importer_utils.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/importer/toolbar_importer_utils.h"
6
7 #include <string>
8 #include <vector>
9
10 #include "base/string_split.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/net/url_request_context_getter.h"
13 #include "googleurl/src/gurl.h"
14 #include "net/base/cookie_store.h"
15
16 namespace {
17 const char kGoogleDomainUrl[] = "http://.google.com/";
18 const char kGoogleDomainSecureCookieId[] = "SID=";
19 const char kSplitStringToken = ';';
20 }
21
22 namespace toolbar_importer_utils {
23
24 bool IsGoogleGAIACookieInstalled() {
25 net::CookieStore* store =
26 Profile::GetDefaultRequestContext()->GetCookieStore();
27 GURL url(kGoogleDomainUrl);
28 net::CookieOptions options;
29 options.set_include_httponly(); // The SID cookie might be httponly.
30 std::string cookies = store->GetCookiesWithOptions(url, options);
31 std::vector<std::string> cookie_list;
32 base::SplitString(cookies, kSplitStringToken, &cookie_list);
33 for (std::vector<std::string>::iterator current = cookie_list.begin();
34 current != cookie_list.end();
35 ++current) {
36 size_t position = (*current).find(kGoogleDomainSecureCookieId);
37 if (0 == position)
38 return true;
39 }
40 return false;
41 }
42
43 } // namespace toolbar_importer_utils
OLDNEW
« no previous file with comments | « chrome/browser/importer/toolbar_importer_utils.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698