Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: chrome/browser/ui/views/extensions/extension_install_dialog_view.h

Issue 1534123002: [Extensions] Migrate ExtensionInstallPrompt::Delegate to be a callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 namespace views { 32 namespace views {
33 class GridLayout; 33 class GridLayout;
34 class ImageButton; 34 class ImageButton;
35 class Link; 35 class Link;
36 } 36 }
37 37
38 // Implements the extension installation dialog for TOOLKIT_VIEWS. 38 // Implements the extension installation dialog for TOOLKIT_VIEWS.
39 class ExtensionInstallDialogView : public views::DialogDelegateView, 39 class ExtensionInstallDialogView : public views::DialogDelegateView,
40 public views::LinkListener { 40 public views::LinkListener {
41 public: 41 public:
42 ExtensionInstallDialogView(Profile* profile, 42 ExtensionInstallDialogView(
43 content::PageNavigator* navigator, 43 Profile* profile,
44 ExtensionInstallPrompt::Delegate* delegate, 44 content::PageNavigator* navigator,
45 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt); 45 const ExtensionInstallPrompt::DoneCallback& done_callback,
46 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt);
46 ~ExtensionInstallDialogView() override; 47 ~ExtensionInstallDialogView() override;
47 48
48 // 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
49 // the contents of the DialogView. 50 // the contents of the DialogView.
50 const views::ScrollView* scroll_view() const { return scroll_view_; } 51 const views::ScrollView* scroll_view() const { return scroll_view_; }
51 52
52 private: 53 private:
53 // views::DialogDelegateView: 54 // views::DialogDelegateView:
54 int GetDialogButtons() const override; 55 int GetDialogButtons() const override;
55 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; 56 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
(...skipping 28 matching lines...) Expand all
84 85
85 bool is_external_install() const { 86 bool is_external_install() const {
86 return prompt_->type() == ExtensionInstallPrompt::EXTERNAL_INSTALL_PROMPT; 87 return prompt_->type() == ExtensionInstallPrompt::EXTERNAL_INSTALL_PROMPT;
87 } 88 }
88 89
89 // Updates the histogram that holds installation accepted/aborted data. 90 // Updates the histogram that holds installation accepted/aborted data.
90 void UpdateInstallResultHistogram(bool accepted) const; 91 void UpdateInstallResultHistogram(bool accepted) const;
91 92
92 Profile* profile_; 93 Profile* profile_;
93 content::PageNavigator* navigator_; 94 content::PageNavigator* navigator_;
94 ExtensionInstallPrompt::Delegate* delegate_; 95 ExtensionInstallPrompt::DoneCallback done_callback_;
95 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt_; 96 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt_;
96 97
97 // The container view that contains all children (heading, icon, webstore 98 // The container view that contains all children (heading, icon, webstore
98 // data, and the scroll view with permissions etc.), excluding the buttons, 99 // data, and the scroll view with permissions etc.), excluding the buttons,
99 // which are added automatically by the dialog system. 100 // which are added automatically by the dialog system.
100 View* container_; 101 View* container_;
101 102
102 // The scroll view containing all the details for the dialog (including all 103 // The scroll view containing all the details for the dialog (including all
103 // collapsible/expandable sections). 104 // collapsible/expandable sections).
104 views::ScrollView* scroll_view_; 105 views::ScrollView* scroll_view_;
105 106
106 // The preferred size of the dialog. 107 // The preferred size of the dialog.
107 gfx::Size dialog_size_; 108 gfx::Size dialog_size_;
108 109
109 // ExperienceSampling: Track this UI event. 110 // ExperienceSampling: Track this UI event.
110 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; 111 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_;
111 112
112 // Set to true once the user's selection has been received and the 113 // Set to true once the user's selection has been received and the callback
113 // |delegate_| has been notified. 114 // has been ran.
Avi (use Gerrit) 2015/12/29 03:10:45 "... has been run"?
Devlin 2016/01/04 22:59:23 Dang English. Done.
114 bool handled_result_; 115 bool handled_result_;
115 116
116 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallDialogView); 117 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallDialogView);
117 }; 118 };
118 119
119 // A simple view that prepends a view with a bullet with the help of a grid 120 // A simple view that prepends a view with a bullet with the help of a grid
120 // layout. 121 // layout.
121 class BulletedView : public views::View { 122 class BulletedView : public views::View {
122 public: 123 public:
123 explicit BulletedView(views::View* view); 124 explicit BulletedView(views::View* view);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // on whether the details section is expanded). 205 // on whether the details section is expanded).
205 views::ImageButton* arrow_toggle_; 206 views::ImageButton* arrow_toggle_;
206 207
207 // Whether the details section is expanded. 208 // Whether the details section is expanded.
208 bool expanded_; 209 bool expanded_;
209 210
210 DISALLOW_COPY_AND_ASSIGN(ExpandableContainerView); 211 DISALLOW_COPY_AND_ASSIGN(ExpandableContainerView);
211 }; 212 };
212 213
213 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALL_DIALOG_VIEW_H_ 214 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALL_DIALOG_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698