| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_IMPORTER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_IMPORTER_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_IMPORTER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_IMPORTER_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "app/combobox_model.h" | 9 #include "app/combobox_model.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // ImporterView draws the dialog that allows the user to select what to | 25 // ImporterView draws the dialog that allows the user to select what to |
| 26 // import from other browsers. | 26 // import from other browsers. |
| 27 // Note: The UI team hasn't defined yet how the import UI will look like. | 27 // Note: The UI team hasn't defined yet how the import UI will look like. |
| 28 // So now use dialog as a placeholder. | 28 // So now use dialog as a placeholder. |
| 29 class ImporterView : public views::View, | 29 class ImporterView : public views::View, |
| 30 public views::DialogDelegate, | 30 public views::DialogDelegate, |
| 31 public views::ButtonListener, | 31 public views::ButtonListener, |
| 32 public ComboboxModel, | 32 public ComboboxModel, |
| 33 public views::Combobox::Listener, | 33 public views::Combobox::Listener, |
| 34 public ImporterList::Observer, |
| 34 public ImportObserver { | 35 public ImportObserver { |
| 35 public: | 36 public: |
| 36 // Creates a new ImporterView. |initial_state| is a bitmask of ImportItems. | 37 // Creates a new ImporterView. |initial_state| is a bitmask of ImportItems. |
| 37 // Each checkbox for the bits in |initial_state| is checked. | 38 // Each checkbox for the bits in |initial_state| is checked. |
| 38 ImporterView(Profile* profile, int initial_state); | 39 ImporterView(Profile* profile, int initial_state); |
| 39 virtual ~ImporterView(); | 40 virtual ~ImporterView(); |
| 40 | 41 |
| 41 // Overridden from views::View: | 42 // views::View implementation. |
| 42 virtual gfx::Size GetPreferredSize(); | 43 virtual gfx::Size GetPreferredSize(); |
| 43 virtual void Layout(); | 44 virtual void Layout(); |
| 44 | 45 |
| 45 // Overridden from views::DialogDelegate: | 46 // views::DialogDelegate implementation. |
| 46 virtual std::wstring GetDialogButtonLabel( | 47 virtual std::wstring GetDialogButtonLabel( |
| 47 MessageBoxFlags::DialogButton button) const; | 48 MessageBoxFlags::DialogButton button) const; |
| 48 virtual bool IsDialogButtonEnabled( | 49 virtual bool IsDialogButtonEnabled( |
| 49 MessageBoxFlags::DialogButton button) const; | 50 MessageBoxFlags::DialogButton button) const; |
| 50 virtual bool IsModal() const; | 51 virtual bool IsModal() const; |
| 51 virtual std::wstring GetWindowTitle() const; | 52 virtual std::wstring GetWindowTitle() const; |
| 52 virtual bool Accept(); | 53 virtual bool Accept(); |
| 53 virtual views::View* GetContentsView(); | 54 virtual views::View* GetContentsView(); |
| 54 | 55 |
| 55 // Overridden from views::ButtonListener: | 56 // views::ButtonListener implementation. |
| 56 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 57 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
| 57 | 58 |
| 58 // Overridden from ComboboxModel: | 59 // ComboboxModel implementation. |
| 59 virtual int GetItemCount(); | 60 virtual int GetItemCount(); |
| 60 virtual string16 GetItemAt(int index); | 61 virtual string16 GetItemAt(int index); |
| 61 | 62 |
| 62 // Overridden from ChromeViews::Combobox::Listener: | 63 // ChromeViews::Combobox::Listener implementation. |
| 63 virtual void ItemChanged(views::Combobox* combobox, | 64 virtual void ItemChanged(views::Combobox* combobox, |
| 64 int prev_index, | 65 int prev_index, |
| 65 int new_index); | 66 int new_index); |
| 66 | 67 |
| 67 // Overridden from ImportObserver: | 68 // ImporterList::Observer implementation. |
| 69 virtual void SourceProfilesLoaded(); |
| 70 |
| 71 // ImportObserver implementation. |
| 68 virtual void ImportCanceled(); | 72 virtual void ImportCanceled(); |
| 69 virtual void ImportComplete(); | 73 virtual void ImportComplete(); |
| 70 | 74 |
| 71 private: | 75 private: |
| 72 // Initializes the controls on the dialog. | 76 // Initializes the controls on the dialog. |
| 73 void SetupControl(); | 77 void SetupControl(); |
| 74 | 78 |
| 75 // Creates and initializes a new check-box. | 79 // Creates and initializes a new check-box. |
| 76 views::Checkbox* InitCheckbox(const std::wstring& text, bool checked); | 80 views::Checkbox* InitCheckbox(const std::wstring& text, bool checked); |
| 77 | 81 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 100 | 104 |
| 101 // Initial state of the |checkbox_items_|. | 105 // Initial state of the |checkbox_items_|. |
| 102 uint16 initial_state_; | 106 uint16 initial_state_; |
| 103 | 107 |
| 104 Profile* profile_; | 108 Profile* profile_; |
| 105 | 109 |
| 106 DISALLOW_COPY_AND_ASSIGN(ImporterView); | 110 DISALLOW_COPY_AND_ASSIGN(ImporterView); |
| 107 }; | 111 }; |
| 108 | 112 |
| 109 #endif // CHROME_BROWSER_UI_VIEWS_IMPORTER_VIEW_H_ | 113 #endif // CHROME_BROWSER_UI_VIEWS_IMPORTER_VIEW_H_ |
| OLD | NEW |