| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/toolbar/toolbar_action_view_delegate.h" | 8 #include "chrome/browser/ui/toolbar/toolbar_action_view_delegate.h" |
| 9 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller.h" | 9 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 const std::string& MediaRouterAction::GetId() const { | 29 const std::string& MediaRouterAction::GetId() const { |
| 30 return id_; | 30 return id_; |
| 31 } | 31 } |
| 32 | 32 |
| 33 void MediaRouterAction::SetDelegate(ToolbarActionViewDelegate* delegate) { | 33 void MediaRouterAction::SetDelegate(ToolbarActionViewDelegate* delegate) { |
| 34 delegate_ = delegate; | 34 delegate_ = delegate; |
| 35 } | 35 } |
| 36 | 36 |
| 37 gfx::Image MediaRouterAction::GetIcon( | 37 gfx::Image MediaRouterAction::GetIcon(content::WebContents* web_contents, |
| 38 content::WebContents* web_contents) { | 38 const gfx::Size& size) { |
| 39 // TODO(apacible): Return icon based on casting state. | 39 // TODO(apacible): Return icon based on casting state. |
| 40 return media_router_idle_icon_; | 40 return media_router_idle_icon_; |
| 41 } | 41 } |
| 42 | 42 |
| 43 gfx::ImageSkia MediaRouterAction::GetIconWithBadge() { | |
| 44 DCHECK(delegate_); | |
| 45 return *GetIcon(delegate_->GetCurrentWebContents()).ToImageSkia(); | |
| 46 } | |
| 47 | |
| 48 base::string16 MediaRouterAction::GetActionName() const { | 43 base::string16 MediaRouterAction::GetActionName() const { |
| 49 return name_; | 44 return name_; |
| 50 } | 45 } |
| 51 | 46 |
| 52 base::string16 MediaRouterAction::GetAccessibleName( | 47 base::string16 MediaRouterAction::GetAccessibleName( |
| 53 content::WebContents* web_contents) const { | 48 content::WebContents* web_contents) const { |
| 54 return GetTooltip(web_contents); | 49 return GetTooltip(web_contents); |
| 55 } | 50 } |
| 56 | 51 |
| 57 base::string16 MediaRouterAction::GetTooltip( | 52 base::string16 MediaRouterAction::GetTooltip( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void MediaRouterAction::UpdateState() { | 93 void MediaRouterAction::UpdateState() { |
| 99 } | 94 } |
| 100 | 95 |
| 101 MediaRouterDialogController* | 96 MediaRouterDialogController* |
| 102 MediaRouterAction::GetMediaRouterDialogController() { | 97 MediaRouterAction::GetMediaRouterDialogController() { |
| 103 DCHECK(delegate_); | 98 DCHECK(delegate_); |
| 104 content::WebContents* web_contents = delegate_->GetCurrentWebContents(); | 99 content::WebContents* web_contents = delegate_->GetCurrentWebContents(); |
| 105 DCHECK(web_contents); | 100 DCHECK(web_contents); |
| 106 return MediaRouterDialogController::GetOrCreateForWebContents(web_contents); | 101 return MediaRouterDialogController::GetOrCreateForWebContents(web_contents); |
| 107 } | 102 } |
| OLD | NEW |