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

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

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback Created 3 years, 8 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/system/cast/tray_cast.h" 5 #include "ash/system/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/public/interfaces/cast_config.mojom.h" 12 #include "ash/public/interfaces/cast_config.mojom.h"
13 #include "ash/resources/vector_icons/vector_icons.h" 13 #include "ash/resources/vector_icons/vector_icons.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/shell_port.h"
15 #include "ash/strings/grit/ash_strings.h" 16 #include "ash/strings/grit/ash_strings.h"
16 #include "ash/system/screen_security/screen_tray_item.h" 17 #include "ash/system/screen_security/screen_tray_item.h"
17 #include "ash/system/tray/hover_highlight_view.h" 18 #include "ash/system/tray/hover_highlight_view.h"
18 #include "ash/system/tray/system_tray.h" 19 #include "ash/system/tray/system_tray.h"
19 #include "ash/system/tray/tray_constants.h" 20 #include "ash/system/tray/tray_constants.h"
20 #include "ash/system/tray/tray_details_view.h" 21 #include "ash/system/tray/tray_details_view.h"
21 #include "ash/system/tray/tray_item_more.h" 22 #include "ash/system/tray/tray_item_more.h"
22 #include "ash/system/tray/tray_item_view.h" 23 #include "ash/system/tray/tray_item_view.h"
23 #include "ash/wm_shell.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/gfx/image/image.h" 27 #include "ui/gfx/image/image.h"
28 #include "ui/gfx/paint_vector_icon.h" 28 #include "ui/gfx/paint_vector_icon.h"
29 #include "ui/gfx/text_elider.h" 29 #include "ui/gfx/text_elider.h"
30 #include "ui/views/controls/button/button.h" 30 #include "ui/views/controls/button/button.h"
31 #include "ui/views/controls/image_view.h" 31 #include "ui/views/controls/image_view.h"
32 #include "ui/views/controls/label.h" 32 #include "ui/views/controls/label.h"
33 #include "ui/views/controls/scroll_view.h" 33 #include "ui/views/controls/scroll_view.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_CAST_CAST_UNKNOWN), 122 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_CAST_CAST_UNKNOWN),
123 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_CAST_STOP)) { 123 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_CAST_STOP)) {
124 icon()->SetImage( 124 icon()->SetImage(
125 gfx::CreateVectorIcon(kSystemMenuCastEnabledIcon, kMenuIconColor)); 125 gfx::CreateVectorIcon(kSystemMenuCastEnabledIcon, kMenuIconColor));
126 } 126 }
127 127
128 CastCastView::~CastCastView() {} 128 CastCastView::~CastCastView() {}
129 129
130 void CastCastView::StopCasting() { 130 void CastCastView::StopCasting() {
131 Shell::Get()->cast_config()->StopCasting(displayed_route_.Clone()); 131 Shell::Get()->cast_config()->StopCasting(displayed_route_.Clone());
132 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_CAST_STOP_CAST); 132 ShellPort::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_CAST_STOP_CAST);
133 } 133 }
134 134
135 void CastCastView::UpdateLabel( 135 void CastCastView::UpdateLabel(
136 const std::vector<mojom::SinkAndRoutePtr>& sinks_routes) { 136 const std::vector<mojom::SinkAndRoutePtr>& sinks_routes) {
137 for (auto& i : sinks_routes) { 137 for (auto& i : sinks_routes) {
138 const mojom::CastSinkPtr& sink = i->sink; 138 const mojom::CastSinkPtr& sink = i->sink;
139 const mojom::CastRoutePtr& route = i->route; 139 const mojom::CastRoutePtr& route = i->route;
140 140
141 // We only want to display casts that came from this machine, since on a 141 // We only want to display casts that came from this machine, since on a
142 // busy network many other people could be casting. 142 // busy network many other people could be casting.
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 406
407 scroll_content()->AddChildView(container); 407 scroll_content()->AddChildView(container);
408 return container; 408 return container;
409 } 409 }
410 410
411 void CastDetailedView::HandleViewClicked(views::View* view) { 411 void CastDetailedView::HandleViewClicked(views::View* view) {
412 // Find the receiver we are going to cast to. 412 // Find the receiver we are going to cast to.
413 auto it = view_to_sink_map_.find(view); 413 auto it = view_to_sink_map_.find(view);
414 if (it != view_to_sink_map_.end()) { 414 if (it != view_to_sink_map_.end()) {
415 Shell::Get()->cast_config()->CastToSink(it->second.Clone()); 415 Shell::Get()->cast_config()->CastToSink(it->second.Clone());
416 WmShell::Get()->RecordUserMetricsAction( 416 ShellPort::Get()->RecordUserMetricsAction(
417 UMA_STATUS_AREA_DETAILED_CAST_VIEW_LAUNCH_CAST); 417 UMA_STATUS_AREA_DETAILED_CAST_VIEW_LAUNCH_CAST);
418 } 418 }
419 } 419 }
420 420
421 } // namespace tray 421 } // namespace tray
422 422
423 TrayCast::TrayCast(SystemTray* system_tray) 423 TrayCast::TrayCast(SystemTray* system_tray)
424 : SystemTrayItem(system_tray, UMA_CAST) { 424 : SystemTrayItem(system_tray, UMA_CAST) {
425 Shell::Get()->AddShellObserver(this); 425 Shell::Get()->AddShellObserver(this);
426 Shell::Get()->cast_config()->AddObserver(this); 426 Shell::Get()->cast_config()->AddObserver(this);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 sinks_and_routes_); 463 sinks_and_routes_);
464 default_->set_id(TRAY_VIEW); 464 default_->set_id(TRAY_VIEW);
465 default_->select_view()->set_id(SELECT_VIEW); 465 default_->select_view()->set_id(SELECT_VIEW);
466 default_->cast_view()->set_id(CAST_VIEW); 466 default_->cast_view()->set_id(CAST_VIEW);
467 467
468 UpdatePrimaryView(); 468 UpdatePrimaryView();
469 return default_; 469 return default_;
470 } 470 }
471 471
472 views::View* TrayCast::CreateDetailedView(LoginStatus status) { 472 views::View* TrayCast::CreateDetailedView(LoginStatus status) {
473 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_DETAILED_CAST_VIEW); 473 ShellPort::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_DETAILED_CAST_VIEW);
474 CHECK(detailed_ == nullptr); 474 CHECK(detailed_ == nullptr);
475 detailed_ = new tray::CastDetailedView(this, sinks_and_routes_); 475 detailed_ = new tray::CastDetailedView(this, sinks_and_routes_);
476 return detailed_; 476 return detailed_;
477 } 477 }
478 478
479 void TrayCast::DestroyTrayView() { 479 void TrayCast::DestroyTrayView() {
480 tray_ = nullptr; 480 tray_ = nullptr;
481 } 481 }
482 482
483 void TrayCast::DestroyDefaultView() { 483 void TrayCast::DestroyDefaultView() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 528
529 return false; 529 return false;
530 } 530 }
531 531
532 void TrayCast::OnCastingSessionStartedOrStopped(bool started) { 532 void TrayCast::OnCastingSessionStartedOrStopped(bool started) {
533 is_mirror_casting_ = started; 533 is_mirror_casting_ = started;
534 UpdatePrimaryView(); 534 UpdatePrimaryView();
535 } 535 }
536 536
537 } // namespace ash 537 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698