| 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" | 5 #include "chrome/browser/ui/views/extensions/extension_install_dialog_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback_helpers.h" | 13 #include "base/callback_helpers.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/i18n/rtl.h" | 16 #include "base/i18n/rtl.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 21 #include "chrome/app/vector_icons/vector_icons.h" | 21 #include "chrome/app/vector_icons/vector_icons.h" |
| 22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" | 23 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" |
| 24 #include "chrome/browser/extensions/extension_install_prompt_show_params.h" | 24 #include "chrome/browser/extensions/extension_install_prompt_show_params.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 28 #include "chrome/browser/ui/views/harmony/layout_delegate.h" |
| 28 #include "chrome/common/extensions/extension_constants.h" | 29 #include "chrome/common/extensions/extension_constants.h" |
| 29 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
| 30 #include "components/constrained_window/constrained_window_views.h" | 31 #include "components/constrained_window/constrained_window_views.h" |
| 31 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 32 #include "content/public/browser/page_navigator.h" | 33 #include "content/public/browser/page_navigator.h" |
| 33 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 34 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
| 35 #include "extensions/common/extension_urls.h" | 36 #include "extensions/common/extension_urls.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
| 37 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 layout->AddView(user_count); | 247 layout->AddView(user_count); |
| 247 } | 248 } |
| 248 | 249 |
| 249 if (prompt_->ShouldShowPermissions()) { | 250 if (prompt_->ShouldShowPermissions()) { |
| 250 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 251 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 251 layout->StartRow(0, column_set_id); | 252 layout->StartRow(0, column_set_id); |
| 252 layout->AddView(new views::Separator(), 3, 1, views::GridLayout::FILL, | 253 layout->AddView(new views::Separator(), 3, 1, views::GridLayout::FILL, |
| 253 views::GridLayout::FILL); | 254 views::GridLayout::FILL); |
| 254 } | 255 } |
| 255 | 256 |
| 256 const int content_width = | 257 const int content_width = left_column_width + |
| 257 left_column_width + views::kPanelHorizMargin + kIconSize; | 258 LayoutDelegate::Get()->GetMetric( |
| 259 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN) + |
| 260 kIconSize; |
| 258 | 261 |
| 259 // Create the scrollable view which will contain the permissions and retained | 262 // Create the scrollable view which will contain the permissions and retained |
| 260 // files/devices. It will span the full content width. | 263 // files/devices. It will span the full content width. |
| 261 CustomScrollableView* scrollable = new CustomScrollableView(); | 264 CustomScrollableView* scrollable = new CustomScrollableView(); |
| 262 views::GridLayout* scroll_layout = new views::GridLayout(scrollable); | 265 views::GridLayout* scroll_layout = new views::GridLayout(scrollable); |
| 263 scrollable->SetLayoutManager(scroll_layout); | 266 scrollable->SetLayoutManager(scroll_layout); |
| 264 | 267 |
| 265 views::ColumnSet* scrollable_column_set = | 268 views::ColumnSet* scrollable_column_set = |
| 266 scroll_layout->AddColumnSet(column_set_id); | 269 scroll_layout->AddColumnSet(column_set_id); |
| 267 | 270 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 0); | 422 0); |
| 420 container_->SetLayoutManager(layout); | 423 container_->SetLayoutManager(layout); |
| 421 AddChildView(container_); | 424 AddChildView(container_); |
| 422 | 425 |
| 423 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); | 426 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); |
| 424 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, | 427 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, |
| 425 0, // no resizing | 428 0, // no resizing |
| 426 views::GridLayout::USE_PREF, | 429 views::GridLayout::USE_PREF, |
| 427 0, // no fixed width | 430 0, // no fixed width |
| 428 left_column_width); | 431 left_column_width); |
| 429 column_set->AddPaddingColumn(0, views::kPanelHorizMargin); | 432 column_set->AddPaddingColumn( |
| 433 0, LayoutDelegate::Get()->GetMetric( |
| 434 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN)); |
| 430 column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING, | 435 column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING, |
| 431 0, // no resizing | 436 0, // no resizing |
| 432 views::GridLayout::USE_PREF, | 437 views::GridLayout::USE_PREF, |
| 433 0, // no fixed width | 438 0, // no fixed width |
| 434 kIconSize); | 439 kIconSize); |
| 435 column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); | 440 column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); |
| 436 | 441 |
| 437 layout->StartRow(0, column_set_id); | 442 layout->StartRow(0, column_set_id); |
| 438 views::Label* title = | 443 views::Label* title = |
| 439 new views::Label(prompt_->GetDialogTitle(), | 444 new views::Label(prompt_->GetDialogTitle(), |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 gfx::ImageSkia icon = gfx::CreateVectorIcon( | 738 gfx::ImageSkia icon = gfx::CreateVectorIcon( |
| 734 expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey); | 739 expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey); |
| 735 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); | 740 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); |
| 736 } | 741 } |
| 737 | 742 |
| 738 // static | 743 // static |
| 739 ExtensionInstallPrompt::ShowDialogCallback | 744 ExtensionInstallPrompt::ShowDialogCallback |
| 740 ExtensionInstallPrompt::GetViewsShowDialogCallback() { | 745 ExtensionInstallPrompt::GetViewsShowDialogCallback() { |
| 741 return base::Bind(&ShowExtensionInstallDialogImpl); | 746 return base::Bind(&ShowExtensionInstallDialogImpl); |
| 742 } | 747 } |
| OLD | NEW |