| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSIONS_EXTENSION_INSTALL_DIALOG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALL_DIALOG_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALL_DIALOG_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALL_DIALOG_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/extensions/extension_install_prompt.h" | 9 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 10 #include "ui/gfx/animation/animation_delegate.h" | 10 #include "ui/gfx/animation/animation_delegate.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 Profile* profile, | 43 Profile* profile, |
| 44 content::PageNavigator* navigator, | 44 content::PageNavigator* navigator, |
| 45 const ExtensionInstallPrompt::DoneCallback& done_callback, | 45 const ExtensionInstallPrompt::DoneCallback& done_callback, |
| 46 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt); | 46 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt); |
| 47 ~ExtensionInstallDialogView() override; | 47 ~ExtensionInstallDialogView() override; |
| 48 | 48 |
| 49 // Returns the interior ScrollView of the dialog. This allows us to inspect | 49 // Returns the interior ScrollView of the dialog. This allows us to inspect |
| 50 // the contents of the DialogView. | 50 // the contents of the DialogView. |
| 51 const views::ScrollView* scroll_view() const { return scroll_view_; } | 51 const views::ScrollView* scroll_view() const { return scroll_view_; } |
| 52 | 52 |
| 53 static void SetInstallButtonDelayForTesting(int timeout_in_ms); |
| 54 |
| 53 private: | 55 private: |
| 54 // views::View: | 56 // views::View: |
| 55 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 57 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 58 void VisibilityChanged(views::View* starting_from, bool is_visible) override; |
| 56 | 59 |
| 57 // views::DialogDelegateView: | 60 // views::DialogDelegateView: |
| 58 int GetDialogButtons() const override; | 61 int GetDialogButtons() const override; |
| 59 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 62 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 60 int GetDefaultDialogButton() const override; | 63 int GetDefaultDialogButton() const override; |
| 61 bool Cancel() override; | 64 bool Cancel() override; |
| 62 bool Accept() override; | 65 bool Accept() override; |
| 63 ui::ModalType GetModalType() const override; | 66 ui::ModalType GetModalType() const override; |
| 64 void Layout() override; | 67 void Layout() override; |
| 65 gfx::Size GetPreferredSize() const override; | 68 gfx::Size GetPreferredSize() const override; |
| 66 views::View* CreateExtraView() override; | 69 views::View* CreateExtraView() override; |
| 70 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 67 | 71 |
| 68 // views::LinkListener: | 72 // views::LinkListener: |
| 69 void LinkClicked(views::Link* source, int event_flags) override; | 73 void LinkClicked(views::Link* source, int event_flags) override; |
| 70 | 74 |
| 71 // Initializes the dialog view, adding in permissions if they exist. | 75 // Initializes the dialog view, adding in permissions if they exist. |
| 72 void InitView(); | 76 void InitView(); |
| 73 | 77 |
| 78 // Enables the install button and updates the dialog buttons. |
| 79 void EnableInstallButton(); |
| 80 |
| 74 // Adds permissions of |perm_type| to the dialog view if they exist. | 81 // Adds permissions of |perm_type| to the dialog view if they exist. |
| 75 bool AddPermissions(views::GridLayout* layout, | 82 bool AddPermissions(views::GridLayout* layout, |
| 76 ui::ResourceBundle& rb, | 83 ui::ResourceBundle& rb, |
| 77 int column_set_id, | 84 int column_set_id, |
| 78 int left_column_width, | 85 int left_column_width, |
| 79 ExtensionInstallPrompt::PermissionsType perm_type); | 86 ExtensionInstallPrompt::PermissionsType perm_type); |
| 80 | 87 |
| 81 // Creates a layout consisting of dialog header, extension name and icon. | 88 // Creates a layout consisting of dialog header, extension name and icon. |
| 82 views::GridLayout* CreateLayout(int left_column_width, int column_set_id); | 89 views::GridLayout* CreateLayout(int left_column_width, int column_set_id); |
| 83 | 90 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 105 // The preferred size of the dialog. | 112 // The preferred size of the dialog. |
| 106 gfx::Size dialog_size_; | 113 gfx::Size dialog_size_; |
| 107 | 114 |
| 108 // ExperienceSampling: Track this UI event. | 115 // ExperienceSampling: Track this UI event. |
| 109 std::unique_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 116 std::unique_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
| 110 | 117 |
| 111 // Set to true once the user's selection has been received and the callback | 118 // Set to true once the user's selection has been received and the callback |
| 112 // has been run. | 119 // has been run. |
| 113 bool handled_result_; | 120 bool handled_result_; |
| 114 | 121 |
| 122 // Used to delay the activation of the install button. |
| 123 base::OneShotTimer timer_; |
| 124 |
| 125 // Used to determine whether the install button should be enabled. |
| 126 bool install_button_enabled_; |
| 127 |
| 115 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallDialogView); | 128 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallDialogView); |
| 116 }; | 129 }; |
| 117 | 130 |
| 118 // A simple view that prepends a view with a bullet with the help of a grid | 131 // A simple view that prepends a view with a bullet with the help of a grid |
| 119 // layout. | 132 // layout. |
| 120 class BulletedView : public views::View { | 133 class BulletedView : public views::View { |
| 121 public: | 134 public: |
| 122 explicit BulletedView(views::View* view); | 135 explicit BulletedView(views::View* view); |
| 123 private: | 136 private: |
| 124 DISALLOW_COPY_AND_ASSIGN(BulletedView); | 137 DISALLOW_COPY_AND_ASSIGN(BulletedView); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // on whether the details section is expanded). | 202 // on whether the details section is expanded). |
| 190 views::ImageButton* arrow_toggle_; | 203 views::ImageButton* arrow_toggle_; |
| 191 | 204 |
| 192 // Whether the details section is expanded. | 205 // Whether the details section is expanded. |
| 193 bool expanded_; | 206 bool expanded_; |
| 194 | 207 |
| 195 DISALLOW_COPY_AND_ASSIGN(ExpandableContainerView); | 208 DISALLOW_COPY_AND_ASSIGN(ExpandableContainerView); |
| 196 }; | 209 }; |
| 197 | 210 |
| 198 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALL_DIALOG_VIEW_H_ | 211 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALL_DIALOG_VIEW_H_ |
| OLD | NEW |