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_VIEWS_IMPORTER_IMPORT_PROGRESS_DIALOG_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_IMPORTER_IMPORT_PROGRESS_DIALOG_VIEW_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 "base/memory/scoped_ptr.h" 13 #include "chrome/browser/importer/importer_data_types.h" 14 #include "chrome/browser/importer/importer_progress_observer.h" 15 #include "views/view.h" 16 #include "views/window/dialog_delegate.h" 17 18 class ImporterHost; 19 class ImporterObserver; 20 21 namespace views { 22 class CheckmarkThrobber; 23 class Label; 24 } 25 26 class ImportProgressDialogView : public views::View, 27 public views::DialogDelegate, 28 public importer::ImporterProgressObserver { 29 public: 30 // |items| is a bitmask of importer::ImportItem being imported. 31 // |bookmark_import| is true if we're importing bookmarks from a 32 // bookmarks.html file. 33 ImportProgressDialogView(HWND parent_window, 34 uint16 items, 35 ImporterHost* importer_host, 36 ImporterObserver* importer_observer, 37 const string16& importer_name, 38 bool bookmarks_import); 39 virtual ~ImportProgressDialogView(); 40 41 protected: 42 // views::View: 43 virtual gfx::Size GetPreferredSize() OVERRIDE; 44 virtual void ViewHierarchyChanged(bool is_add, 45 views::View* parent, 46 views::View* child) OVERRIDE; 47 48 // views::DialogDelegate: 49 virtual int GetDialogButtons() const OVERRIDE; 50 virtual std::wstring GetDialogButtonLabel( 51 MessageBoxFlags::DialogButton button) const OVERRIDE; 52 virtual bool IsModal() const OVERRIDE; 53 virtual std::wstring GetWindowTitle() const OVERRIDE; 54 virtual bool Cancel() OVERRIDE; 55 virtual views::View* GetContentsView() OVERRIDE; 56 57 private: 58 // Set up the control layout within this dialog. 59 void InitControlLayout(); 60 61 // importer::ImporterProgressObserver: 62 virtual void ImportStarted() OVERRIDE; 63 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE; 64 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE; 65 virtual void ImportEnded() OVERRIDE; 66 67 // The native window that we are parented to. Can be NULL. 68 HWND parent_window_; 69 70 // Various dialog controls. 71 scoped_ptr<views::CheckmarkThrobber> state_bookmarks_; 72 scoped_ptr<views::CheckmarkThrobber> state_searches_; 73 scoped_ptr<views::CheckmarkThrobber> state_passwords_; 74 scoped_ptr<views::CheckmarkThrobber> state_history_; 75 scoped_ptr<views::CheckmarkThrobber> state_cookies_; 76 views::Label* label_info_; 77 scoped_ptr<views::Label> label_bookmarks_; 78 scoped_ptr<views::Label> label_searches_; 79 scoped_ptr<views::Label> label_passwords_; 80 scoped_ptr<views::Label> label_history_; 81 scoped_ptr<views::Label> label_cookies_; 82 83 // Items to import from the other browser 84 uint16 items_; 85 86 // Utility class that does the actual import. 87 scoped_refptr<ImporterHost> importer_host_; 88 89 // Observer that we need to notify about import events. 90 ImporterObserver* importer_observer_; 91 92 // True if the import operation is in progress. 93 bool importing_; 94 95 // Are we importing a bookmarks.html file? 96 bool bookmarks_import_; 97 98 DISALLOW_COPY_AND_ASSIGN(ImportProgressDialogView); 99 }; 100 101 #endif // CHROME_BROWSER_UI_VIEWS_IMPORTER_IMPORT_PROGRESS_DIALOG_VIEW_H_ 102