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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
diff --git a/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc b/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..83871f2259a678344a57bce2d8009cafebdd6c80
--- /dev/null
+++ b/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
@@ -0,0 +1,75 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h"
+
+#include <utility>
+
+#include "base/bind.h"
+#include "base/values.h"
+#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/arc/arc_service_manager.h"
+
+namespace chromeos {
+namespace settings {
+
+GoogleAssistantHandler::GoogleAssistantHandler(Profile* profile) {
+}
+
+GoogleAssistantHandler::~GoogleAssistantHandler() {
+}
+
+void GoogleAssistantHandler::OnJavascriptAllowed() {}
+void GoogleAssistantHandler::OnJavascriptDisallowed() {}
+
+void GoogleAssistantHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ "setGoogleAssistantEnabled",
+ base::Bind(&GoogleAssistantHandler::HandleSetGoogleAssistantEnabled,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "setGoogleAssistantContextEnabled",
+ base::Bind(
+ &GoogleAssistantHandler::HandleSetGoogleAssistantContextEnabled,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "showGoogleAssistantSettings",
+ base::Bind(&GoogleAssistantHandler::HandleShowGoogleAssistantSettings,
+ base::Unretained(this)));
+}
+
+void GoogleAssistantHandler::HandleSetGoogleAssistantEnabled(
+ const base::ListValue* args) {
+ CHECK_EQ(1U, args->GetSize());
+ bool enabled;
+ CHECK(args->GetBoolean(0, &enabled));
+
+ arc::ArcVoiceInteractionFrameworkService* service =
+ arc::ArcServiceManager::Get()
+ ->GetService<arc::ArcVoiceInteractionFrameworkService>();
+ if (service)
+ service->SetVoiceInteractionEnabled(enabled);
+}
+
+void GoogleAssistantHandler::HandleSetGoogleAssistantContextEnabled(
+ const base::ListValue* args) {
+ CHECK_EQ(1U, args->GetSize());
+ bool enabled;
+ CHECK(args->GetBoolean(0, &enabled));
+
+ arc::ArcVoiceInteractionFrameworkService* service =
+ arc::ArcServiceManager::Get()
+ ->GetService<arc::ArcVoiceInteractionFrameworkService>();
+ if (service)
+ service->SetVoiceInteractionContextEnabled(enabled);
+}
+
+void GoogleAssistantHandler::HandleShowGoogleAssistantSettings(
+ const base::ListValue* args) {
+ // TODO(rcui): Implement.
+}
+
+} // namespace settings
+}

Powered by Google App Engine
This is Rietveld 408576698