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