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 "chrome/browser/ui/toolbar/media_router_action.h" | 5 #include "chrome/browser/ui/toolbar/media_router_action.h" |
6 | 6 |
7 #include "base/metrics/user_metrics.h" | 7 #include "base/metrics/user_metrics.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/media/router/issue.h" | 9 #include "chrome/browser/media/router/issue.h" |
10 #include "chrome/browser/media/router/media_route.h" | 10 #include "chrome/browser/media/router/media_route.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 gfx::NativeView MediaRouterAction::GetPopupNativeView() { | 133 gfx::NativeView MediaRouterAction::GetPopupNativeView() { |
134 return nullptr; | 134 return nullptr; |
135 } | 135 } |
136 | 136 |
137 ui::MenuModel* MediaRouterAction::GetContextMenu() { | 137 ui::MenuModel* MediaRouterAction::GetContextMenu() { |
138 return contextual_menu_.menu_model(); | 138 return contextual_menu_.menu_model(); |
139 } | 139 } |
140 | 140 |
| 141 void MediaRouterAction::OnContextMenuClosed() { |
| 142 if (toolbar_actions_bar_->popped_out_action() == this && |
| 143 !GetMediaRouterDialogController()->IsShowingMediaRouterDialog()) { |
| 144 toolbar_actions_bar_->UndoPopOut(); |
| 145 } |
| 146 } |
| 147 |
141 bool MediaRouterAction::ExecuteAction(bool by_user) { | 148 bool MediaRouterAction::ExecuteAction(bool by_user) { |
142 base::RecordAction(base::UserMetricsAction("MediaRouter_Icon_Click")); | 149 base::RecordAction(base::UserMetricsAction("MediaRouter_Icon_Click")); |
143 | 150 |
144 if (GetMediaRouterDialogController()->IsShowingMediaRouterDialog()) { | 151 if (GetMediaRouterDialogController()->IsShowingMediaRouterDialog()) { |
145 GetMediaRouterDialogController()->HideMediaRouterDialog(); | 152 GetMediaRouterDialogController()->HideMediaRouterDialog(); |
146 return false; | 153 return false; |
147 } | 154 } |
148 | 155 |
149 GetMediaRouterDialogController()->ShowMediaRouterDialog(); | 156 GetMediaRouterDialogController()->ShowMediaRouterDialog(); |
150 if (GetPlatformDelegate()) { | 157 if (GetPlatformDelegate()) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 if (severity == media_router::IssueInfo::Severity::FATAL) | 282 if (severity == media_router::IssueInfo::Severity::FATAL) |
276 return gfx::VectorIconId::MEDIA_ROUTER_ERROR; | 283 return gfx::VectorIconId::MEDIA_ROUTER_ERROR; |
277 if (severity == media_router::IssueInfo::Severity::WARNING) | 284 if (severity == media_router::IssueInfo::Severity::WARNING) |
278 return gfx::VectorIconId::MEDIA_ROUTER_WARNING; | 285 return gfx::VectorIconId::MEDIA_ROUTER_WARNING; |
279 // Fall through for Severity::NOTIFICATION. | 286 // Fall through for Severity::NOTIFICATION. |
280 } | 287 } |
281 | 288 |
282 return has_local_display_route_ ? gfx::VectorIconId::MEDIA_ROUTER_ACTIVE | 289 return has_local_display_route_ ? gfx::VectorIconId::MEDIA_ROUTER_ACTIVE |
283 : gfx::VectorIconId::MEDIA_ROUTER_IDLE; | 290 : gfx::VectorIconId::MEDIA_ROUTER_IDLE; |
284 } | 291 } |
OLD | NEW |