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/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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); | 531 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); |
532 callback.Run(); | 532 callback.Run(); |
533 } | 533 } |
534 #endif | 534 #endif |
535 | 535 |
536 scoped_refptr<base::TaskRunner> | 536 scoped_refptr<base::TaskRunner> |
537 ChromeViewsDelegate::GetBlockingPoolTaskRunner() { | 537 ChromeViewsDelegate::GetBlockingPoolTaskRunner() { |
538 return content::BrowserThread::GetBlockingPool(); | 538 return content::BrowserThread::GetBlockingPool(); |
539 } | 539 } |
540 | 540 |
541 gfx::Insets ChromeViewsDelegate::GetDialogButtonInsets() const { | 541 gfx::Insets ChromeViewsDelegate::GetInsetsMetric(InsetsMetric metric) const { |
542 const LayoutDelegate* layout_delegate = LayoutDelegate::Get(); | 542 const LayoutDelegate* layout_delegate = LayoutDelegate::Get(); |
543 const int top = layout_delegate->GetMetric( | 543 switch (metric) { |
544 LayoutDelegate::Metric::DIALOG_BUTTON_TOP_SPACING); | 544 case InsetsMetric::DIALOG_BUTTON: { |
545 const int margin = layout_delegate->GetMetric( | 545 const int top = layout_delegate->GetMetric( |
546 LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN); | 546 LayoutDelegate::Metric::DIALOG_BUTTON_TOP_SPACING); |
547 return gfx::Insets(top, margin, margin, margin); | 547 const int margin = layout_delegate->GetMetric( |
| 548 LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN); |
| 549 return gfx::Insets(top, margin, margin, margin); |
| 550 } |
| 551 case InsetsMetric::DIALOG_FRAME_VIEW: { |
| 552 const int top = layout_delegate->GetMetric( |
| 553 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN); |
| 554 const int side = layout_delegate->GetMetric( |
| 555 LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN); |
| 556 // Titles are inset at the top and sides, but not at the bottom. |
| 557 return gfx::Insets(top, side, 0, side); |
| 558 } |
| 559 case InsetsMetric::BUBBLE_DIALOG: |
| 560 return gfx::Insets(layout_delegate->GetMetric( |
| 561 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN)); |
| 562 } |
| 563 NOTREACHED(); |
| 564 return gfx::Insets(); |
548 } | 565 } |
549 | 566 |
550 int ChromeViewsDelegate::GetDialogCloseButtonMargin() const { | 567 int ChromeViewsDelegate::GetSpacingMetric(SpacingMetric metric) const { |
551 return LayoutDelegate::Get()->GetMetric( | 568 switch (metric) { |
552 LayoutDelegate::Metric::DIALOG_CLOSE_BUTTON_MARGIN); | 569 case SpacingMetric::CLOSE_BUTTON_MARGIN: |
553 } | 570 return LayoutDelegate::Get()->GetMetric( |
554 | 571 LayoutDelegate::Metric::DIALOG_CLOSE_BUTTON_MARGIN); |
555 int ChromeViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() const { | 572 case SpacingMetric::RELATED_HORIZONTAL_BUTTON: |
556 return LayoutDelegate::Get()->GetMetric( | 573 return LayoutDelegate::Get()->GetMetric( |
557 LayoutDelegate::Metric::RELATED_BUTTON_HORIZONTAL_SPACING); | 574 LayoutDelegate::Metric::RELATED_BUTTON_HORIZONTAL_SPACING); |
558 } | 575 case SpacingMetric::RELATED_VERTICAL_CONTROL: |
559 | 576 return LayoutDelegate::Get()->GetMetric( |
560 int ChromeViewsDelegate::GetDialogRelatedControlVerticalSpacing() const { | 577 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING); |
561 return LayoutDelegate::Get()->GetMetric( | 578 case SpacingMetric::ICON_TO_TEXT: |
562 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING); | 579 return LayoutDelegate::Get()->GetMetric( |
563 } | 580 LayoutDelegate::Metric::ICON_TEXT_SPACING); |
564 | 581 } |
565 gfx::Insets ChromeViewsDelegate::GetDialogFrameViewInsets() const { | 582 NOTREACHED(); |
566 const LayoutDelegate* layout_delegate = LayoutDelegate::Get(); | 583 return 0; |
567 const int top = layout_delegate->GetMetric( | |
568 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN); | |
569 const int side = layout_delegate->GetMetric( | |
570 LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN); | |
571 // Titles are inset at the top and sides, but not at the bottom. | |
572 return gfx::Insets(top, side, 0, side); | |
573 } | |
574 | |
575 gfx::Insets ChromeViewsDelegate::GetBubbleDialogMargins() const { | |
576 return gfx::Insets(LayoutDelegate::Get()->GetMetric( | |
577 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN)); | |
578 } | 584 } |
579 | 585 |
580 #if !defined(USE_ASH) | 586 #if !defined(USE_ASH) |
581 views::Widget::InitParams::WindowOpacity | 587 views::Widget::InitParams::WindowOpacity |
582 ChromeViewsDelegate::GetOpacityForInitParams( | 588 ChromeViewsDelegate::GetOpacityForInitParams( |
583 const views::Widget::InitParams& params) { | 589 const views::Widget::InitParams& params) { |
584 return views::Widget::InitParams::OPAQUE_WINDOW; | 590 return views::Widget::InitParams::OPAQUE_WINDOW; |
585 } | 591 } |
586 #endif | 592 #endif |
OLD | NEW |