| 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> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 constexpr int kPermissionsLeftColumnWidth = 250; | 74 constexpr int kPermissionsLeftColumnWidth = 250; |
| 75 | 75 |
| 76 // Width of the left column of the dialog when the extension requests no | 76 // Width of the left column of the dialog when the extension requests no |
| 77 // permissions. | 77 // permissions. |
| 78 constexpr int kNoPermissionsLeftColumnWidth = 200; | 78 constexpr int kNoPermissionsLeftColumnWidth = 200; |
| 79 | 79 |
| 80 // Width of the left column for external install prompts. The text is long in | 80 // Width of the left column for external install prompts. The text is long in |
| 81 // this case, so make it wider than normal. | 81 // this case, so make it wider than normal. |
| 82 constexpr int kExternalInstallLeftColumnWidth = 350; | 82 constexpr int kExternalInstallLeftColumnWidth = 350; |
| 83 | 83 |
| 84 // Time delay before the install button is enabled after initial display. |
| 85 int g_install_delay_in_ms = 500; |
| 86 |
| 84 // Get the appropriate indentation for an item if its parent is using bullet | 87 // Get the appropriate indentation for an item if its parent is using bullet |
| 85 // points. If the parent is using bullets for its items, then a padding of one | 88 // points. If the parent is using bullets for its items, then a padding of one |
| 86 // unit will make the child item (which has no bullet) look like a sibling of | 89 // unit will make the child item (which has no bullet) look like a sibling of |
| 87 // its parent. Therefore increase the indentation by one more unit to show that | 90 // its parent. Therefore increase the indentation by one more unit to show that |
| 88 // it is in fact a child item (with no missing bullet) and not a sibling. | 91 // it is in fact a child item (with no missing bullet) and not a sibling. |
| 89 int GetLeftPaddingForBulletedItems(bool parent_bulleted) { | 92 int GetLeftPaddingForBulletedItems(bool parent_bulleted) { |
| 90 return ChromeLayoutProvider::Get()->GetDistanceMetric( | 93 return ChromeLayoutProvider::Get()->GetDistanceMetric( |
| 91 views::DISTANCE_RELATED_CONTROL_HORIZONTAL) * | 94 views::DISTANCE_RELATED_CONTROL_HORIZONTAL) * |
| 92 (parent_bulleted ? 2 : 1); | 95 (parent_bulleted ? 2 : 1); |
| 93 } | 96 } |
| 94 | 97 |
| 95 // Time delay before the install button is enabled after initial display. | |
| 96 int g_install_delay_in_ms = 500; | |
| 97 | |
| 98 void AddResourceIcon(const gfx::ImageSkia* skia_image, void* data) { | 98 void AddResourceIcon(const gfx::ImageSkia* skia_image, void* data) { |
| 99 views::View* parent = static_cast<views::View*>(data); | 99 views::View* parent = static_cast<views::View*>(data); |
| 100 views::ImageView* image_view = new views::ImageView(); | 100 views::ImageView* image_view = new views::ImageView(); |
| 101 image_view->SetImage(*skia_image); | 101 image_view->SetImage(*skia_image); |
| 102 parent->AddChildView(image_view); | 102 parent->AddChildView(image_view); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Creates a string for displaying |message| to the user. If it has to look | 105 // Creates a string for displaying |message| to the user. If it has to look |
| 106 // like a entry in a bullet point list, one is added. | 106 // like a entry in a bullet point list, one is added. |
| 107 base::string16 PrepareForDisplay(const base::string16& message, | 107 base::string16 PrepareForDisplay(const base::string16& message, |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 gfx::ImageSkia icon = gfx::CreateVectorIcon( | 790 gfx::ImageSkia icon = gfx::CreateVectorIcon( |
| 791 expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey); | 791 expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey); |
| 792 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); | 792 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); |
| 793 } | 793 } |
| 794 | 794 |
| 795 // static | 795 // static |
| 796 ExtensionInstallPrompt::ShowDialogCallback | 796 ExtensionInstallPrompt::ShowDialogCallback |
| 797 ExtensionInstallPrompt::GetViewsShowDialogCallback() { | 797 ExtensionInstallPrompt::GetViewsShowDialogCallback() { |
| 798 return base::Bind(&ShowExtensionInstallDialogImpl); | 798 return base::Bind(&ShowExtensionInstallDialogImpl); |
| 799 } | 799 } |
| OLD | NEW |