Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / webui / media_router / media_router_webui_message_handler.cc
blob183ae946b928fc18cb9b27fa64c8a80702ebba00
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/webui/media_router/media_router_webui_message_handler.h"
7 #include "base/bind.h"
8 #include "chrome/browser/ui/webui/media_router/media_router_ui.h"
9 #include "content/public/browser/web_ui.h"
11 namespace media_router {
13 namespace {
15 // Message names.
16 const char kGetInitialSettings[] = "getInitialSettings";
17 const char kCreateRoute[] = "requestRoute";
18 const char kActOnIssue[] = "actOnIssue";
19 const char kCloseRoute[] = "closeRoute";
20 const char kCloseDialog[] = "closeDialog";
22 // TODO(imcheng): Define JS function names here.
24 } // namespace
26 MediaRouterWebUIMessageHandler::MediaRouterWebUIMessageHandler()
27 : dialog_closing_(false) {
30 MediaRouterWebUIMessageHandler::~MediaRouterWebUIMessageHandler() {
33 void MediaRouterWebUIMessageHandler::RegisterMessages() {
34 web_ui()->RegisterMessageCallback(
35 kGetInitialSettings,
36 base::Bind(&MediaRouterWebUIMessageHandler::OnGetInitialSettings,
37 base::Unretained(this)));
38 web_ui()->RegisterMessageCallback(
39 kCreateRoute,
40 base::Bind(&MediaRouterWebUIMessageHandler::OnCreateRoute,
41 base::Unretained(this)));
42 web_ui()->RegisterMessageCallback(
43 kActOnIssue,
44 base::Bind(&MediaRouterWebUIMessageHandler::OnActOnIssue,
45 base::Unretained(this)));
46 web_ui()->RegisterMessageCallback(
47 kCloseRoute,
48 base::Bind(&MediaRouterWebUIMessageHandler::OnCloseRoute,
49 base::Unretained(this)));
50 web_ui()->RegisterMessageCallback(
51 kCloseDialog,
52 base::Bind(&MediaRouterWebUIMessageHandler::OnCloseDialog,
53 base::Unretained(this)));
56 void MediaRouterWebUIMessageHandler::OnGetInitialSettings(
57 const base::ListValue* args) {
58 // TODO(imcheng): Implement.
59 NOTIMPLEMENTED();
62 void MediaRouterWebUIMessageHandler::OnCreateRoute(
63 const base::ListValue* args) {
64 // TODO(imcheng): Implement.
65 NOTIMPLEMENTED();
68 void MediaRouterWebUIMessageHandler::OnActOnIssue(
69 const base::ListValue* args) {
70 // TODO(imcheng): Implement.
71 NOTIMPLEMENTED();
74 void MediaRouterWebUIMessageHandler::OnCloseRoute(
75 const base::ListValue* args) {
76 // TODO(imcheng): Implement.
77 NOTIMPLEMENTED();
80 void MediaRouterWebUIMessageHandler::OnCloseDialog(
81 const base::ListValue* args) {
82 CHECK(!dialog_closing_);
83 dialog_closing_ = true;
84 GetMediaRouterUI()->Close();
87 MediaRouterUI* MediaRouterWebUIMessageHandler::GetMediaRouterUI() const {
88 MediaRouterUI* media_router_ui =
89 static_cast<MediaRouterUI*>(web_ui()->GetController());
90 DCHECK(media_router_ui);
91 return media_router_ui;
94 } // namespace media_router