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

Side by Side Diff: ui/views/window/dialog_client_view.cc

Issue 2526863004: harmony: fix collected cookies dialog spacing and button insets (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « chrome/browser/ui/views/collected_cookies_views.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/window/dialog_client_view.h" 5 #include "ui/views/window/dialog_client_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/base/material_design/material_design_controller.h" 10 #include "ui/base/material_design/material_design_controller.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // The call to LayoutButton() will already have accounted for some of 213 // The call to LayoutButton() will already have accounted for some of
214 // the padding. 214 // the padding.
215 custom_padding -= kRelatedButtonHSpacing; 215 custom_padding -= kRelatedButtonHSpacing;
216 row_bounds.set_width(row_bounds.width() - custom_padding); 216 row_bounds.set_width(row_bounds.width() - custom_padding);
217 } 217 }
218 row_bounds.set_width(std::min(row_bounds.width(), 218 row_bounds.set_width(std::min(row_bounds.width(),
219 extra_view_->GetPreferredSize().width())); 219 extra_view_->GetPreferredSize().width()));
220 extra_view_->SetBoundsRect(row_bounds); 220 extra_view_->SetBoundsRect(row_bounds);
221 } 221 }
222 222
223 if (height > 0) 223 if (height > 0) {
224 bounds.Inset(0, 0, 0, height + kRelatedControlVerticalSpacing); 224 // If the ViewsDelegate supplies a non-zero top inset, use that;
sky 2016/11/23 20:28:37 Might the ViewsDelegate supply 0?
Elly Fong-Jones 2016/11/28 17:02:49 Yes - in non-Harmony mode, ChromeViewsDelegate::Ge
sky 2016/11/28 17:44:35 If it returns 0 then you fallback to using the kRe
sky 2016/11/28 19:05:05 I don't think I'm being clear. Let me try again. I
225 // otherwise, use kRelatedControlVerticalSpacing.
226 int spacing =
227 ViewsDelegate::GetInstance()
228 ? ViewsDelegate::GetInstance()->GetDialogButtonInsets().top()
229 : 0;
230 if (!spacing)
231 spacing = kRelatedControlVerticalSpacing;
232 bounds.Inset(0, 0, 0, height + spacing);
233 }
225 } 234 }
226 235
227 // Layout the contents view to the top and side edges of the contents bounds. 236 // Layout the contents view to the top and side edges of the contents bounds.
228 // NOTE: The local insets do not apply to the contents view sides or top. 237 // NOTE: The local insets do not apply to the contents view sides or top.
229 const gfx::Rect contents_bounds = GetContentsBounds(); 238 const gfx::Rect contents_bounds = GetContentsBounds();
230 contents_view()->SetBounds(contents_bounds.x(), contents_bounds.y(), 239 contents_view()->SetBounds(contents_bounds.x(), contents_bounds.y(),
231 contents_bounds.width(), bounds.bottom() - contents_bounds.y()); 240 contents_bounds.width(), bounds.bottom() - contents_bounds.y());
232 } 241 }
233 242
234 bool DialogClientView::AcceleratorPressed(const ui::Accelerator& accelerator) { 243 bool DialogClientView::AcceleratorPressed(const ui::Accelerator& accelerator) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 std::remove(child_views.begin(), child_views.end(), nullptr), 383 std::remove(child_views.begin(), child_views.end(), nullptr),
375 child_views.end()); 384 child_views.end());
376 385
377 // Setup focus by reordering views. It is not safe to use SetNextFocusableView 386 // Setup focus by reordering views. It is not safe to use SetNextFocusableView
378 // since child views may be added externally to this view. 387 // since child views may be added externally to this view.
379 for (size_t i = 0; i < child_views.size(); i++) 388 for (size_t i = 0; i < child_views.size(); i++)
380 ReorderChildView(child_views[i], i); 389 ReorderChildView(child_views[i], i);
381 } 390 }
382 391
383 } // namespace views 392 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/collected_cookies_views.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698