| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VIEWS_FIRST_RUN_VIEW_BASE_H__ | 5 #ifndef CHROME_BROWSER_VIEWS_FIRST_RUN_VIEW_BASE_H_ |
| 6 #define CHROME_BROWSER_VIEWS_FIRST_RUN_VIEW_BASE_H__ | 6 #define CHROME_BROWSER_VIEWS_FIRST_RUN_VIEW_BASE_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/importer/importer.h" | 8 #include "chrome/browser/importer/importer.h" |
| 9 #include "chrome/views/dialog_delegate.h" | 9 #include "chrome/views/dialog_delegate.h" |
| 10 #include "chrome/views/view.h" | 10 #include "chrome/views/view.h" |
| 11 | 11 |
| 12 namespace ChromeViews { | 12 namespace ChromeViews { |
| 13 | 13 class CheckBox; |
| 14 class Window; | 14 class Window; |
| 15 class ImageView; | 15 class ImageView; |
| 16 class Separator; | 16 class Separator; |
| 17 class Throbber; | 17 class Throbber; |
| 18 | |
| 19 } | 18 } |
| 20 | 19 |
| 21 class Profile; | 20 class Profile; |
| 22 class ImporterHost; | 21 class ImporterHost; |
| 23 | 22 |
| 24 // This class abstracts the code that creates the dialog look for the two | 23 // This class abstracts the code that creates the dialog look for the two |
| 25 // first-run dialogs. This amounts to the bitmap, the two separators, the | 24 // first-run dialogs. This amounts to the bitmap, the two separators, the |
| 26 // progress throbber and some common resize code. | 25 // progress throbber and some common resize code. |
| 27 class FirstRunViewBase : public ChromeViews::View, | 26 class FirstRunViewBase : public ChromeViews::View, |
| 28 public ChromeViews::DialogDelegate { | 27 public ChromeViews::DialogDelegate { |
| 29 public: | 28 public: |
| 30 explicit FirstRunViewBase(Profile* profile); | 29 explicit FirstRunViewBase(Profile* profile); |
| 31 virtual ~FirstRunViewBase(); | 30 virtual ~FirstRunViewBase(); |
| 32 | 31 |
| 33 // Overridden from ChromeViews::View. | 32 // Overridden from ChromeViews::View. |
| 34 virtual void Layout(); | 33 virtual void Layout(); |
| 35 | 34 |
| 36 // Overridden from ChromeViews::WindowDelegate. | 35 // Overridden from ChromeViews::WindowDelegate. |
| 37 virtual bool CanResize() const; | 36 virtual bool CanResize() const; |
| 38 virtual bool CanMaximize() const; | 37 virtual bool CanMaximize() const; |
| 39 virtual bool IsAlwaysOnTop() const; | 38 virtual bool IsAlwaysOnTop() const; |
| 40 virtual bool HasAlwaysOnTopMenu() const; | 39 virtual bool HasAlwaysOnTopMenu() const; |
| 41 | 40 |
| 41 // Overridden from ChromeViews::DialogDelegate. |
| 42 std::wstring GetDialogButtonLabel(DialogButton button) const; |
| 43 |
| 42 protected: | 44 protected: |
| 43 // Returns the items that the first run process is required to import | 45 // Returns the items that the first run process is required to import |
| 44 // from other browsers. | 46 // from other browsers. |
| 45 int GetDefaultImportItems() const; | 47 int GetDefaultImportItems() const; |
| 46 | 48 |
| 47 // Creates the desktop and quick launch shortcut. Existing shortcut is lost. | 49 // Creates the desktop and quick launch shortcut. Existing shortcut is lost. |
| 48 bool CreateDesktopShortcut(); | 50 bool CreateDesktopShortcut(); |
| 49 bool CreateQuickLaunchShortcut(); | 51 bool CreateQuickLaunchShortcut(); |
| 50 | 52 |
| 53 // Set us as default browser if the user checked the box. |
| 54 bool SetDefaultBrowser(); |
| 55 |
| 51 // Modifies the chrome configuration so that the first-run dialogs are not | 56 // Modifies the chrome configuration so that the first-run dialogs are not |
| 52 // shown again. | 57 // shown again. |
| 53 bool FirstRunComplete(); | 58 bool FirstRunComplete(); |
| 54 | 59 |
| 55 // Disables the standard buttons of the dialog. Useful when importing. | 60 // Disables the standard buttons of the dialog. Useful when importing. |
| 56 void DisableButtons(); | 61 void DisableButtons(); |
| 57 // Computes a tight dialog width given a contained UI element. | 62 // Computes a tight dialog width given a contained UI element. |
| 58 void AdjustDialogWidth(const ChromeViews::View* sub_view); | 63 void AdjustDialogWidth(const ChromeViews::View* sub_view); |
| 59 | 64 |
| 60 // Sets a minimum dialog size. | 65 // Sets a minimum dialog size. |
| 61 void SetMinimumDialogWidth(int width); | 66 void SetMinimumDialogWidth(int width); |
| 62 | 67 |
| 63 // Returns the background image. It is useful for getting the metrics. | 68 // Returns the background image. It is useful for getting the metrics. |
| 64 const ChromeViews::ImageView* background_image() const { | 69 const ChromeViews::ImageView* background_image() const { |
| 65 return background_image_; | 70 return background_image_; |
| 66 } | 71 } |
| 67 // Returns the computed preferred width of the dialog. This value can change | 72 // Returns the computed preferred width of the dialog. This value can change |
| 68 // when AdjustDialogWidth() is called during layout. | 73 // when AdjustDialogWidth() is called during layout. |
| 69 int preferred_width() const { | 74 int preferred_width() const { |
| 70 return preferred_width_; | 75 return preferred_width_; |
| 71 } | 76 } |
| 72 | 77 |
| 73 scoped_refptr<ImporterHost> importer_host_; | 78 scoped_refptr<ImporterHost> importer_host_; |
| 74 Profile* profile_; | 79 Profile* profile_; |
| 80 ChromeViews::CheckBox* default_browser_; |
| 75 | 81 |
| 76 private: | 82 private: |
| 77 // Initializes the controls on the dialog. | 83 // Initializes the controls on the dialog. |
| 78 void SetupControls(); | 84 void SetupControls(); |
| 79 ChromeViews::ImageView* background_image_; | 85 ChromeViews::ImageView* background_image_; |
| 80 ChromeViews::Separator* separator_1_; | 86 ChromeViews::Separator* separator_1_; |
| 81 ChromeViews::Separator* separator_2_; | 87 ChromeViews::Separator* separator_2_; |
| 82 int preferred_width_; | 88 int preferred_width_; |
| 83 | 89 |
| 84 DISALLOW_EVIL_CONSTRUCTORS(FirstRunViewBase); | 90 DISALLOW_COPY_AND_ASSIGN(FirstRunViewBase); |
| 85 }; | 91 }; |
| 86 | 92 |
| 87 #endif // CHROME_BROWSER_VIEWS_FIRST_RUN_VIEW_BASE_H__ | 93 #endif // CHROME_BROWSER_VIEWS_FIRST_RUN_VIEW_BASE_H_ |
| 88 | 94 |
| OLD | NEW |