summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-27 12:29:45 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-27 12:29:45 +0000
commit56229141f03391ddf535ee3db8900ca11eac4902 (patch)
tree2e00d1b30ed6773076c493652421a5533ddffd03
parentee79b24ae1fe1b9d0b47fe7e9132ee478c2e79ed (diff)
downloadchromium_src-56229141f03391ddf535ee3db8900ca11eac4902.zip
chromium_src-56229141f03391ddf535ee3db8900ca11eac4902.tar.gz
chromium_src-56229141f03391ddf535ee3db8900ca11eac4902.tar.bz2
importer: Cleanup ToolbarImporter code a little bit.
- Move toolbar_importer_utils into its own header file. - Remove unneed includes. BUG=None TEST=None R=maruel@chromium.org,avi@chromium.org Review URL: http://codereview.chromium.org/6750010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79513 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/importer/importer_bridge.h4
-rw-r--r--chrome/browser/importer/importer_host.cc2
-rw-r--r--chrome/browser/importer/toolbar_importer.cc32
-rw-r--r--chrome/browser/importer/toolbar_importer.h7
-rw-r--r--chrome/browser/importer/toolbar_importer_utils.cc43
-rw-r--r--chrome/browser/importer/toolbar_importer_utils.h18
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/profile_import/profile_import_thread.cc1
8 files changed, 69 insertions, 40 deletions
diff --git a/chrome/browser/importer/importer_bridge.h b/chrome/browser/importer/importer_bridge.h
index 5731c58..5648168 100644
--- a/chrome/browser/importer/importer_bridge.h
+++ b/chrome/browser/importer/importer_bridge.h
@@ -14,8 +14,10 @@
#include "base/string16.h"
#include "build/build_config.h"
#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/browser/importer/profile_writer.h"
+
// TODO: remove this, see friend declaration in ImporterBridge.
-#include "chrome/browser/importer/toolbar_importer.h"
+class Toolbar5Importer;
class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> {
public:
diff --git a/chrome/browser/importer/importer_host.cc b/chrome/browser/importer/importer_host.cc
index f01fe22..c3ac3c30 100644
--- a/chrome/browser/importer/importer_host.cc
+++ b/chrome/browser/importer/importer_host.cc
@@ -10,11 +10,13 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/importer/external_process_importer_client.h"
#include "chrome/browser/importer/firefox_profile_lock.h"
+#include "chrome/browser/importer/importer.h"
#include "chrome/browser/importer/importer_bridge.h"
#include "chrome/browser/importer/importer_list.h"
#include "chrome/browser/importer/importer_lock_dialog.h"
#include "chrome/browser/importer/importer_progress_observer.h"
#include "chrome/browser/importer/in_process_importer_bridge.h"
+#include "chrome/browser/importer/toolbar_importer_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index ea9d3b6..de3fec3 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -9,47 +9,15 @@
#include "base/rand_util.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
-#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "base/values.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/importer/importer_bridge.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/libxml_utils.h"
-#include "chrome/common/net/url_request_context_getter.h"
#include "content/browser/browser_thread.h"
#include "grit/generated_resources.h"
-#include "net/base/cookie_monster.h"
-#include "net/base/data_url.h"
-#include "net/url_request/url_request_context.h"
-
-// ToolbarImporterUtils
-static const char* kGoogleDomainUrl = "http://.google.com/";
-static const wchar_t kSplitStringToken = L';';
-static const char* kGoogleDomainSecureCookieId = "SID=";
-
-bool toolbar_importer_utils::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;
-}
-//
// Toolbar5Importer
-//
const char Toolbar5Importer::kXmlApiReplyXmlTag[] = "xml_api_reply";
const char Toolbar5Importer::kBookmarksXmlTag[] = "bookmarks";
const char Toolbar5Importer::kBookmarkXmlTag[] = "bookmark";
diff --git a/chrome/browser/importer/toolbar_importer.h b/chrome/browser/importer/toolbar_importer.h
index f8f3bde..c61bcea 100644
--- a/chrome/browser/importer/toolbar_importer.h
+++ b/chrome/browser/importer/toolbar_importer.h
@@ -24,13 +24,6 @@
class ImporterBridge;
class XmlReader;
-// Currently the only configuration information we need is to check whether or
-// not the user currently has their GAIA cookie. This is done by the function
-// exposed through the ToolbarImportUtils namespace.
-namespace toolbar_importer_utils {
-bool IsGoogleGAIACookieInstalled();
-}
-
// Toolbar5Importer is a class which exposes the functionality needed to
// communicate with the Google Toolbar v5 front-end, negotiate the download of
// Toolbar bookmarks, parse them, and install them on the client.
diff --git a/chrome/browser/importer/toolbar_importer_utils.cc b/chrome/browser/importer/toolbar_importer_utils.cc
new file mode 100644
index 0000000..362b022
--- /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
diff --git a/chrome/browser/importer/toolbar_importer_utils.h b/chrome/browser/importer/toolbar_importer_utils.h
new file mode 100644
index 0000000..f5b5177
--- /dev/null
+++ b/chrome/browser/importer/toolbar_importer_utils.h
@@ -0,0 +1,18 @@
+// 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.
+
+#ifndef CHROME_BROWSER_IMPORTER_TOOLBAR_IMPORTER_UTILS_H_
+#define CHROME_BROWSER_IMPORTER_TOOLBAR_IMPORTER_UTILS_H_
+#pragma once
+
+namespace toolbar_importer_utils {
+
+// Currently the only configuration information we need is to check whether or
+// not the user currently has their GAIA cookie. This is done by the function
+// exposed through the ToolbarImportUtils namespace.
+bool IsGoogleGAIACookieInstalled();
+
+} // namespace toolbar_importer_utils
+
+#endif // CHROME_BROWSER_IMPORTER_TOOLBAR_IMPORTER_UTILS_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index b7b2972..965831f 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1237,6 +1237,8 @@
'browser/importer/safari_importer.mm',
'browser/importer/toolbar_importer.cc',
'browser/importer/toolbar_importer.h',
+ 'browser/importer/toolbar_importer_utils.cc',
+ 'browser/importer/toolbar_importer_utils.h',
'browser/instant/instant_commit_type.h',
'browser/instant/instant_confirm_dialog.cc',
'browser/instant/instant_confirm_dialog.h',
diff --git a/chrome/profile_import/profile_import_thread.cc b/chrome/profile_import/profile_import_thread.cc
index 41c0521..562911f 100644
--- a/chrome/profile_import/profile_import_thread.cc
+++ b/chrome/profile_import/profile_import_thread.cc
@@ -8,6 +8,7 @@
#include "base/values.h"
#include "chrome/browser/importer/external_process_importer_bridge.h"
+#include "chrome/browser/importer/importer.h"
#include "chrome/browser/importer/importer_list.h"
#include "chrome/browser/importer/importer_messages.h"
#include "chrome/browser/search_engines/template_url.h"