| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/options/advanced_contents_view.h" | 5 #include "chrome/browser/ui/views/options/advanced_contents_view.h" | 
| 6 | 6 | 
| 7 #include <windows.h> | 7 #include <windows.h> | 
| 8 | 8 | 
| 9 #include <cryptuiapi.h> | 9 #include <cryptuiapi.h> | 
| 10 #pragma comment(lib, "cryptui.lib") | 10 #pragma comment(lib, "cryptui.lib") | 
| (...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1466           IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON))); | 1466           IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON))); | 
| 1467       enable_disable_button_->InvalidateLayout(); | 1467       enable_disable_button_->InvalidateLayout(); | 
| 1468       enable_disable_button_->SetEnabled(cloud_print_proxy_allowed); | 1468       enable_disable_button_->SetEnabled(cloud_print_proxy_allowed); | 
| 1469       manage_printer_button_->SetVisible(false); | 1469       manage_printer_button_->SetVisible(false); | 
| 1470     } | 1470     } | 
| 1471 | 1471 | 
| 1472     // Find the parent ScrollView, and ask it to re-layout since it's | 1472     // Find the parent ScrollView, and ask it to re-layout since it's | 
| 1473     // possible that the section_description_label_ has changed | 1473     // possible that the section_description_label_ has changed | 
| 1474     // heights.  And scroll us back to being visible in that case, to | 1474     // heights.  And scroll us back to being visible in that case, to | 
| 1475     // be nice to the user. | 1475     // be nice to the user. | 
| 1476     views::View* view = section_description_label_->GetParent(); | 1476     views::View* view = section_description_label_->parent(); | 
| 1477     while (view && view->GetClassName() != views::ScrollView::kViewClassName) | 1477     while (view && view->GetClassName() != views::ScrollView::kViewClassName) | 
| 1478       view = view->GetParent(); | 1478       view = view->parent(); | 
| 1479     if (view) { | 1479     if (view) { | 
| 1480       gfx::Rect visible_bounds = GetVisibleBounds(); | 1480       gfx::Rect visible_bounds = GetVisibleBounds(); | 
| 1481       bool was_all_visible = (visible_bounds.size() == size()); | 1481       bool was_all_visible = (visible_bounds.size() == size()); | 
| 1482       // Our bounds can change across this call, so we have to use the | 1482       // Our bounds can change across this call, so we have to use the | 
| 1483       // new bounds if we want to stay completely visible. | 1483       // new bounds if we want to stay completely visible. | 
| 1484       view->Layout(); | 1484       view->Layout(); | 
| 1485       ScrollRectToVisible(was_all_visible ? bounds() : visible_bounds); | 1485       ScrollRectToVisible(was_all_visible ? bounds() : visible_bounds); | 
| 1486     } else { | 1486     } else { | 
| 1487       Layout(); | 1487       Layout(); | 
| 1488     } | 1488     } | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1541     views::ScrollView* scroll_view, | 1541     views::ScrollView* scroll_view, | 
| 1542     bool is_horizontal, | 1542     bool is_horizontal, | 
| 1543     bool is_positive) { | 1543     bool is_positive) { | 
| 1544 | 1544 | 
| 1545   if (!is_horizontal) | 1545   if (!is_horizontal) | 
| 1546     return line_height_; | 1546     return line_height_; | 
| 1547   return View::GetPageScrollIncrement(scroll_view, is_horizontal, is_positive); | 1547   return View::GetPageScrollIncrement(scroll_view, is_horizontal, is_positive); | 
| 1548 } | 1548 } | 
| 1549 | 1549 | 
| 1550 void AdvancedContentsView::Layout() { | 1550 void AdvancedContentsView::Layout() { | 
| 1551   views::View* parent = GetParent(); | 1551   if (parent() && parent()->width()) { | 
| 1552   if (parent && parent->width()) { | 1552     const int width = parent()->width(); | 
| 1553     const int width = parent->width(); |  | 
| 1554     const int height = GetHeightForWidth(width); | 1553     const int height = GetHeightForWidth(width); | 
| 1555     SetBounds(0, 0, width, height); | 1554     SetBounds(0, 0, width, height); | 
| 1556   } else { | 1555   } else { | 
| 1557     gfx::Size prefsize = GetPreferredSize(); | 1556     gfx::Size prefsize = GetPreferredSize(); | 
| 1558     SetBounds(0, 0, prefsize.width(), prefsize.height()); | 1557     SetBounds(0, 0, prefsize.width(), prefsize.height()); | 
| 1559   } | 1558   } | 
| 1560   View::Layout(); | 1559   View::Layout(); | 
| 1561 } | 1560 } | 
| 1562 | 1561 | 
| 1563 void AdvancedContentsView::OnBoundsChanged() { | 1562 void AdvancedContentsView::OnBoundsChanged() { | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1636 // AdvancedScrollViewContainer, views::View overrides: | 1635 // AdvancedScrollViewContainer, views::View overrides: | 
| 1637 | 1636 | 
| 1638 void AdvancedScrollViewContainer::Layout() { | 1637 void AdvancedScrollViewContainer::Layout() { | 
| 1639   gfx::Rect lb = GetLocalBounds(); | 1638   gfx::Rect lb = GetLocalBounds(); | 
| 1640 | 1639 | 
| 1641   gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( | 1640   gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( | 
| 1642       gfx::NativeTheme::LIST); | 1641       gfx::NativeTheme::LIST); | 
| 1643   lb.Inset(border.width(), border.height()); | 1642   lb.Inset(border.width(), border.height()); | 
| 1644   scroll_view_->SetBoundsRect(lb); | 1643   scroll_view_->SetBoundsRect(lb); | 
| 1645 } | 1644 } | 
| OLD | NEW | 
|---|