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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/importer/toolbar_importer_utils.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/importer/toolbar_importer_utils.cc
diff --git a/chrome/browser/importer/toolbar_importer_utils.cc b/chrome/browser/importer/toolbar_importer_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..362b02283730f8d63b8d35655a1bde1570dcef2c
--- /dev/null
+++ b/chrome/browser/importer/toolbar_importer_utils.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/importer/toolbar_importer_utils.h"
+
+#include <string>
+#include <vector>
+
+#include "base/string_split.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/net/url_request_context_getter.h"
+#include "googleurl/src/gurl.h"
+#include "net/base/cookie_store.h"
+
+namespace {
+const char kGoogleDomainUrl[] = "http://.google.com/";
+const char kGoogleDomainSecureCookieId[] = "SID=";
+const char kSplitStringToken = ';';
+}
+
+namespace toolbar_importer_utils {
+
+bool IsGoogleGAIACookieInstalled() {
+ net::CookieStore* store =
+ Profile::GetDefaultRequestContext()->GetCookieStore();
+ GURL url(kGoogleDomainUrl);
+ net::CookieOptions options;
+ options.set_include_httponly(); // The SID cookie might be httponly.
+ std::string cookies = store->GetCookiesWithOptions(url, options);
+ std::vector<std::string> cookie_list;
+ base::SplitString(cookies, kSplitStringToken, &cookie_list);
+ for (std::vector<std::string>::iterator current = cookie_list.begin();
+ current != cookie_list.end();
+ ++current) {
+ size_t position = (*current).find(kGoogleDomainSecureCookieId);
+ if (0 == position)
+ return true;
+ }
+ return false;
+}
+
+} // namespace toolbar_importer_utils
« 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