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

Unified Diff: chrome/browser/importer/toolbar_importer.h

Issue 18120005: Remove Google Toolbar importer (aka google.com/bookmarks importer). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: -explicit Created 7 years, 6 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/importer_type.cc ('k') | chrome/browser/importer/toolbar_importer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/importer/toolbar_importer.h
diff --git a/chrome/browser/importer/toolbar_importer.h b/chrome/browser/importer/toolbar_importer.h
deleted file mode 100644
index 961b67fcb17c5fd3e9cab02a09cf32f211b57676..0000000000000000000000000000000000000000
--- a/chrome/browser/importer/toolbar_importer.h
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (c) 2012 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.
-
-// The functionality provided here allows the user to import their bookmarks
-// (favorites) from Google Toolbar.
-
-#ifndef CHROME_BROWSER_IMPORTER_TOOLBAR_IMPORTER_H_
-#define CHROME_BROWSER_IMPORTER_TOOLBAR_IMPORTER_H_
-
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/gtest_prod_util.h"
-#include "base/memory/ref_counted.h"
-#include "base/strings/string16.h"
-#include "chrome/browser/importer/importer.h"
-#include "net/url_request/url_fetcher_delegate.h"
-#include "net/url_request/url_request_context_getter.h"
-
-struct ImportedBookmarkEntry;
-class ImporterBridge;
-class XmlReader;
-
-namespace net {
-class URLFetcher;
-} // namespace net
-
-// 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.
-// Toolbar5Importer should not have StartImport called more than once. Futher
-// if StartImport is called, then the class must not be destroyed until it has
-// either completed or Toolbar5Importer->Cancel() has been called.
-class Toolbar5Importer : public net::URLFetcherDelegate, public Importer {
- public:
- Toolbar5Importer();
-
- // Importer:
- // The importer view calls this method to begin the process. |items| should
- // only either be NONE or FAVORITES, since as of right now these are the only
- // items this importer supports.
- virtual void StartImport(const importer::SourceProfile& source_profile,
- uint16 items,
- ImporterBridge* bridge) OVERRIDE;
-
- // Importer view call this method when the user clicks the cancel button
- // in the tabbed options UI. We need to post a message to our loop
- // to cancel network retrieval.
- virtual void Cancel() OVERRIDE;
-
- // net::URLFetcherDelegate method called back from the URLFetcher object.
- virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
-
- private:
- FRIEND_TEST_ALL_PREFIXES(Toolbar5ImporterTest, BookmarkParse);
-
- virtual ~Toolbar5Importer();
-
- // Internal states of the toolbar importer.
- enum InternalStateEnum {
- NOT_USED = -1,
- INITIALIZED,
- GET_AUTHORIZATION_TOKEN,
- GET_BOOKMARKS,
- PARSE_BOOKMARKS,
- DONE
- };
-
- typedef std::vector<string16> BookmarkFolderType;
-
- // URLs for connecting to the toolbar front end are defined below.
- static const char kT5AuthorizationTokenUrl[];
- static const char kT5FrontEndUrlTemplate[];
-
- // Token replacement tags are defined below.
- static const char kRandomNumberToken[];
- static const char kAuthorizationToken[];
- static const char kAuthorizationTokenPrefix[];
- static const char kAuthorizationTokenSuffix[];
- static const char kMaxNumToken[];
- static const char kMaxTimestampToken[];
-
- // XML tag names are defined below.
- static const char kXmlApiReplyXmlTag[];
- static const char kBookmarksXmlTag[];
- static const char kBookmarkXmlTag[];
- static const char kTitleXmlTag[];
- static const char kUrlXmlTag[];
- static const char kTimestampXmlTag[];
- static const char kLabelsXmlTag[];
- static const char kLabelsXmlCloseTag[];
- static const char kLabelXmlTag[];
- static const char kAttributesXmlTag[];
-
- // Flow control for asynchronous import is controlled by the methods below.
- // ContinueImport is called back by each import action taken. BeginXXX
- // and EndXXX are responsible for updating the state of the asynchronous
- // import. EndImport is responsible for state cleanup and notifying the
- // caller that import has completed.
- void ContinueImport();
- void EndImport();
- void BeginImportBookmarks();
- void EndImportBookmarks();
-
- // Network I/O is done by the methods below. These three methods are called
- // in the order provided. The last two are called back with the HTML
- // response provided by the Toolbar server.
- void GetAuthenticationFromServer();
- void GetBookmarkDataFromServer(const std::string& response);
- void GetBookmarksFromServerDataResponse(const std::string& response);
-
- // XML Parsing is implemented with the methods below.
- bool ParseAuthenticationTokenResponse(const std::string& response,
- std::string* token);
-
- static bool ParseBookmarksFromReader(
- XmlReader* reader,
- std::vector<ImportedBookmarkEntry>* bookmarks,
- const string16& bookmark_group_string);
-
- static bool LocateNextOpenTag(XmlReader* reader);
- static bool LocateNextTagByName(XmlReader* reader, const std::string& tag);
- static bool LocateNextTagWithStopByName(
- XmlReader* reader,
- const std::string& tag,
- const std::string& stop);
-
- static bool ExtractBookmarkInformation(
- XmlReader* reader,
- ImportedBookmarkEntry* bookmark_entry,
- std::vector<BookmarkFolderType>* bookmark_folders,
- const string16& bookmark_group_string);
- static bool ExtractNamedValueFromXmlReader(XmlReader* reader,
- const std::string& name,
- std::string* buffer);
- static bool ExtractTitleFromXmlReader(XmlReader* reader,
- ImportedBookmarkEntry* entry);
- static bool ExtractUrlFromXmlReader(XmlReader* reader,
- ImportedBookmarkEntry* entry);
- static bool ExtractTimeFromXmlReader(XmlReader* reader,
- ImportedBookmarkEntry* entry);
- static bool ExtractFoldersFromXmlReader(
- XmlReader* reader,
- std::vector<BookmarkFolderType>* bookmark_folders,
- const string16& bookmark_group_string);
-
- // Bookmark creation is done by the method below.
- void AddBookmarksToChrome(
- const std::vector<ImportedBookmarkEntry>& bookmarks);
-
- InternalStateEnum state_;
-
- // Bitmask of Importer::ImportItem.
- uint16 items_to_import_;
-
- // The fetchers need to be available to cancel the network call on user cancel
- // hence they are stored as member variables.
- net::URLFetcher* token_fetcher_;
- net::URLFetcher* data_fetcher_;
-
- // Used to get correct login data for the toolbar server.
- scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
-
- DISALLOW_COPY_AND_ASSIGN(Toolbar5Importer);
-};
-
-#endif // CHROME_BROWSER_IMPORTER_TOOLBAR_IMPORTER_H_
« no previous file with comments | « chrome/browser/importer/importer_type.cc ('k') | chrome/browser/importer/toolbar_importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698