Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/views/extensions/extension_install_dialog_view.h" | |
| 6 | |
| 5 #include <vector> | 7 #include <vector> |
| 6 | 8 |
| 7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 10 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 11 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/extensions/bundle_installer.h" | 16 #include "chrome/browser/extensions/bundle_installer.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 42 #include "ui/views/controls/link.h" | 44 #include "ui/views/controls/link.h" |
| 43 #include "ui/views/controls/link_listener.h" | 45 #include "ui/views/controls/link_listener.h" |
| 44 #include "ui/views/controls/scroll_view.h" | 46 #include "ui/views/controls/scroll_view.h" |
| 45 #include "ui/views/controls/separator.h" | 47 #include "ui/views/controls/separator.h" |
| 46 #include "ui/views/layout/box_layout.h" | 48 #include "ui/views/layout/box_layout.h" |
| 47 #include "ui/views/layout/grid_layout.h" | 49 #include "ui/views/layout/grid_layout.h" |
| 48 #include "ui/views/layout/layout_constants.h" | 50 #include "ui/views/layout/layout_constants.h" |
| 49 #include "ui/views/view.h" | 51 #include "ui/views/view.h" |
| 50 #include "ui/views/widget/widget.h" | 52 #include "ui/views/widget/widget.h" |
| 51 #include "ui/views/window/dialog_client_view.h" | 53 #include "ui/views/window/dialog_client_view.h" |
| 52 #include "ui/views/window/dialog_delegate.h" | 54 #include "ui/views/window/dialog_delegate.h" |
|
Finnur
2014/07/16 10:36:11
Looks like lots of includes were copied from .cc t
Chris Thompson
2014/07/16 20:13:28
Shuffled around includes and forward declarations.
| |
| 53 | 55 |
| 54 using content::OpenURLParams; | 56 using content::OpenURLParams; |
| 55 using content::Referrer; | 57 using content::Referrer; |
| 56 using extensions::BundleInstaller; | 58 using extensions::BundleInstaller; |
| 57 | 59 |
| 58 namespace { | 60 // Width of bullet column in BulletedView. |
|
Finnur
2014/07/16 10:36:12
Why remove this?
Chris Thompson
2014/07/16 20:13:28
Hmm, good point. Added back in for the "static" de
|
Finnur
2014/07/16 10:36:11
nit: s/of/of the/
Chris Thompson
2014/07/16 20:13:28
Done.
|
| 61 const int kBulletWidth = 20; | |
| 59 | 62 |
| 60 // Size of extension icon in top left of dialog. | 63 // Size of extension icon in top left of dialog. |
| 61 const int kIconSize = 64; | 64 const int kIconSize = 64; |
| 62 | 65 |
| 63 // We offset the icon a little bit from the right edge of the dialog, to make it | 66 // We offset the icon a little bit from the right edge of the dialog, to make it |
| 64 // align with the button below it. | 67 // align with the button below it. |
| 65 const int kIconOffset = 16; | 68 const int kIconOffset = 16; |
| 66 | 69 |
| 67 // The dialog will resize based on its content, but this sets a maximum height | 70 // The dialog will resize based on its content, but this sets a maximum height |
| 68 // before overflowing a scrollbar. | 71 // before overflowing a scrollbar. |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 91 // experiment. This is used to group the actions in UMA histograms named | 94 // experiment. This is used to group the actions in UMA histograms named |
| 92 // Extensions.InstallPromptExperiment.ShowDetails and | 95 // Extensions.InstallPromptExperiment.ShowDetails and |
| 93 // Extensions.InstallPromptExperiment.ShowPermissions. | 96 // Extensions.InstallPromptExperiment.ShowPermissions. |
| 94 enum ExperimentLinkAction { | 97 enum ExperimentLinkAction { |
| 95 LINK_SHOWN = 0, | 98 LINK_SHOWN = 0, |
| 96 LINK_NOT_SHOWN, | 99 LINK_NOT_SHOWN, |
| 97 LINK_CLICKED, | 100 LINK_CLICKED, |
| 98 NUM_LINK_ACTIONS | 101 NUM_LINK_ACTIONS |
| 99 }; | 102 }; |
| 100 | 103 |
| 101 typedef std::vector<base::string16> PermissionDetails; | |
| 102 class ExpandableContainerView; | |
| 103 | |
| 104 void AddResourceIcon(const gfx::ImageSkia* skia_image, void* data) { | 104 void AddResourceIcon(const gfx::ImageSkia* skia_image, void* data) { |
| 105 views::View* parent = static_cast<views::View*>(data); | 105 views::View* parent = static_cast<views::View*>(data); |
| 106 views::ImageView* image_view = new views::ImageView(); | 106 views::ImageView* image_view = new views::ImageView(); |
| 107 image_view->SetImage(*skia_image); | 107 image_view->SetImage(*skia_image); |
| 108 parent->AddChildView(image_view); | 108 parent->AddChildView(image_view); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Creates a string for displaying |message| to the user. If it has to look | 111 // Creates a string for displaying |message| to the user. If it has to look |
| 112 // like a entry in a bullet point list, one is added. | 112 // like a entry in a bullet point list, one is added. |
| 113 base::string16 PrepareForDisplay(const base::string16& message, | 113 base::string16 PrepareForDisplay(const base::string16& message, |
| 114 bool bullet_point) { | 114 bool bullet_point) { |
| 115 return bullet_point ? l10n_util::GetStringFUTF16( | 115 return bullet_point ? l10n_util::GetStringFUTF16( |
| 116 IDS_EXTENSION_PERMISSION_LINE, | 116 IDS_EXTENSION_PERMISSION_LINE, |
| 117 message) : message; | 117 message) : message; |
| 118 } | 118 } |
| 119 | 119 |
| 120 // A custom scrollable view implementation for the dialog. | |
| 121 class CustomScrollableView : public views::View { | |
| 122 public: | |
| 123 CustomScrollableView(); | |
| 124 virtual ~CustomScrollableView(); | |
| 125 | |
| 126 private: | |
| 127 virtual void Layout() OVERRIDE; | |
| 128 | |
| 129 DISALLOW_COPY_AND_ASSIGN(CustomScrollableView); | |
| 130 }; | |
| 131 | |
| 132 // Implements the extension installation dialog for TOOLKIT_VIEWS. | |
| 133 class ExtensionInstallDialogView : public views::DialogDelegateView, | |
| 134 public views::LinkListener, | |
| 135 public views::ButtonListener { | |
| 136 public: | |
| 137 ExtensionInstallDialogView( | |
| 138 content::PageNavigator* navigator, | |
| 139 ExtensionInstallPrompt::Delegate* delegate, | |
| 140 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt); | |
| 141 virtual ~ExtensionInstallDialogView(); | |
| 142 | |
| 143 // Called when one of the child elements has expanded/collapsed. | |
| 144 void ContentsChanged(); | |
| 145 | |
| 146 private: | |
| 147 // views::DialogDelegateView: | |
| 148 virtual int GetDialogButtons() const OVERRIDE; | |
| 149 virtual base::string16 GetDialogButtonLabel( | |
| 150 ui::DialogButton button) const OVERRIDE; | |
| 151 virtual int GetDefaultDialogButton() const OVERRIDE; | |
| 152 virtual bool Cancel() OVERRIDE; | |
| 153 virtual bool Accept() OVERRIDE; | |
| 154 virtual ui::ModalType GetModalType() const OVERRIDE; | |
| 155 virtual base::string16 GetWindowTitle() const OVERRIDE; | |
| 156 virtual void Layout() OVERRIDE; | |
| 157 virtual gfx::Size GetPreferredSize() const OVERRIDE; | |
| 158 virtual void ViewHierarchyChanged( | |
| 159 const ViewHierarchyChangedDetails& details) OVERRIDE; | |
| 160 | |
| 161 // views::LinkListener: | |
| 162 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | |
| 163 | |
| 164 // views::ButtonListener: | |
| 165 virtual void ButtonPressed(views::Button* sender, | |
| 166 const ui::Event& event) OVERRIDE; | |
| 167 | |
| 168 // Experimental: Toggles inline permission explanations with an animation. | |
| 169 void ToggleInlineExplanations(); | |
| 170 | |
| 171 // Creates a layout consisting of dialog header, extension name and icon. | |
| 172 views::GridLayout* CreateLayout( | |
| 173 views::View* parent, | |
| 174 int left_column_width, | |
| 175 int column_set_id, | |
| 176 bool single_detail_row) const; | |
| 177 | |
| 178 bool is_inline_install() const { | |
| 179 return prompt_->type() == ExtensionInstallPrompt::INLINE_INSTALL_PROMPT; | |
| 180 } | |
| 181 | |
| 182 bool is_bundle_install() const { | |
| 183 return prompt_->type() == ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT; | |
| 184 } | |
| 185 | |
| 186 bool is_external_install() const { | |
| 187 return prompt_->type() == ExtensionInstallPrompt::EXTERNAL_INSTALL_PROMPT; | |
| 188 } | |
| 189 | |
| 190 // Updates the histogram that holds installation accepted/aborted data. | |
| 191 void UpdateInstallResultHistogram(bool accepted) const; | |
| 192 | |
| 193 // Updates the histogram that holds data about whether "Show details" or | |
| 194 // "Show permissions" links were shown and/or clicked. | |
| 195 void UpdateLinkActionHistogram(int action_type) const; | |
| 196 | |
| 197 content::PageNavigator* navigator_; | |
| 198 ExtensionInstallPrompt::Delegate* delegate_; | |
| 199 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt_; | |
| 200 | |
| 201 // The scroll view containing all the details for the dialog (including all | |
| 202 // collapsible/expandable sections). | |
| 203 views::ScrollView* scroll_view_; | |
| 204 | |
| 205 // The container view for the scroll view. | |
| 206 CustomScrollableView* scrollable_; | |
| 207 | |
| 208 // The container for the simpler view with only the dialog header and the | |
| 209 // extension icon. Used for the experiment where the permissions are | |
| 210 // initially hidden when the dialog shows. | |
| 211 CustomScrollableView* scrollable_header_only_; | |
| 212 | |
| 213 // The preferred size of the dialog. | |
| 214 gfx::Size dialog_size_; | |
| 215 | |
| 216 // Experimental: "Show details" link to expand inline explanations and reveal | |
| 217 // permision dialog. | |
| 218 views::Link* show_details_link_; | |
| 219 | |
| 220 // Experimental: Label for showing information about the checkboxes. | |
| 221 views::Label* checkbox_info_label_; | |
| 222 | |
| 223 // Experimental: Contains pointers to inline explanation views. | |
| 224 typedef std::vector<ExpandableContainerView*> InlineExplanations; | |
| 225 InlineExplanations inline_explanations_; | |
| 226 | |
| 227 // Experimental: Number of unchecked checkboxes in the permission list. | |
| 228 // If this becomes zero, the accept button is enabled, otherwise disabled. | |
| 229 int unchecked_boxes_; | |
| 230 | |
| 231 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallDialogView); | |
| 232 }; | |
| 233 | |
| 234 // A simple view that prepends a view with a bullet with the help of a grid | |
| 235 // layout. | |
| 236 class BulletedView : public views::View { | |
| 237 public: | |
| 238 explicit BulletedView(views::View* view); | |
| 239 private: | |
| 240 DISALLOW_COPY_AND_ASSIGN(BulletedView); | |
| 241 }; | |
| 242 | |
| 243 BulletedView::BulletedView(views::View* view) { | 120 BulletedView::BulletedView(views::View* view) { |
| 244 views::GridLayout* layout = new views::GridLayout(this); | 121 views::GridLayout* layout = new views::GridLayout(this); |
| 245 SetLayoutManager(layout); | 122 SetLayoutManager(layout); |
| 246 views::ColumnSet* column_set = layout->AddColumnSet(0); | 123 views::ColumnSet* column_set = layout->AddColumnSet(0); |
| 124 column_set->AddColumn(views::GridLayout::CENTER, | |
| 125 views::GridLayout::LEADING, | |
| 126 0, | |
| 127 views::GridLayout::FIXED, | |
| 128 kBulletWidth, | |
| 129 0); | |
| 247 column_set->AddColumn(views::GridLayout::LEADING, | 130 column_set->AddColumn(views::GridLayout::LEADING, |
| 248 views::GridLayout::LEADING, | 131 views::GridLayout::LEADING, |
| 249 0, | 132 0, |
| 250 views::GridLayout::USE_PREF, | 133 views::GridLayout::USE_PREF, |
| 251 0, // no fixed width | 134 0, // no fixed width |
|
Finnur
2014/07/16 10:36:11
Nit: Not your problem, but can you captitalize the
Chris Thompson
2014/07/16 20:13:28
Done.
| |
| 252 0); | 135 0); |
| 253 column_set->AddColumn(views::GridLayout::LEADING, | |
| 254 views::GridLayout::LEADING, | |
| 255 0, | |
| 256 views::GridLayout::USE_PREF, | |
| 257 0, // no fixed width | |
| 258 0); | |
| 259 layout->StartRow(0, 0); | 136 layout->StartRow(0, 0); |
| 260 layout->AddView(new views::Label(PrepareForDisplay(base::string16(), true))); | 137 layout->AddView(new views::Label(PrepareForDisplay(base::string16(), true))); |
| 261 layout->AddView(view); | 138 layout->AddView(view); |
| 262 } | 139 } |
| 263 | 140 |
| 264 // A simple view that prepends a view with a checkbox with the help of a grid | |
| 265 // layout. Used for the permission experiment. | |
| 266 // TODO(meacer): Remove once the experiment is completed. | |
| 267 class CheckboxedView : public views::View { | |
| 268 public: | |
| 269 CheckboxedView(views::View* view, views::ButtonListener* listener); | |
| 270 private: | |
| 271 DISALLOW_COPY_AND_ASSIGN(CheckboxedView); | |
| 272 }; | |
| 273 | |
| 274 CheckboxedView::CheckboxedView(views::View* view, | 141 CheckboxedView::CheckboxedView(views::View* view, |
| 275 views::ButtonListener* listener) { | 142 views::ButtonListener* listener) { |
| 276 views::GridLayout* layout = new views::GridLayout(this); | 143 views::GridLayout* layout = new views::GridLayout(this); |
| 277 SetLayoutManager(layout); | 144 SetLayoutManager(layout); |
| 278 views::ColumnSet* column_set = layout->AddColumnSet(0); | 145 views::ColumnSet* column_set = layout->AddColumnSet(0); |
| 279 column_set->AddColumn(views::GridLayout::LEADING, | 146 column_set->AddColumn(views::GridLayout::LEADING, |
| 280 views::GridLayout::LEADING, | 147 views::GridLayout::LEADING, |
| 281 0, | 148 0, |
| 282 views::GridLayout::USE_PREF, | 149 views::GridLayout::USE_PREF, |
| 283 0, // no fixed width | 150 0, // no fixed width |
|
Finnur
2014/07/16 10:36:11
Same here.
Chris Thompson
2014/07/16 20:13:28
Done.
| |
| 284 0); | 151 0); |
| 285 column_set->AddColumn(views::GridLayout::LEADING, | 152 column_set->AddColumn(views::GridLayout::LEADING, |
| 286 views::GridLayout::LEADING, | 153 views::GridLayout::LEADING, |
| 287 0, | 154 0, |
| 288 views::GridLayout::USE_PREF, | 155 views::GridLayout::USE_PREF, |
| 289 0, // no fixed width | 156 0, // no fixed width |
| 290 0); | 157 0); |
| 291 layout->StartRow(0, 0); | 158 layout->StartRow(0, 0); |
| 292 views::Checkbox* checkbox = new views::Checkbox(base::string16()); | 159 views::Checkbox* checkbox = new views::Checkbox(base::string16()); |
| 293 checkbox->set_listener(listener); | 160 checkbox->set_listener(listener); |
| 294 // Alignment needs to be explicitly set again here, otherwise the views are | 161 // Alignment needs to be explicitly set again here, otherwise the views are |
| 295 // not vertically centered. | 162 // not vertically centered. |
| 296 layout->AddView(checkbox, 1, 1, | 163 layout->AddView(checkbox, 1, 1, |
| 297 views::GridLayout::LEADING, views::GridLayout::CENTER); | 164 views::GridLayout::LEADING, views::GridLayout::CENTER); |
| 298 layout->AddView(view, 1, 1, | 165 layout->AddView(view, 1, 1, |
| 299 views::GridLayout::LEADING, views::GridLayout::CENTER); | 166 views::GridLayout::LEADING, views::GridLayout::CENTER); |
| 300 } | 167 } |
| 301 | 168 |
| 302 // A view to display text with an expandable details section. | |
| 303 class ExpandableContainerView : public views::View, | |
| 304 public views::ButtonListener, | |
| 305 public views::LinkListener, | |
| 306 public gfx::AnimationDelegate { | |
| 307 public: | |
| 308 ExpandableContainerView(ExtensionInstallDialogView* owner, | |
| 309 const base::string16& description, | |
| 310 const PermissionDetails& details, | |
| 311 int horizontal_space, | |
| 312 bool parent_bulleted, | |
| 313 bool show_expand_link, | |
| 314 bool lighter_color_details); | |
| 315 virtual ~ExpandableContainerView(); | |
| 316 | |
| 317 // views::View: | |
| 318 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | |
| 319 | |
| 320 // views::ButtonListener: | |
| 321 virtual void ButtonPressed(views::Button* sender, | |
| 322 const ui::Event& event) OVERRIDE; | |
| 323 | |
| 324 // views::LinkListener: | |
| 325 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | |
| 326 | |
| 327 // gfx::AnimationDelegate: | |
| 328 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | |
| 329 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | |
| 330 | |
| 331 // Expand/Collapse the detail section for this ExpandableContainerView. | |
| 332 void ToggleDetailLevel(); | |
| 333 | |
| 334 // Expand the detail section without any animation. | |
| 335 // TODO(meacer): Remove once the experiment is completed. | |
| 336 void ExpandWithoutAnimation(); | |
| 337 | |
| 338 private: | |
| 339 // A view which displays all the details of an IssueAdviceInfoEntry. | |
| 340 class DetailsView : public views::View { | |
| 341 public: | |
| 342 explicit DetailsView(int horizontal_space, bool parent_bulleted, | |
| 343 bool lighter_color); | |
| 344 virtual ~DetailsView() {} | |
| 345 | |
| 346 // views::View: | |
| 347 virtual gfx::Size GetPreferredSize() const OVERRIDE; | |
| 348 | |
| 349 void AddDetail(const base::string16& detail); | |
| 350 | |
| 351 // Animates this to be a height proportional to |state|. | |
| 352 void AnimateToState(double state); | |
| 353 | |
| 354 private: | |
| 355 views::GridLayout* layout_; | |
| 356 double state_; | |
| 357 | |
| 358 // Whether the detail text should be shown with a lighter color. | |
| 359 bool lighter_color_; | |
| 360 | |
| 361 DISALLOW_COPY_AND_ASSIGN(DetailsView); | |
| 362 }; | |
| 363 | |
| 364 // The dialog that owns |this|. It's also an ancestor in the View hierarchy. | |
| 365 ExtensionInstallDialogView* owner_; | |
| 366 | |
| 367 // A view for showing |issue_advice.details|. | |
| 368 DetailsView* details_view_; | |
| 369 | |
| 370 // The 'more details' link shown under the heading (changes to 'hide details' | |
| 371 // when the details section is expanded). | |
| 372 views::Link* more_details_; | |
| 373 | |
| 374 gfx::SlideAnimation slide_animation_; | |
| 375 | |
| 376 // The up/down arrow next to the 'more detail' link (points up/down depending | |
| 377 // on whether the details section is expanded). | |
| 378 views::ImageButton* arrow_toggle_; | |
| 379 | |
| 380 // Whether the details section is expanded. | |
| 381 bool expanded_; | |
| 382 | |
| 383 DISALLOW_COPY_AND_ASSIGN(ExpandableContainerView); | |
| 384 }; | |
| 385 | |
| 386 void ShowExtensionInstallDialogImpl( | 169 void ShowExtensionInstallDialogImpl( |
| 387 const ExtensionInstallPrompt::ShowParams& show_params, | 170 const ExtensionInstallPrompt::ShowParams& show_params, |
| 388 ExtensionInstallPrompt::Delegate* delegate, | 171 ExtensionInstallPrompt::Delegate* delegate, |
| 389 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt) { | 172 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt) { |
| 390 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 173 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 391 CreateBrowserModalDialogViews( | 174 CreateBrowserModalDialogViews( |
| 392 new ExtensionInstallDialogView(show_params.navigator, delegate, prompt), | 175 new ExtensionInstallDialogView(show_params.navigator, delegate, prompt), |
| 393 show_params.parent_window)->Show(); | 176 show_params.parent_window)->Show(); |
| 394 } | 177 } |
| 395 | 178 |
| 396 } // namespace | |
|
Finnur
2014/07/16 10:36:12
Shouldn't this be moved to line 120 (of the file o
Chris Thompson
2014/07/16 20:13:28
Done.
| |
| 397 | |
| 398 CustomScrollableView::CustomScrollableView() {} | 179 CustomScrollableView::CustomScrollableView() {} |
| 399 CustomScrollableView::~CustomScrollableView() {} | 180 CustomScrollableView::~CustomScrollableView() {} |
| 400 | 181 |
| 401 void CustomScrollableView::Layout() { | 182 void CustomScrollableView::Layout() { |
| 402 SetBounds(x(), y(), width(), GetHeightForWidth(width())); | 183 SetBounds(x(), y(), width(), GetHeightForWidth(width())); |
| 403 views::View::Layout(); | 184 views::View::Layout(); |
| 404 } | 185 } |
| 405 | 186 |
| 406 ExtensionInstallDialogView::ExtensionInstallDialogView( | 187 ExtensionInstallDialogView::ExtensionInstallDialogView( |
| 407 content::PageNavigator* navigator, | 188 content::PageNavigator* navigator, |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 permission_label->SetEnabledColor(kTextHighlight); | 410 permission_label->SetEnabledColor(kTextHighlight); |
| 630 } else if (prompt->experiment()->ShouldHighlightBackground( | 411 } else if (prompt->experiment()->ShouldHighlightBackground( |
| 631 prompt->GetPermission(i))) { | 412 prompt->GetPermission(i))) { |
| 632 permission_label->SetLineHeight(18); | 413 permission_label->SetLineHeight(18); |
| 633 permission_label->set_background( | 414 permission_label->set_background( |
| 634 views::Background::CreateSolidBackground(kBackgroundHighlight)); | 415 views::Background::CreateSolidBackground(kBackgroundHighlight)); |
| 635 } | 416 } |
| 636 | 417 |
| 637 permission_label->SetMultiLine(true); | 418 permission_label->SetMultiLine(true); |
| 638 permission_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 419 permission_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 639 permission_label->SizeToFit(left_column_width); | |
| 640 | 420 |
| 641 if (prompt->experiment()->show_checkboxes()) { | 421 if (prompt->experiment()->show_checkboxes()) { |
| 422 permission_label->SizeToFit(left_column_width); | |
| 642 layout->AddView(new CheckboxedView(permission_label, this)); | 423 layout->AddView(new CheckboxedView(permission_label, this)); |
| 643 ++unchecked_boxes_; | 424 ++unchecked_boxes_; |
| 644 } else { | 425 } else { |
| 426 permission_label->SizeToFit(left_column_width - kBulletWidth); | |
| 645 layout->AddView(new BulletedView(permission_label)); | 427 layout->AddView(new BulletedView(permission_label)); |
| 646 } | 428 } |
| 429 | |
| 647 // If we have more details to provide, show them in collapsed form. | 430 // If we have more details to provide, show them in collapsed form. |
| 648 if (!prompt->GetPermissionsDetails(i).empty()) { | 431 if (!prompt->GetPermissionsDetails(i).empty()) { |
| 649 layout->StartRow(0, column_set_id); | 432 layout->StartRow(0, column_set_id); |
| 650 PermissionDetails details; | 433 PermissionDetails details; |
| 651 details.push_back( | 434 details.push_back( |
| 652 PrepareForDisplay(prompt->GetPermissionsDetails(i), false)); | 435 PrepareForDisplay(prompt->GetPermissionsDetails(i), false)); |
| 653 ExpandableContainerView* details_container = | 436 ExpandableContainerView* details_container = |
| 654 new ExpandableContainerView( | 437 new ExpandableContainerView( |
| 655 this, base::string16(), details, left_column_width, | 438 this, base::string16(), details, left_column_width, |
| 656 true, true, false); | 439 true, true, false); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1057 NUM_LINK_ACTIONS); | 840 NUM_LINK_ACTIONS); |
| 1058 } else { | 841 } else { |
| 1059 // The clickable link in the UI is "Show Details". | 842 // The clickable link in the UI is "Show Details". |
| 1060 UMA_HISTOGRAM_ENUMERATION( | 843 UMA_HISTOGRAM_ENUMERATION( |
| 1061 "Extensions.InstallPromptExperiment.ShowDetails", | 844 "Extensions.InstallPromptExperiment.ShowDetails", |
| 1062 action_type, | 845 action_type, |
| 1063 NUM_LINK_ACTIONS); | 846 NUM_LINK_ACTIONS); |
| 1064 } | 847 } |
| 1065 } | 848 } |
| 1066 | 849 |
| 1067 // static | |
| 1068 ExtensionInstallPrompt::ShowDialogCallback | |
| 1069 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { | |
| 1070 return base::Bind(&ShowExtensionInstallDialogImpl); | |
| 1071 } | |
| 1072 | |
| 1073 // ExpandableContainerView::DetailsView ---------------------------------------- | 850 // ExpandableContainerView::DetailsView ---------------------------------------- |
| 1074 | 851 |
| 1075 ExpandableContainerView::DetailsView::DetailsView(int horizontal_space, | 852 ExpandableContainerView::DetailsView::DetailsView(int horizontal_space, |
| 1076 bool parent_bulleted, | 853 bool parent_bulleted, |
| 1077 bool lighter_color) | 854 bool lighter_color) |
| 1078 : layout_(new views::GridLayout(this)), | 855 : layout_(new views::GridLayout(this)), |
| 1079 state_(0), | 856 state_(0), |
| 1080 lighter_color_(lighter_color) { | 857 lighter_color_(lighter_color) { |
| 1081 SetLayoutManager(layout_); | 858 SetLayoutManager(layout_); |
| 1082 views::ColumnSet* column_set = layout_->AddColumnSet(0); | 859 views::ColumnSet* column_set = layout_->AddColumnSet(0); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1276 if (slide_animation_.IsShowing()) | 1053 if (slide_animation_.IsShowing()) |
| 1277 slide_animation_.Hide(); | 1054 slide_animation_.Hide(); |
| 1278 else | 1055 else |
| 1279 slide_animation_.Show(); | 1056 slide_animation_.Show(); |
| 1280 } | 1057 } |
| 1281 | 1058 |
| 1282 void ExpandableContainerView::ExpandWithoutAnimation() { | 1059 void ExpandableContainerView::ExpandWithoutAnimation() { |
| 1283 expanded_ = true; | 1060 expanded_ = true; |
| 1284 details_view_->AnimateToState(1.0); | 1061 details_view_->AnimateToState(1.0); |
| 1285 } | 1062 } |
| 1063 | |
| 1064 // static | |
| 1065 ExtensionInstallPrompt::ShowDialogCallback | |
| 1066 ExtensionInstallPrompt::GetDefaultShowDialogCallback() { | |
| 1067 return base::Bind(&ShowExtensionInstallDialogImpl); | |
| 1068 } | |
| OLD | NEW |