Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc

Issue 2952463002: App list sync unit tests (Closed)
Patch Set: Add in dummy hooks for assistant settings launcher Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 #include "chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h"
6
7 #include <utility>
8
9 #include "base/bind.h"
10 #include "base/values.h"
11 #include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_fr amework_service.h"
12 #include "chrome/browser/profiles/profile.h"
13 #include "components/arc/arc_service_manager.h"
14
15 namespace chromeos {
16 namespace settings {
17
18 GoogleAssistantHandler::GoogleAssistantHandler(Profile* profile) {
19 }
20
21 GoogleAssistantHandler::~GoogleAssistantHandler() {
22 }
23
24 void GoogleAssistantHandler::OnJavascriptAllowed() {}
25 void GoogleAssistantHandler::OnJavascriptDisallowed() {}
26
27 void GoogleAssistantHandler::RegisterMessages() {
28 web_ui()->RegisterMessageCallback(
29 "setGoogleAssistantEnabled",
30 base::Bind(&GoogleAssistantHandler::HandleSetGoogleAssistantEnabled,
31 base::Unretained(this)));
32 web_ui()->RegisterMessageCallback(
33 "setGoogleAssistantContextEnabled",
34 base::Bind(
35 &GoogleAssistantHandler::HandleSetGoogleAssistantContextEnabled,
36 base::Unretained(this)));
37 web_ui()->RegisterMessageCallback(
38 "showGoogleAssistantSettings",
39 base::Bind(&GoogleAssistantHandler::HandleShowGoogleAssistantSettings,
40 base::Unretained(this)));
41 }
42
43 void GoogleAssistantHandler::HandleSetGoogleAssistantEnabled(
44 const base::ListValue* args) {
45 CHECK_EQ(1U, args->GetSize());
46 bool enabled;
47 CHECK(args->GetBoolean(0, &enabled));
48
49 arc::ArcVoiceInteractionFrameworkService* service =
50 arc::ArcServiceManager::Get()
51 ->GetService<arc::ArcVoiceInteractionFrameworkService>();
52 if (service)
53 service->SetVoiceInteractionEnabled(enabled);
54 }
55
56 void GoogleAssistantHandler::HandleSetGoogleAssistantContextEnabled(
57 const base::ListValue* args) {
58 CHECK_EQ(1U, args->GetSize());
59 bool enabled;
60 CHECK(args->GetBoolean(0, &enabled));
61
62 arc::ArcVoiceInteractionFrameworkService* service =
63 arc::ArcServiceManager::Get()
64 ->GetService<arc::ArcVoiceInteractionFrameworkService>();
65 if (service)
66 service->SetVoiceInteractionContextEnabled(enabled);
67 }
68
69 void GoogleAssistantHandler::HandleShowGoogleAssistantSettings(
70 const base::ListValue* args) {
71 // TODO(rcui): Implement.
72 }
73
74 } // namespace settings
75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698