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