Commit edaf0c33 authored by David Black's avatar David Black Committed by Commit Bot

Adds deep link util for Assistant.

Placed the util in ash::assistant::util.
Follow up CLs will handle the deep links.

Bug: b:110433859
Change-Id: Ie554bd1a8c3d3acfab6d73697b2bbee9522b4c35
Reviewed-on: https://chromium-review.googlesource.com/1115506Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#571291}
parent c8b39bb6
...@@ -136,6 +136,8 @@ component("ash") { ...@@ -136,6 +136,8 @@ component("ash") {
"assistant/ui/main_stage/suggestion_container_view.h", "assistant/ui/main_stage/suggestion_container_view.h",
"assistant/ui/main_stage/ui_element_container_view.cc", "assistant/ui/main_stage/ui_element_container_view.cc",
"assistant/ui/main_stage/ui_element_container_view.h", "assistant/ui/main_stage/ui_element_container_view.h",
"assistant/util/deep_link_util.cc",
"assistant/util/deep_link_util.h",
"autoclick/autoclick_controller.cc", "autoclick/autoclick_controller.cc",
"autoclick/autoclick_controller.h", "autoclick/autoclick_controller.h",
"cancel_mode.cc", "cancel_mode.cc",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "ash/assistant/assistant_interaction_controller.h" #include "ash/assistant/assistant_interaction_controller.h"
#include "ash/assistant/assistant_ui_controller.h" #include "ash/assistant/assistant_ui_controller.h"
#include "ash/assistant/util/deep_link_util.h"
#include "ash/new_window_controller.h" #include "ash/new_window_controller.h"
#include "ash/session/session_controller.h" #include "ash/session/session_controller.h"
#include "ash/shell.h" #include "ash/shell.h"
...@@ -156,9 +157,14 @@ void AssistantController::OnOpenUrlFromTab(const GURL& url) { ...@@ -156,9 +157,14 @@ void AssistantController::OnOpenUrlFromTab(const GURL& url) {
} }
void AssistantController::OpenUrl(const GURL& url) { void AssistantController::OpenUrl(const GURL& url) {
Shell::Get()->new_window_controller()->NewTabWithUrl(url); if (assistant::util::IsDeepLinkUrl(url)) {
// TODO(dmblack): Handle deep links.
NOTIMPLEMENTED();
return;
}
// We dismiss Assistant UI when opening a new browser tab. // We dismiss Assistant UI when opening a new browser tab.
Shell::Get()->new_window_controller()->NewTabWithUrl(url);
assistant_ui_controller_->HideUi(AssistantSource::kUnspecified); assistant_ui_controller_->HideUi(AssistantSource::kUnspecified);
} }
......
// Copyright 2018 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 "ash/assistant/util/deep_link_util.h"
#include "url/gurl.h"
namespace ash {
namespace assistant {
namespace util {
namespace {
constexpr char kAssistantSettingsSpec[] = "googleassistant://settings";
} // namespace
bool IsDeepLinkUrl(const GURL& url) {
return url.spec() == kAssistantSettingsSpec;
}
} // namespace util
} // namespace assistant
} // namespace ash
// Copyright 2018 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.
#ifndef ASH_ASSISTANT_UTIL_DEEP_LINK_UTIL_H_
#define ASH_ASSISTANT_UTIL_DEEP_LINK_UTIL_H_
class GURL;
namespace ash {
namespace assistant {
namespace util {
// Returns true if the specified |url| is a deep link, false otherwise.
bool IsDeepLinkUrl(const GURL& url);
} // namespace util
} // namespace assistant
} // namespace ash
#endif // ASH_ASSISTANT_UTIL_DEEP_LINK_UTIL_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment