Home | History | Annotate | Download | only in importer
      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 #ifndef CHROME_BROWSER_UI_GTK_IMPORTER_IMPORT_PROGRESS_DIALOG_GTK_H_
      6 #define CHROME_BROWSER_UI_GTK_IMPORTER_IMPORT_PROGRESS_DIALOG_GTK_H_
      7 #pragma once
      8 
      9 #include "base/basictypes.h"
     10 #include "base/compiler_specific.h"
     11 #include "base/memory/ref_counted.h"
     12 #include "chrome/browser/importer/importer_data_types.h"
     13 #include "chrome/browser/importer/importer_progress_observer.h"
     14 #include "ui/base/gtk/gtk_signal.h"
     15 
     16 class ImporterHost;
     17 class ImporterObserver;
     18 class Profile;
     19 
     20 typedef struct _GtkWidget Widget;
     21 typedef struct _GtkWindow GtkWindow;
     22 
     23 class ImportProgressDialogGtk : public importer::ImporterProgressObserver {
     24  public:
     25   // Displays the import progress dialog box and starts the import process.
     26   static void StartImport(GtkWindow* parent,
     27                           uint16 items,
     28                           ImporterHost* importer_host,
     29                           ImporterObserver* importer_observer,
     30                           const importer::SourceProfile& source_profile,
     31                           Profile* profile,
     32                           bool first_run);
     33 
     34  private:
     35   ImportProgressDialogGtk(GtkWindow* parent,
     36                           uint16 items,
     37                           ImporterHost* importer_host,
     38                           ImporterObserver* importer_observer,
     39                           const string16& importer_name,
     40                           bool bookmarks_import);
     41   virtual ~ImportProgressDialogGtk();
     42 
     43   CHROMEGTK_CALLBACK_1(ImportProgressDialogGtk, void, OnResponse, int);
     44 
     45   void ShowDialog();
     46 
     47   void CloseDialog();
     48 
     49   // importer::ImporterProgressObserver:
     50   virtual void ImportStarted() OVERRIDE;
     51   virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE;
     52   virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE;
     53   virtual void ImportEnded() OVERRIDE;
     54 
     55   // Parent window.
     56   GtkWindow* parent_;
     57 
     58   // Import progress dialog.
     59   GtkWidget* dialog_;
     60 
     61   // Bookmarks/Favorites checkbox.
     62   GtkWidget* bookmarks_;
     63 
     64   // Search Engines checkbox.
     65   GtkWidget* search_engines_;
     66 
     67   // Passwords checkbox.
     68   GtkWidget* passwords_;
     69 
     70   // History checkbox.
     71   GtkWidget* history_;
     72 
     73   // Items to import from the other browser.
     74   uint16 items_;
     75 
     76   // Utility class that does the actual import.
     77   scoped_refptr<ImporterHost> importer_host_;
     78 
     79   // Observer that we need to notify about import events.
     80   ImporterObserver* importer_observer_;
     81 
     82   // True if the import operation is in progress.
     83   bool importing_;
     84 
     85   DISALLOW_COPY_AND_ASSIGN(ImportProgressDialogGtk);
     86 };
     87 
     88 #endif  // CHROME_BROWSER_UI_GTK_IMPORTER_IMPORT_PROGRESS_DIALOG_GTK_H_
     89