| OLD | NEW |
| 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> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ash/common/system/tray/tray_constants.h" | 22 #include "ash/common/system/tray/tray_constants.h" |
| 23 #include "ash/common/system/tray/tray_details_view.h" | 23 #include "ash/common/system/tray/tray_details_view.h" |
| 24 #include "ash/common/system/tray/tray_item_more.h" | 24 #include "ash/common/system/tray/tray_item_more.h" |
| 25 #include "ash/common/system/tray/tray_item_view.h" | 25 #include "ash/common/system/tray/tray_item_view.h" |
| 26 #include "ash/common/system/tray/tray_utils.h" | 26 #include "ash/common/system/tray/tray_utils.h" |
| 27 #include "ash/common/wm_shell.h" | 27 #include "ash/common/wm_shell.h" |
| 28 #include "ash/public/cpp/shelf_types.h" | 28 #include "ash/public/cpp/shelf_types.h" |
| 29 #include "ash/public/interfaces/cast_config.mojom.h" | 29 #include "ash/public/interfaces/cast_config.mojom.h" |
| 30 #include "ash/resources/grit/ash_resources.h" | 30 #include "ash/resources/grit/ash_resources.h" |
| 31 #include "ash/resources/vector_icons/vector_icons.h" | 31 #include "ash/resources/vector_icons/vector_icons.h" |
| 32 #include "ash/shell.h" |
| 32 #include "ash/strings/grit/ash_strings.h" | 33 #include "ash/strings/grit/ash_strings.h" |
| 33 #include "base/bind.h" | 34 #include "base/bind.h" |
| 34 #include "base/strings/utf_string_conversions.h" | 35 #include "base/strings/utf_string_conversions.h" |
| 35 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 36 #include "ui/base/resource/resource_bundle.h" | 37 #include "ui/base/resource/resource_bundle.h" |
| 37 #include "ui/gfx/image/image.h" | 38 #include "ui/gfx/image/image.h" |
| 38 #include "ui/gfx/paint_vector_icon.h" | 39 #include "ui/gfx/paint_vector_icon.h" |
| 39 #include "ui/gfx/text_elider.h" | 40 #include "ui/gfx/text_elider.h" |
| 40 #include "ui/views/background.h" | 41 #include "ui/views/background.h" |
| 41 #include "ui/views/border.h" | 42 #include "ui/views/border.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 WmShell::Get()->cast_config()->CastToSink(it->second.Clone()); | 450 WmShell::Get()->cast_config()->CastToSink(it->second.Clone()); |
| 450 WmShell::Get()->RecordUserMetricsAction( | 451 WmShell::Get()->RecordUserMetricsAction( |
| 451 UMA_STATUS_AREA_DETAILED_CAST_VIEW_LAUNCH_CAST); | 452 UMA_STATUS_AREA_DETAILED_CAST_VIEW_LAUNCH_CAST); |
| 452 } | 453 } |
| 453 } | 454 } |
| 454 | 455 |
| 455 } // namespace tray | 456 } // namespace tray |
| 456 | 457 |
| 457 TrayCast::TrayCast(SystemTray* system_tray) | 458 TrayCast::TrayCast(SystemTray* system_tray) |
| 458 : SystemTrayItem(system_tray, UMA_CAST) { | 459 : SystemTrayItem(system_tray, UMA_CAST) { |
| 459 WmShell::Get()->AddShellObserver(this); | 460 Shell::GetInstance()->AddShellObserver(this); |
| 460 WmShell::Get()->cast_config()->AddObserver(this); | 461 WmShell::Get()->cast_config()->AddObserver(this); |
| 461 WmShell::Get()->cast_config()->RequestDeviceRefresh(); | 462 WmShell::Get()->cast_config()->RequestDeviceRefresh(); |
| 462 } | 463 } |
| 463 | 464 |
| 464 TrayCast::~TrayCast() { | 465 TrayCast::~TrayCast() { |
| 465 WmShell::Get()->cast_config()->RemoveObserver(this); | 466 WmShell::Get()->cast_config()->RemoveObserver(this); |
| 466 WmShell::Get()->RemoveShellObserver(this); | 467 Shell::GetInstance()->RemoveShellObserver(this); |
| 467 } | 468 } |
| 468 | 469 |
| 469 void TrayCast::StartCastForTest(const std::string& receiver_id) { | 470 void TrayCast::StartCastForTest(const std::string& receiver_id) { |
| 470 if (detailed_ != nullptr) | 471 if (detailed_ != nullptr) |
| 471 detailed_->SimulateViewClickedForTest(receiver_id); | 472 detailed_->SimulateViewClickedForTest(receiver_id); |
| 472 } | 473 } |
| 473 | 474 |
| 474 void TrayCast::StopCastForTest() { | 475 void TrayCast::StopCastForTest() { |
| 475 default_->cast_view()->StopCasting(); | 476 default_->cast_view()->StopCasting(); |
| 476 } | 477 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 | 564 |
| 564 return false; | 565 return false; |
| 565 } | 566 } |
| 566 | 567 |
| 567 void TrayCast::OnCastingSessionStartedOrStopped(bool started) { | 568 void TrayCast::OnCastingSessionStartedOrStopped(bool started) { |
| 568 is_mirror_casting_ = started; | 569 is_mirror_casting_ = started; |
| 569 UpdatePrimaryView(); | 570 UpdatePrimaryView(); |
| 570 } | 571 } |
| 571 | 572 |
| 572 } // namespace ash | 573 } // namespace ash |
| OLD | NEW |