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/media_router_action_platform_delegate.h" | 8 #include "chrome/browser/ui/toolbar/media_router_action_platform_delegate.h" |
9 #include "chrome/browser/ui/toolbar/toolbar_action_view_delegate.h" | 9 #include "chrome/browser/ui/toolbar/toolbar_action_view_delegate.h" |
10 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller.h" | 10 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller_im
pl.h" |
11 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
16 | 16 |
17 using media_router::MediaRouterDialogController; | 17 using media_router::MediaRouterDialogControllerImpl; |
18 | 18 |
19 MediaRouterAction::MediaRouterAction(Browser* browser) | 19 MediaRouterAction::MediaRouterAction(Browser* browser) |
20 : id_("media_router_action"), | 20 : id_("media_router_action"), |
21 name_(l10n_util::GetStringUTF16(IDS_MEDIA_ROUTER_TITLE)), | 21 name_(l10n_util::GetStringUTF16(IDS_MEDIA_ROUTER_TITLE)), |
22 media_router_idle_icon_(ui::ResourceBundle::GetSharedInstance(). | 22 media_router_idle_icon_(ui::ResourceBundle::GetSharedInstance(). |
23 GetImageNamed(IDR_MEDIA_ROUTER_IDLE_ICON)), | 23 GetImageNamed(IDR_MEDIA_ROUTER_IDLE_ICON)), |
24 delegate_(nullptr), | 24 delegate_(nullptr), |
25 platform_delegate_(MediaRouterActionPlatformDelegate::Create(browser)) { | 25 platform_delegate_(MediaRouterActionPlatformDelegate::Create(browser)) { |
26 } | 26 } |
27 | 27 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 bool MediaRouterAction::ExecuteAction(bool by_user) { | 90 bool MediaRouterAction::ExecuteAction(bool by_user) { |
91 GetMediaRouterDialogController()->ShowMediaRouterDialog(); | 91 GetMediaRouterDialogController()->ShowMediaRouterDialog(); |
92 if (platform_delegate_) | 92 if (platform_delegate_) |
93 platform_delegate_->CloseOverflowMenuIfOpen(); | 93 platform_delegate_->CloseOverflowMenuIfOpen(); |
94 return true; | 94 return true; |
95 } | 95 } |
96 | 96 |
97 void MediaRouterAction::UpdateState() { | 97 void MediaRouterAction::UpdateState() { |
98 } | 98 } |
99 | 99 |
100 MediaRouterDialogController* | 100 MediaRouterDialogControllerImpl* |
101 MediaRouterAction::GetMediaRouterDialogController() { | 101 MediaRouterAction::GetMediaRouterDialogController() { |
102 DCHECK(delegate_); | 102 DCHECK(delegate_); |
103 content::WebContents* web_contents = delegate_->GetCurrentWebContents(); | 103 content::WebContents* web_contents = delegate_->GetCurrentWebContents(); |
104 DCHECK(web_contents); | 104 DCHECK(web_contents); |
105 return MediaRouterDialogController::GetOrCreateForWebContents(web_contents); | 105 return MediaRouterDialogControllerImpl::GetOrCreateForWebContents( |
| 106 web_contents); |
106 } | 107 } |
107 | 108 |
108 bool MediaRouterAction::DisabledClickOpensMenu() const { | 109 bool MediaRouterAction::DisabledClickOpensMenu() const { |
109 return false; | 110 return false; |
110 } | 111 } |
OLD | NEW |