| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/file_system/request_file_system_dialog_v
iew.h" | 5 #include "chrome/browser/extensions/api/file_system/request_file_system_dialog_v
iew.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cstdlib> | 9 #include <cstdlib> |
| 10 | 10 |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/constrained_window/constrained_window_views.h" | 15 #include "components/constrained_window/constrained_window_views.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/gfx/font.h" | 18 #include "ui/gfx/font.h" |
| 18 #include "ui/gfx/range/range.h" | 19 #include "ui/gfx/range/range.h" |
| 19 #include "ui/views/controls/styled_label.h" | 20 #include "ui/views/controls/styled_label.h" |
| 20 #include "ui/views/layout/box_layout.h" | 21 #include "ui/views/layout/box_layout.h" |
| 21 #include "ui/views/layout/layout_constants.h" | |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // Maximum width of the dialog in pixels. | 25 // Maximum width of the dialog in pixels. |
| 26 const int kDialogMaxWidth = 320; | 26 const int kDialogMaxWidth = 320; |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 // static | 30 // static |
| 31 void RequestFileSystemDialogView::ShowDialog( | 31 void RequestFileSystemDialogView::ShowDialog( |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 DCHECK_EQ(2u, placeholder_offsets.size()); | 126 DCHECK_EQ(2u, placeholder_offsets.size()); |
| 127 label->AddStyleRange(gfx::Range(placeholder_offsets[0], | 127 label->AddStyleRange(gfx::Range(placeholder_offsets[0], |
| 128 placeholder_offsets[0] + app_name.length()), | 128 placeholder_offsets[0] + app_name.length()), |
| 129 bold_style); | 129 bold_style); |
| 130 label->AddStyleRange( | 130 label->AddStyleRange( |
| 131 gfx::Range(placeholder_offsets[1], | 131 gfx::Range(placeholder_offsets[1], |
| 132 placeholder_offsets[1] + volume_name.length()), | 132 placeholder_offsets[1] + volume_name.length()), |
| 133 bold_style); | 133 bold_style); |
| 134 | 134 |
| 135 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
| 136 const int button_margin = |
| 137 provider->GetDistanceMetric(DISTANCE_DIALOG_BUTTON_MARGIN); |
| 138 const int vertical_margin = |
| 139 provider->GetDistanceMetric(DISTANCE_PANEL_CONTENT_MARGIN); |
| 140 |
| 135 views::BoxLayout* const layout = new views::BoxLayout( | 141 views::BoxLayout* const layout = new views::BoxLayout( |
| 136 views::BoxLayout::kHorizontal, views::kButtonHEdgeMarginNew, | 142 views::BoxLayout::kHorizontal, button_margin, vertical_margin, 0); |
| 137 views::kPanelVertMargin, 0); | |
| 138 contents_view_->SetLayoutManager(layout); | 143 contents_view_->SetLayoutManager(layout); |
| 139 | 144 |
| 140 label->SizeToFit(kDialogMaxWidth - 2 * views::kButtonHEdgeMarginNew); | 145 label->SizeToFit(kDialogMaxWidth - 2 * button_margin); |
| 141 contents_view_->AddChildView(label); | 146 contents_view_->AddChildView(label); |
| 142 } | 147 } |
| OLD | NEW |