| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/media_gallery_checkbox_view.h" | 5 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/media_galleries/media_galleries_preferences.h" | 7 #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
| 8 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 8 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 MediaGalleryCheckboxView::MediaGalleryCheckboxView( | 25 MediaGalleryCheckboxView::MediaGalleryCheckboxView( |
| 26 const MediaGalleryPrefInfo& pref_info, | 26 const MediaGalleryPrefInfo& pref_info, |
| 27 int trailing_vertical_space, | 27 int trailing_vertical_space, |
| 28 views::ButtonListener* button_listener, | 28 views::ButtonListener* button_listener, |
| 29 views::ContextMenuController* menu_controller) { | 29 views::ContextMenuController* menu_controller) { |
| 30 DCHECK(button_listener != NULL); | 30 DCHECK(button_listener != NULL); |
| 31 SetLayoutManager( | 31 SetLayoutManager( |
| 32 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 32 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
| 33 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); | 33 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
| 34 const int border_horiz_margin = | 34 const int border_horiz_margin = provider->GetDistanceMetric( |
| 35 provider->GetDistanceMetric(DISTANCE_PANEL_CONTENT_MARGIN); | 35 views::DISTANCE_BUBBLE_CONTENTS_HORIZONTAL_MARGIN); |
| 36 SetBorder(views::CreateEmptyBorder( | 36 SetBorder(views::CreateEmptyBorder( |
| 37 0, border_horiz_margin, trailing_vertical_space, border_horiz_margin)); | 37 0, border_horiz_margin, trailing_vertical_space, border_horiz_margin)); |
| 38 if (menu_controller) | 38 if (menu_controller) |
| 39 set_context_menu_controller(menu_controller); | 39 set_context_menu_controller(menu_controller); |
| 40 | 40 |
| 41 checkbox_ = new views::Checkbox(pref_info.GetGalleryDisplayName()); | 41 checkbox_ = new views::Checkbox(pref_info.GetGalleryDisplayName()); |
| 42 checkbox_->set_listener(button_listener); | 42 checkbox_->set_listener(button_listener); |
| 43 if (menu_controller) | 43 if (menu_controller) |
| 44 checkbox_->set_context_menu_controller(menu_controller); | 44 checkbox_->set_context_menu_controller(menu_controller); |
| 45 checkbox_->SetElideBehavior(gfx::ELIDE_MIDDLE); | 45 checkbox_->SetElideBehavior(gfx::ELIDE_MIDDLE); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 std::max(area.width() / 2, area.width() - checkbox_width); | 84 std::max(area.width() / 2, area.width() - checkbox_width); |
| 85 } | 85 } |
| 86 checkbox_width = area.width() - secondary_text_width; | 86 checkbox_width = area.width() - secondary_text_width; |
| 87 | 87 |
| 88 checkbox_->SetBounds(area.x(), area.y(), checkbox_width, area.height()); | 88 checkbox_->SetBounds(area.x(), area.y(), checkbox_width, area.height()); |
| 89 if (secondary_text_->visible()) { | 89 if (secondary_text_->visible()) { |
| 90 secondary_text_->SetBounds(checkbox_->x() + checkbox_width, area.y(), | 90 secondary_text_->SetBounds(checkbox_->x() + checkbox_width, area.y(), |
| 91 secondary_text_width, area.height()); | 91 secondary_text_width, area.height()); |
| 92 } | 92 } |
| 93 } | 93 } |
| OLD | NEW |