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

Side by Side Diff: ash/common/system/chromeos/cast/tray_cast.cc

Issue 2671063002: Remove FixedSizedScrollView. (Closed)
Patch Set: rebase 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ash/common/system/chromeos/cast/tray_cast.h" 5 #include "ash/common/system/chromeos/cast/tray_cast.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/common/cast_config_controller.h" 12 #include "ash/common/cast_config_controller.h"
13 #include "ash/common/material_design/material_design_controller.h" 13 #include "ash/common/material_design/material_design_controller.h"
14 #include "ash/common/session/session_state_delegate.h" 14 #include "ash/common/session/session_state_delegate.h"
15 #include "ash/common/shelf/wm_shelf_util.h" 15 #include "ash/common/shelf/wm_shelf_util.h"
16 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h" 16 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h"
17 #include "ash/common/system/tray/fixed_sized_image_view.h" 17 #include "ash/common/system/tray/fixed_sized_image_view.h"
18 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
19 #include "ash/common/system/tray/hover_highlight_view.h" 18 #include "ash/common/system/tray/hover_highlight_view.h"
20 #include "ash/common/system/tray/system_tray.h" 19 #include "ash/common/system/tray/system_tray.h"
21 #include "ash/common/system/tray/system_tray_delegate.h" 20 #include "ash/common/system/tray/system_tray_delegate.h"
22 #include "ash/common/system/tray/throbber_view.h" 21 #include "ash/common/system/tray/throbber_view.h"
23 #include "ash/common/system/tray/tray_constants.h" 22 #include "ash/common/system/tray/tray_constants.h"
24 #include "ash/common/system/tray/tray_details_view.h" 23 #include "ash/common/system/tray/tray_details_view.h"
25 #include "ash/common/system/tray/tray_item_more.h" 24 #include "ash/common/system/tray/tray_item_more.h"
26 #include "ash/common/system/tray/tray_item_view.h" 25 #include "ash/common/system/tray/tray_item_view.h"
27 #include "ash/common/system/tray/tray_utils.h" 26 #include "ash/common/system/tray/tray_utils.h"
28 #include "ash/common/wm_shell.h" 27 #include "ash/common/wm_shell.h"
29 #include "ash/public/cpp/shelf_types.h" 28 #include "ash/public/cpp/shelf_types.h"
30 #include "ash/public/interfaces/cast_config.mojom.h" 29 #include "ash/public/interfaces/cast_config.mojom.h"
31 #include "ash/resources/vector_icons/vector_icons.h" 30 #include "ash/resources/vector_icons/vector_icons.h"
32 #include "base/bind.h" 31 #include "base/bind.h"
33 #include "base/strings/utf_string_conversions.h" 32 #include "base/strings/utf_string_conversions.h"
34 #include "grit/ash_resources.h" 33 #include "grit/ash_resources.h"
35 #include "grit/ash_strings.h" 34 #include "grit/ash_strings.h"
36 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
37 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
38 #include "ui/gfx/image/image.h" 37 #include "ui/gfx/image/image.h"
39 #include "ui/gfx/paint_vector_icon.h" 38 #include "ui/gfx/paint_vector_icon.h"
40 #include "ui/gfx/text_elider.h" 39 #include "ui/gfx/text_elider.h"
41 #include "ui/views/background.h" 40 #include "ui/views/background.h"
42 #include "ui/views/border.h" 41 #include "ui/views/border.h"
43 #include "ui/views/controls/button/button.h" 42 #include "ui/views/controls/button/button.h"
44 #include "ui/views/controls/image_view.h" 43 #include "ui/views/controls/image_view.h"
45 #include "ui/views/controls/label.h" 44 #include "ui/views/controls/label.h"
45 #include "ui/views/controls/scroll_view.h"
46 #include "ui/views/layout/box_layout.h" 46 #include "ui/views/layout/box_layout.h"
47 #include "ui/views/layout/fill_layout.h" 47 #include "ui/views/layout/fill_layout.h"
48 48
49 namespace ash { 49 namespace ash {
50 50
51 namespace { 51 namespace {
52 52
53 const size_t kMaximumStatusStringLength = 100; 53 const size_t kMaximumStatusStringLength = 100;
54 54
55 // Helper method to elide the given string to the maximum length. If a string is 55 // Helper method to elide the given string to the maximum length. If a string is
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 scroll_content()->RemoveAllChildViews(true); 413 scroll_content()->RemoveAllChildViews(true);
414 414
415 // Add a view for each receiver. 415 // Add a view for each receiver.
416 for (auto& it : sinks_and_routes_) { 416 for (auto& it : sinks_and_routes_) {
417 const ash::mojom::SinkAndRoutePtr& sink_route = it.second; 417 const ash::mojom::SinkAndRoutePtr& sink_route = it.second;
418 views::View* container = AddToReceiverList(sink_route); 418 views::View* container = AddToReceiverList(sink_route);
419 view_to_sink_map_[container] = sink_route->sink.Clone(); 419 view_to_sink_map_[container] = sink_route->sink.Clone();
420 } 420 }
421 421
422 scroll_content()->SizeToPreferredSize(); 422 scroll_content()->SizeToPreferredSize();
423 static_cast<views::View*>(scroller())->Layout(); 423 scroller()->Layout();
424 } 424 }
425 425
426 views::View* CastDetailedView::AddToReceiverList( 426 views::View* CastDetailedView::AddToReceiverList(
427 const ash::mojom::SinkAndRoutePtr& sink_route) { 427 const ash::mojom::SinkAndRoutePtr& sink_route) {
428 const gfx::ImageSkia image = 428 const gfx::ImageSkia image =
429 MaterialDesignController::IsSystemTrayMenuMaterial() 429 MaterialDesignController::IsSystemTrayMenuMaterial()
430 ? gfx::CreateVectorIcon(kSystemMenuCastDeviceIcon, kMenuIconColor) 430 ? gfx::CreateVectorIcon(kSystemMenuCastDeviceIcon, kMenuIconColor)
431 : *ui::ResourceBundle::GetSharedInstance() 431 : *ui::ResourceBundle::GetSharedInstance()
432 .GetImageNamed(IDR_AURA_UBER_TRAY_CAST_DEVICE_ICON) 432 .GetImageNamed(IDR_AURA_UBER_TRAY_CAST_DEVICE_ICON)
433 .ToImageSkia(); 433 .ToImageSkia();
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 563
564 return false; 564 return false;
565 } 565 }
566 566
567 void TrayCast::OnCastingSessionStartedOrStopped(bool started) { 567 void TrayCast::OnCastingSessionStartedOrStopped(bool started) {
568 is_mirror_casting_ = started; 568 is_mirror_casting_ = started;
569 UpdatePrimaryView(); 569 UpdatePrimaryView();
570 } 570 }
571 571
572 } // namespace ash 572 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/bluetooth/tray_bluetooth.cc ('k') | ash/common/system/chromeos/ime_menu/ime_menu_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698