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

Side by Side Diff: chrome/browser/ui/views/chrome_views_delegate.cc

Issue 2664073006: Implement ChromeViewsDelegate methods in terms of LayoutDelegate where possible. (Closed)
Patch Set: Now with correct type names Created 3 years, 10 months 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/chrome_views_delegate.h ('k') | ui/views/views_delegate.h » ('j') | 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 "chrome/browser/ui/views/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); 534 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true);
535 callback.Run(); 535 callback.Run();
536 } 536 }
537 #endif 537 #endif
538 538
539 scoped_refptr<base::TaskRunner> 539 scoped_refptr<base::TaskRunner>
540 ChromeViewsDelegate::GetBlockingPoolTaskRunner() { 540 ChromeViewsDelegate::GetBlockingPoolTaskRunner() {
541 return content::BrowserThread::GetBlockingPool(); 541 return content::BrowserThread::GetBlockingPool();
542 } 542 }
543 543
544 gfx::Insets ChromeViewsDelegate::GetDialogButtonInsets() { 544 gfx::Insets ChromeViewsDelegate::GetDialogButtonInsets() const {
545 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 545 return gfx::Insets(LayoutDelegate::Get()->GetMetric(
546 return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit); 546 LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN));
547 return ViewsDelegate::GetDialogButtonInsets();
548 } 547 }
549 548
550 int ChromeViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() { 549 int ChromeViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() const {
551 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 550 return LayoutDelegate::Get()->GetMetric(
552 return HarmonyLayoutDelegate::kHarmonyLayoutUnit / 2; 551 LayoutDelegate::Metric::RELATED_BUTTON_HORIZONTAL_SPACING);
sky 2017/02/01 16:29:01 I'm assuming all these calls result in the same va
Peter Kasting 2017/02/01 19:58:43 They should, if I did my cross-checking correctly.
553 return ViewsDelegate::GetDialogRelatedButtonHorizontalSpacing();
554 } 552 }
555 553
556 int ChromeViewsDelegate::GetDialogRelatedControlVerticalSpacing() { 554 int ChromeViewsDelegate::GetDialogRelatedControlVerticalSpacing() const {
557 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 555 return LayoutDelegate::Get()->GetMetric(
558 return HarmonyLayoutDelegate::kHarmonyLayoutUnit / 2; 556 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING);
559 return ViewsDelegate::GetDialogRelatedControlVerticalSpacing();
560 } 557 }
561 558
562 gfx::Insets ChromeViewsDelegate::GetDialogFrameViewInsets() { 559 gfx::Insets ChromeViewsDelegate::GetDialogFrameViewInsets() const {
563 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 560 const LayoutDelegate* layout_delegate = LayoutDelegate::Get();
564 // Titles are inset at the top and sides, but not at the bottom. 561 const int top = layout_delegate->GetMetric(
565 return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit, 562 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN);
566 HarmonyLayoutDelegate::kHarmonyLayoutUnit, 0, 563 const int side = layout_delegate->GetMetric(
567 HarmonyLayoutDelegate::kHarmonyLayoutUnit); 564 LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN);
568 return ViewsDelegate::GetDialogFrameViewInsets(); 565 // Titles are inset at the top and sides, but not at the bottom.
566 return gfx::Insets(top, side, 0, side);
569 } 567 }
570 568
571 gfx::Insets ChromeViewsDelegate::GetBubbleDialogMargins() { 569 gfx::Insets ChromeViewsDelegate::GetBubbleDialogMargins() const {
572 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 570 return gfx::Insets(LayoutDelegate::Get()->GetMetric(
573 return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit); 571 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN));
574 return ViewsDelegate::GetBubbleDialogMargins();
575 } 572 }
576 573
577 #if !defined(USE_ASH) 574 #if !defined(USE_ASH)
578 views::Widget::InitParams::WindowOpacity 575 views::Widget::InitParams::WindowOpacity
579 ChromeViewsDelegate::GetOpacityForInitParams( 576 ChromeViewsDelegate::GetOpacityForInitParams(
580 const views::Widget::InitParams& params) { 577 const views::Widget::InitParams& params) {
581 return views::Widget::InitParams::OPAQUE_WINDOW; 578 return views::Widget::InitParams::OPAQUE_WINDOW;
582 } 579 }
583 #endif 580 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/chrome_views_delegate.h ('k') | ui/views/views_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698