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/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
10 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
11 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
12 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
13 #include "ui/gfx/image/image_skia.h" | 14 #include "ui/gfx/image/image_skia.h" |
14 | 15 |
16 using media_router::MediaRouterDialogController; | |
17 | |
15 MediaRouterAction::MediaRouterAction() | 18 MediaRouterAction::MediaRouterAction() |
16 : id_("media_router_action"), | 19 : id_("media_router_action"), |
17 name_(l10n_util::GetStringUTF16(IDS_MEDIA_ROUTER_TITLE)), | 20 name_(l10n_util::GetStringUTF16(IDS_MEDIA_ROUTER_TITLE)), |
18 media_router_idle_icon_(ui::ResourceBundle::GetSharedInstance(). | 21 media_router_idle_icon_(ui::ResourceBundle::GetSharedInstance(). |
19 GetImageNamed(IDR_MEDIA_ROUTER_IDLE_ICON)), | 22 GetImageNamed(IDR_MEDIA_ROUTER_IDLE_ICON)), |
20 delegate_(nullptr) { | 23 delegate_(nullptr) { |
21 } | 24 } |
22 | 25 |
23 MediaRouterAction::~MediaRouterAction() { | 26 MediaRouterAction::~MediaRouterAction() { |
24 } | 27 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 return name_; | 59 return name_; |
57 } | 60 } |
58 | 61 |
59 bool MediaRouterAction::IsEnabled( | 62 bool MediaRouterAction::IsEnabled( |
60 content::WebContents* web_contents) const { | 63 content::WebContents* web_contents) const { |
61 return true; | 64 return true; |
62 } | 65 } |
63 | 66 |
64 bool MediaRouterAction::WantsToRun( | 67 bool MediaRouterAction::WantsToRun( |
65 content::WebContents* web_contents) const { | 68 content::WebContents* web_contents) const { |
66 NOTIMPLEMENTED(); | |
Peter Kasting
2015/06/04 00:17:52
Nit: It looks like most of these functions have tr
imcheng (use chromium acct)
2015/06/04 01:04:20
Acknowledged. Most other implementations seem to b
| |
67 return false; | 69 return false; |
68 } | 70 } |
69 | 71 |
70 bool MediaRouterAction::HasPopup( | 72 bool MediaRouterAction::HasPopup( |
71 content::WebContents* web_contents) const { | 73 content::WebContents* web_contents) const { |
72 NOTIMPLEMENTED(); | |
73 return true; | 74 return true; |
74 } | 75 } |
75 | 76 |
76 void MediaRouterAction::HidePopup() { | 77 void MediaRouterAction::HidePopup() { |
77 NOTIMPLEMENTED(); | 78 content::WebContents* web_contents = delegate_->GetCurrentWebContents(); |
Peter Kasting
2015/06/04 00:17:52
Nit: Why do you not DCHECK(delegate_) here, but yo
imcheng (use chromium acct)
2015/06/04 01:04:20
Done.
| |
79 DCHECK(web_contents); | |
80 MediaRouterDialogController* controller = | |
81 MediaRouterDialogController::GetOrCreateForWebContents(web_contents); | |
Peter Kasting
2015/06/04 00:17:52
Nit: You have a bunch of code duplicated in these
imcheng (use chromium acct)
2015/06/04 01:04:20
Done.
| |
82 controller->CloseMediaRouterDialog(); | |
78 } | 83 } |
79 | 84 |
80 gfx::NativeView MediaRouterAction::GetPopupNativeView() { | 85 gfx::NativeView MediaRouterAction::GetPopupNativeView() { |
81 NOTIMPLEMENTED(); | |
82 return nullptr; | 86 return nullptr; |
83 } | 87 } |
84 | 88 |
85 ui::MenuModel* MediaRouterAction::GetContextMenu() { | 89 ui::MenuModel* MediaRouterAction::GetContextMenu() { |
86 NOTIMPLEMENTED(); | |
87 return nullptr; | 90 return nullptr; |
88 } | 91 } |
89 | 92 |
90 bool MediaRouterAction::CanDrag() const { | 93 bool MediaRouterAction::CanDrag() const { |
91 NOTIMPLEMENTED(); | |
92 return false; | 94 return false; |
93 } | 95 } |
94 | 96 |
95 bool MediaRouterAction::ExecuteAction(bool by_user) { | 97 bool MediaRouterAction::ExecuteAction(bool by_user) { |
96 NOTIMPLEMENTED(); | 98 DCHECK(delegate_); |
97 return false; | 99 content::WebContents* web_contents = delegate_->GetCurrentWebContents(); |
100 DCHECK(web_contents); | |
101 MediaRouterDialogController* controller = | |
102 MediaRouterDialogController::GetOrCreateForWebContents(web_contents); | |
103 controller->ShowMediaRouterDialog(); | |
104 return true; | |
98 } | 105 } |
99 | 106 |
100 void MediaRouterAction::UpdateState() { | 107 void MediaRouterAction::UpdateState() { |
101 NOTIMPLEMENTED(); | 108 NOTIMPLEMENTED(); |
102 } | 109 } |
110 | |
111 content::WebContents* MediaRouterAction::GetMediaRouterDialog() const { | |
112 DCHECK(delegate_); | |
113 content::WebContents* web_contents = delegate_->GetCurrentWebContents(); | |
114 DCHECK(web_contents); | |
115 MediaRouterDialogController* controller = | |
116 MediaRouterDialogController::GetOrCreateForWebContents(web_contents); | |
117 return controller->GetMediaRouterDialog(); | |
118 } | |
OLD | NEW |