assistant: deprecate old assistant code
Remove most of the old assistant code. This is the first pass, will do
a second pass to catch the remaining.
Bug: b:120553209
Test: locally build and run
Change-Id: I1907ea797ef42a5e1f43ddc6200986e4184661e5
Reviewed-on: https://chromium-review.googlesource.com/c/1388441
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: Yusuke Sato <yusukes@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621425}
diff --git a/ash/BUILD.gn b/ash/BUILD.gn
index c548b4e..d8ee9636 100644
--- a/ash/BUILD.gn
+++ b/ash/BUILD.gn
@@ -2077,6 +2077,8 @@
"app_list/test/test_app_list_client.h",
"app_menu/notification_menu_view_test_api.cc",
"app_menu/notification_menu_view_test_api.h",
+ "assistant/test/test_assistant_service.cc",
+ "assistant/test/test_assistant_service.h",
"display/display_configuration_controller_test_api.cc",
"display/display_configuration_controller_test_api.h",
"display/mirror_window_test_api.cc",
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index e70b44b4..f170953a 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -717,13 +717,9 @@
break;
}
- if (!chromeos::switches::IsAssistantEnabled()) {
- Shell::Get()->app_list_controller()->ToggleVoiceInteractionSession();
- } else {
- Shell::Get()->assistant_controller()->ui_controller()->ToggleUi(
- /*entry_point=*/AssistantEntryPoint::kHotkey,
- /*exit_point=*/AssistantExitPoint::kHotkey);
- }
+ Shell::Get()->assistant_controller()->ui_controller()->ToggleUi(
+ /*entry_point=*/AssistantEntryPoint::kHotkey,
+ /*exit_point=*/AssistantExitPoint::kHotkey);
}
void HandleSuspend() {
diff --git a/ash/app_list/app_list_controller_impl.cc b/ash/app_list/app_list_controller_impl.cc
index dd4cd6ab..4c232813 100644
--- a/ash/app_list/app_list_controller_impl.cc
+++ b/ash/app_list/app_list_controller_impl.cc
@@ -848,16 +848,6 @@
client_->OnAppListTargetVisibilityChanged(visible);
}
-void AppListControllerImpl::StartVoiceInteractionSession() {
- if (client_)
- client_->StartVoiceInteractionSession();
-}
-
-void AppListControllerImpl::ToggleVoiceInteractionSession() {
- if (client_)
- client_->ToggleVoiceInteractionSession();
-}
-
////////////////////////////////////////////////////////////////////////////////
// Private used only:
diff --git a/ash/app_list/app_list_controller_impl.h b/ash/app_list/app_list_controller_impl.h
index 923adde..a2f63ce 100644
--- a/ash/app_list/app_list_controller_impl.h
+++ b/ash/app_list/app_list_controller_impl.h
@@ -184,8 +184,6 @@
void OnVisibilityChanged(bool visible);
void OnTargetVisibilityChanged(bool visible);
- void StartVoiceInteractionSession();
- void ToggleVoiceInteractionSession();
void FlushForTesting();
diff --git a/ash/app_list/test/app_list_test_helper.cc b/ash/app_list/test/app_list_test_helper.cc
index cd8abbbb..6371fa2 100644
--- a/ash/app_list/test/app_list_test_helper.cc
+++ b/ash/app_list/test/app_list_test_helper.cc
@@ -74,10 +74,6 @@
EXPECT_EQ(visible, app_list_controller_->GetTargetVisibility());
}
-void AppListTestHelper::CheckVoiceSessionCount(size_t count) {
- EXPECT_EQ(count, app_list_client_->voice_session_count());
-}
-
void AppListTestHelper::CheckState(app_list::AppListViewState state) {
EXPECT_EQ(state, app_list_controller_->GetAppListViewState());
}
diff --git a/ash/app_list/test/app_list_test_helper.h b/ash/app_list/test/app_list_test_helper.h
index 846c67c..965f8156 100644
--- a/ash/app_list/test/app_list_test_helper.h
+++ b/ash/app_list/test/app_list_test_helper.h
@@ -57,9 +57,6 @@
// Fails in tests if either one doesn't match |visible|,.
void CheckVisibility(bool visible);
- // Check the accumulated voice session count.
- void CheckVoiceSessionCount(size_t count);
-
// Check the current app list view state.
void CheckState(app_list::AppListViewState state);
diff --git a/ash/app_list/test/test_app_list_client.cc b/ash/app_list/test/test_app_list_client.cc
index 19299e50..f54e2995 100644
--- a/ash/app_list/test/test_app_list_client.cc
+++ b/ash/app_list/test/test_app_list_client.cc
@@ -18,12 +18,4 @@
return ptr;
}
-void TestAppListClient::StartVoiceInteractionSession() {
- ++voice_session_count_;
-}
-
-void TestAppListClient::ToggleVoiceInteractionSession() {
- ++voice_session_count_;
-}
-
} // namespace ash
diff --git a/ash/app_list/test/test_app_list_client.h b/ash/app_list/test/test_app_list_client.h
index 10a24a0..8d36acc 100644
--- a/ash/app_list/test/test_app_list_client.h
+++ b/ash/app_list/test/test_app_list_client.h
@@ -51,16 +51,10 @@
void OnPageBreakItemAdded(const std::string& id,
const syncer::StringOrdinal& position) override {}
void OnPageBreakItemDeleted(const std::string& id) override {}
- void StartVoiceInteractionSession() override;
- void ToggleVoiceInteractionSession() override;
void GetNavigableContentsFactory(
content::mojom::NavigableContentsFactoryRequest request) override {}
- size_t voice_session_count() const { return voice_session_count_; }
-
private:
- size_t voice_session_count_ = 0u;
-
mojo::Binding<mojom::AppListClient> binding_;
DISALLOW_COPY_AND_ASSIGN(TestAppListClient);
diff --git a/ash/assistant/test/test_assistant_service.cc b/ash/assistant/test/test_assistant_service.cc
new file mode 100644
index 0000000..1f989fd3
--- /dev/null
+++ b/ash/assistant/test/test_assistant_service.cc
@@ -0,0 +1,26 @@
+// 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/test/test_assistant_service.h"
+
+#include <utility>
+
+namespace ash {
+
+TestAssistantService::TestAssistantService() : binding_(this) {}
+
+TestAssistantService::~TestAssistantService() = default;
+
+chromeos::assistant::mojom::AssistantPtr
+TestAssistantService::CreateInterfacePtrAndBind() {
+ chromeos::assistant::mojom::AssistantPtr ptr;
+ binding_.Bind(mojo::MakeRequest(&ptr));
+ return ptr;
+}
+
+void TestAssistantService::CacheScreenContext(
+ CacheScreenContextCallback callback) {
+ std::move(callback).Run();
+}
+} // namespace ash
diff --git a/ash/assistant/test/test_assistant_service.h b/ash/assistant/test/test_assistant_service.h
new file mode 100644
index 0000000..397f1b0
--- /dev/null
+++ b/ash/assistant/test/test_assistant_service.h
@@ -0,0 +1,51 @@
+// 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_TEST_TEST_ASSISTANT_SERVICE_H_
+#define ASH_ASSISTANT_TEST_TEST_ASSISTANT_SERVICE_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "chromeos/services/assistant/public/mojom/assistant.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+namespace ash {
+
+class TestAssistantService : public chromeos::assistant::mojom::Assistant {
+ public:
+ TestAssistantService();
+ ~TestAssistantService() override;
+
+ chromeos::assistant::mojom::AssistantPtr CreateInterfacePtrAndBind();
+
+ // mojom::Assistant overrides:
+ void StartCachedScreenContextInteraction() override {}
+ void StartMetalayerInteraction(const gfx::Rect& region) override {}
+ void StartTextInteraction(const std::string& query, bool allow_tts) override {
+ }
+ void StartVoiceInteraction() override {}
+ void StartWarmerWelcomeInteraction(int num_warmer_welcome_triggered,
+ bool allow_tts) override {}
+ void StopActiveInteraction(bool cancel_conversation) override {}
+ void AddAssistantInteractionSubscriber(
+ chromeos::assistant::mojom::AssistantInteractionSubscriberPtr subscriber)
+ override {}
+ void RetrieveNotification(
+ chromeos::assistant::mojom::AssistantNotificationPtr notification,
+ int action_index) override {}
+ void DismissNotification(chromeos::assistant::mojom::AssistantNotificationPtr
+ notification) override {}
+ void CacheScreenContext(CacheScreenContextCallback callback) override;
+ void OnAccessibilityStatusChanged(bool spoken_feedback_enabled) override {}
+
+ private:
+ mojo::Binding<chromeos::assistant::mojom::Assistant> binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestAssistantService);
+};
+
+} // namespace ash
+
+#endif // ASH_ASSISTANT_TEST_TEST_ASSISTANT_SERVICE_H_
diff --git a/ash/public/interfaces/app_list.mojom b/ash/public/interfaces/app_list.mojom
index b85f786..3336a2d 100644
--- a/ash/public/interfaces/app_list.mojom
+++ b/ash/public/interfaces/app_list.mojom
@@ -361,13 +361,6 @@
// Invoked when a "page break" item with |id| is deleted.
OnPageBreakItemDeleted(string id);
- //////////////////////////////////////////////////////////////////////////////
- // Interfaces on voice interaction:
- // Starts a voice interaction session.
- StartVoiceInteractionSession();
- // Starts or stops voice interaction session based on current state.
- ToggleVoiceInteractionSession();
-
// Acquires a NavigableContentsFactory (indirectly) from the Content Service
// to allow the app list to display embedded web contents. Currently used only
// for answer card search results.
diff --git a/ash/shelf/app_list_button.cc b/ash/shelf/app_list_button.cc
index e65a17f..9ccac053 100644
--- a/ash/shelf/app_list_button.cc
+++ b/ash/shelf/app_list_button.cc
@@ -50,11 +50,6 @@
constexpr uint8_t kVoiceInteractionRunningAlpha = 255; // 100% alpha
constexpr uint8_t kVoiceInteractionNotRunningAlpha = 138; // 54% alpha
-bool IsAssistantEnabled() {
- return chromeos::switches::IsVoiceInteractionEnabled() ||
- chromeos::switches::IsAssistantEnabled();
-}
-
bool IsTabletMode() {
return Shell::Get()
->tablet_mode_controller()
@@ -86,7 +81,7 @@
// session has already started. This could happen when an external monitor
// is plugged in.
if (Shell::Get()->session_controller()->IsActiveUserSessionStarted() &&
- IsAssistantEnabled()) {
+ chromeos::switches::IsAssistantEnabled()) {
InitializeVoiceInteractionOverlay();
}
}
@@ -159,12 +154,8 @@
event->SetHandled();
Shell::Get()->shell_state()->SetRootWindowForNewWindows(
GetWidget()->GetNativeWindow()->GetRootWindow());
- if (chromeos::switches::IsAssistantEnabled()) {
- Shell::Get()->assistant_controller()->ui_controller()->ShowUi(
- AssistantEntryPoint::kLongPressLauncher);
- } else {
- Shell::Get()->app_list_controller()->StartVoiceInteractionSession();
- }
+ Shell::Get()->assistant_controller()->ui_controller()->ShowUi(
+ AssistantEntryPoint::kLongPressLauncher);
} else {
Button::OnGestureEvent(event);
}
@@ -363,29 +354,13 @@
// Initialize voice interaction overlay when primary user session becomes
// active.
if (Shell::Get()->session_controller()->IsUserPrimary() &&
- !assistant_overlay_ && IsAssistantEnabled()) {
+ !assistant_overlay_ && chromeos::switches::IsAssistantEnabled()) {
InitializeVoiceInteractionOverlay();
}
}
void AppListButton::StartVoiceInteractionAnimation() {
- // We only show the voice interaction icon and related animation when the
- // shelf is at the bottom position and voice interaction is not running and
- // voice interaction setup flow has completed.
- ShelfAlignment alignment = shelf_->alignment();
- mojom::VoiceInteractionState state =
- Shell::Get()
- ->voice_interaction_controller()
- ->voice_interaction_state()
- .value_or(mojom::VoiceInteractionState::STOPPED);
- bool show_icon =
- (alignment == SHELF_ALIGNMENT_BOTTOM ||
- alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) &&
- state == mojom::VoiceInteractionState::STOPPED &&
- Shell::Get()->voice_interaction_controller()->setup_completed().value_or(
- false) &&
- chromeos::switches::IsVoiceInteractionEnabled();
- assistant_overlay_->StartAnimation(show_icon);
+ assistant_overlay_->StartAnimation(false);
}
bool AppListButton::UseVoiceInteractionStyle() {
diff --git a/ash/shelf/app_list_button_unittest.cc b/ash/shelf/app_list_button_unittest.cc
index 6ef010c..10ee645 100644
--- a/ash/shelf/app_list_button_unittest.cc
+++ b/ash/shelf/app_list_button_unittest.cc
@@ -8,6 +8,10 @@
#include <string>
#include "ash/app_list/test/app_list_test_helper.h"
+#include "ash/assistant/assistant_controller.h"
+#include "ash/assistant/assistant_ui_controller.h"
+#include "ash/assistant/model/assistant_ui_model.h"
+#include "ash/assistant/test/test_assistant_service.h"
#include "ash/root_window_controller.h"
#include "ash/session/session_controller.h"
#include "ash/shelf/shelf.h"
@@ -22,6 +26,7 @@
#include "base/run_loop.h"
#include "base/test/scoped_command_line.h"
#include "chromeos/constants/chromeos_switches.h"
+#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/events/test/event_generator.h"
namespace ash {
@@ -64,23 +69,6 @@
DISALLOW_COPY_AND_ASSIGN(AppListButtonTest);
};
-TEST_F(AppListButtonTest, LongPressGestureWithoutVoiceInteractionFlag) {
- // Simulate two user with primary user as active.
- CreateUserSessions(2);
-
- // Enable voice interaction in system settings.
- Shell::Get()->voice_interaction_controller()->NotifySettingsEnabled(true);
-
- ui::GestureEvent long_press =
- CreateGestureEvent(ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
- SendGestureEvent(&long_press);
- GetAppListTestHelper()->CheckVoiceSessionCount(0u);
-
- // Test long press gesture on secondary display.
- SendGestureEventToSecondaryDisplay(&long_press);
- GetAppListTestHelper()->CheckVoiceSessionCount(0u);
-}
-
TEST_F(AppListButtonTest, SwipeUpToOpenFullscreenAppList) {
Shelf* shelf = GetPrimaryShelf();
EXPECT_EQ(SHELF_ALIGNMENT_BOTTOM, shelf->alignment());
@@ -134,24 +122,30 @@
class VoiceInteractionAppListButtonTest : public AppListButtonTest {
public:
- VoiceInteractionAppListButtonTest() = default;
+ VoiceInteractionAppListButtonTest() {
+ feature_list_.InitAndEnableFeature(chromeos::switches::kAssistantFeature);
+ }
// AppListButtonTest:
void SetUp() override {
- command_line_ = std::make_unique<base::test::ScopedCommandLine>();
- command_line_->GetProcessCommandLine()->AppendSwitch(
- chromeos::switches::kEnableVoiceInteraction);
- EXPECT_TRUE(chromeos::switches::IsVoiceInteractionFlagsEnabled());
AppListButtonTest::SetUp();
+
+ Shell::Get()->assistant_controller()->SetAssistant(
+ assistant_.CreateInterfacePtrAndBind());
}
private:
std::unique_ptr<base::test::ScopedCommandLine> command_line_;
+ base::test::ScopedFeatureList feature_list_;
+ TestAssistantService assistant_;
+
DISALLOW_COPY_AND_ASSIGN(VoiceInteractionAppListButtonTest);
};
TEST_F(VoiceInteractionAppListButtonTest,
LongPressGestureWithVoiceInteractionFlag) {
+ ui::ScopedAnimationDurationScaleMode animation_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
// Simulate two user with primary user as active.
CreateUserSessions(2);
@@ -159,17 +153,29 @@
Shell::Get()->voice_interaction_controller()->NotifySettingsEnabled(true);
Shell::Get()->voice_interaction_controller()->NotifyFeatureAllowed(
mojom::AssistantAllowedState::ALLOWED);
+ Shell::Get()->voice_interaction_controller()->NotifyStatusChanged(
+ mojom::VoiceInteractionState::STOPPED);
ui::GestureEvent long_press =
CreateGestureEvent(ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
SendGestureEvent(&long_press);
GetAppListTestHelper()->WaitUntilIdle();
- GetAppListTestHelper()->CheckVoiceSessionCount(1u);
+ EXPECT_EQ(AssistantVisibility::kVisible, Shell::Get()
+ ->assistant_controller()
+ ->ui_controller()
+ ->model()
+ ->visibility());
+ Shell::Get()->assistant_controller()->ui_controller()->CloseUi(
+ AssistantExitPoint::kUnspecified);
// Test long press gesture on secondary display.
SendGestureEventToSecondaryDisplay(&long_press);
GetAppListTestHelper()->WaitUntilIdle();
- GetAppListTestHelper()->CheckVoiceSessionCount(2u);
+ EXPECT_EQ(AssistantVisibility::kVisible, Shell::Get()
+ ->assistant_controller()
+ ->ui_controller()
+ ->model()
+ ->visibility());
}
TEST_F(VoiceInteractionAppListButtonTest, LongPressGestureWithSecondaryUser) {
@@ -183,13 +189,20 @@
ui::GestureEvent long_press =
CreateGestureEvent(ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
SendGestureEvent(&long_press);
- // Voice interaction is disabled for secondary user, so the count here should
- // be 0.
- GetAppListTestHelper()->CheckVoiceSessionCount(0u);
+ // Voice interaction is disabled for secondary user.
+ EXPECT_NE(AssistantVisibility::kVisible, Shell::Get()
+ ->assistant_controller()
+ ->ui_controller()
+ ->model()
+ ->visibility());
// Test long press gesture on secondary display.
SendGestureEventToSecondaryDisplay(&long_press);
- GetAppListTestHelper()->CheckVoiceSessionCount(0u);
+ EXPECT_NE(AssistantVisibility::kVisible, Shell::Get()
+ ->assistant_controller()
+ ->ui_controller()
+ ->model()
+ ->visibility());
}
TEST_F(VoiceInteractionAppListButtonTest,
@@ -200,44 +213,25 @@
// Simulate a user who has already completed setup flow, but disabled voice
// interaction in settings.
Shell::Get()->voice_interaction_controller()->NotifySettingsEnabled(false);
- Shell::Get()->voice_interaction_controller()->NotifySetupCompleted(true);
Shell::Get()->voice_interaction_controller()->NotifyFeatureAllowed(
mojom::AssistantAllowedState::ALLOWED);
ui::GestureEvent long_press =
CreateGestureEvent(ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
SendGestureEvent(&long_press);
- // After value prop has been accepted, if voice interaction is disalbed in
- // settings we should not handle long press action in app list button.
- GetAppListTestHelper()->CheckVoiceSessionCount(0u);
+ EXPECT_NE(AssistantVisibility::kVisible, Shell::Get()
+ ->assistant_controller()
+ ->ui_controller()
+ ->model()
+ ->visibility());
// Test long press gesture on secondary display.
SendGestureEventToSecondaryDisplay(&long_press);
- GetAppListTestHelper()->CheckVoiceSessionCount(0u);
-}
-
-TEST_F(VoiceInteractionAppListButtonTest,
- LongPressGestureBeforeSetupCompleted) {
- // Simulate two user with primary user as active.
- CreateUserSessions(2);
-
- // Disable voice interaction in system settings.
- Shell::Get()->voice_interaction_controller()->NotifySettingsEnabled(false);
- Shell::Get()->voice_interaction_controller()->NotifyFeatureAllowed(
- mojom::AssistantAllowedState::ALLOWED);
-
- ui::GestureEvent long_press =
- CreateGestureEvent(ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
- SendGestureEvent(&long_press);
- GetAppListTestHelper()->WaitUntilIdle();
- // Before setup flow completed we should show the animation even if the
- // settings are disabled.
- GetAppListTestHelper()->CheckVoiceSessionCount(1u);
-
- // Test long press gesture on secondary display.
- SendGestureEventToSecondaryDisplay(&long_press);
- GetAppListTestHelper()->WaitUntilIdle();
- GetAppListTestHelper()->CheckVoiceSessionCount(2u);
+ EXPECT_NE(AssistantVisibility::kVisible, Shell::Get()
+ ->assistant_controller()
+ ->ui_controller()
+ ->model()
+ ->visibility());
}
} // namespace ash
diff --git a/ash/system/palette/palette_tool.cc b/ash/system/palette/palette_tool.cc
index de2d7da..4d6bb2e 100644
--- a/ash/system/palette/palette_tool.cc
+++ b/ash/system/palette/palette_tool.cc
@@ -24,8 +24,7 @@
tool_manager->AddTool(std::make_unique<CaptureRegionMode>(tool_manager));
tool_manager->AddTool(std::make_unique<CaptureScreenAction>(tool_manager));
tool_manager->AddTool(std::make_unique<CreateNoteAction>(tool_manager));
- if (chromeos::switches::IsVoiceInteractionEnabled() ||
- chromeos::switches::IsAssistantEnabled()) {
+ if (chromeos::switches::IsAssistantEnabled()) {
tool_manager->AddTool(std::make_unique<MetalayerMode>(tool_manager));
}
tool_manager->AddTool(std::make_unique<LaserPointerMode>(tool_manager));
diff --git a/ash/system/palette/palette_tray_unittest.cc b/ash/system/palette/palette_tray_unittest.cc
index b684180..3ecc10c 100644
--- a/ash/system/palette/palette_tray_unittest.cc
+++ b/ash/system/palette/palette_tray_unittest.cc
@@ -5,7 +5,10 @@
#include "ash/system/palette/palette_tray.h"
#include <memory>
+#include <string>
+#include "ash/assistant/assistant_controller.h"
+#include "ash/assistant/test/test_assistant_service.h"
#include "ash/highlighter/highlighter_controller.h"
#include "ash/highlighter/highlighter_controller_test_api.h"
#include "ash/public/cpp/ash_pref_names.h"
@@ -33,6 +36,7 @@
#include "chromeos/constants/chromeos_switches.h"
#include "components/prefs/pref_service.h"
#include "components/session_manager/session_manager_types.h"
+#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/display/test/display_manager_test_api.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/devices/stylus_state.h"
@@ -231,12 +235,11 @@
EXPECT_TRUE(test_api_->welcome_bubble()->GetBubbleViewForTesting());
}
-// Base class for tests that rely on voice interaction enabled.
+// Base class for tests that rely on Assistant enabled.
class PaletteTrayTestWithVoiceInteraction : public PaletteTrayTest {
public:
PaletteTrayTestWithVoiceInteraction() {
- base::CommandLine::ForCurrentProcess()->AppendSwitch(
- chromeos::switches::kEnableVoiceInteraction);
+ feature_list_.InitAndEnableFeature(chromeos::switches::kAssistantFeature);
}
~PaletteTrayTestWithVoiceInteraction() override = default;
@@ -254,6 +257,9 @@
highlighter_test_api_ = std::make_unique<HighlighterControllerTestApi>(
Shell::Get()->highlighter_controller());
+
+ Shell::Get()->assistant_controller()->SetAssistant(
+ assistant_.CreateInterfacePtrAndBind());
}
void TearDown() override {
@@ -319,7 +325,9 @@
std::unique_ptr<HighlighterControllerTestApi> highlighter_test_api_;
private:
+ TestAssistantService assistant_;
base::SimpleTestTickClock simulated_clock_;
+ base::test::ScopedFeatureList feature_list_;
DISALLOW_COPY_AND_ASSIGN(PaletteTrayTestWithVoiceInteraction);
};
@@ -330,6 +338,8 @@
}
TEST_F(PaletteTrayTestWithVoiceInteraction, MetalayerToolActivatesHighlighter) {
+ ui::ScopedAnimationDurationScaleMode animation_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
Shell::Get()->voice_interaction_controller()->NotifyStatusChanged(
mojom::VoiceInteractionState::RUNNING);
Shell::Get()->voice_interaction_controller()->NotifySettingsEnabled(true);
@@ -409,6 +419,8 @@
TEST_F(PaletteTrayTestWithVoiceInteraction,
StylusBarrelButtonActivatesHighlighter) {
+ ui::ScopedAnimationDurationScaleMode animation_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
Shell::Get()->voice_interaction_controller()->NotifyStatusChanged(
mojom::VoiceInteractionState::NOT_READY);
Shell::Get()->voice_interaction_controller()->NotifySettingsEnabled(false);
diff --git a/ash/system/palette/palette_welcome_bubble.cc b/ash/system/palette/palette_welcome_bubble.cc
index 4fc1ffc..474e6ac 100644
--- a/ash/system/palette/palette_welcome_bubble.cc
+++ b/ash/system/palette/palette_welcome_bubble.cc
@@ -4,6 +4,8 @@
#include "ash/system/palette/palette_welcome_bubble.h"
+#include <memory>
+
#include "ash/public/cpp/ash_pref_names.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/session/session_controller.h"
@@ -57,7 +59,7 @@
void Init() override {
SetLayoutManager(std::make_unique<views::FillLayout>());
auto* label = new views::Label(l10n_util::GetStringUTF16(
- chromeos::switches::IsVoiceInteractionEnabled()
+ chromeos::switches::IsAssistantEnabled()
? IDS_ASH_STYLUS_WARM_WELCOME_BUBBLE_WITH_ASSISTANT_DESCRIPTION
: IDS_ASH_STYLUS_WARM_WELCOME_BUBBLE_DESCRIPTION));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn
index 3ef1d4c..fe79978 100644
--- a/chrome/browser/chromeos/BUILD.gn
+++ b/chrome/browser/chromeos/BUILD.gn
@@ -569,12 +569,6 @@
"arc/user_session/arc_user_session_service.h",
"arc/video/gpu_arc_video_service_host.cc",
"arc/video/gpu_arc_video_service_host.h",
- "arc/voice_interaction/arc_voice_interaction_arc_home_service.cc",
- "arc/voice_interaction/arc_voice_interaction_arc_home_service.h",
- "arc/voice_interaction/arc_voice_interaction_framework_service.cc",
- "arc/voice_interaction/arc_voice_interaction_framework_service.h",
- "arc/voice_interaction/highlighter_controller_client.cc",
- "arc/voice_interaction/highlighter_controller_client.h",
"arc/voice_interaction/voice_interaction_controller_client.cc",
"arc/voice_interaction/voice_interaction_controller_client.h",
"arc/wallpaper/arc_wallpaper_service.cc",
@@ -1261,12 +1255,6 @@
"login/screens/user_image_view.h",
"login/screens/user_selection_screen.cc",
"login/screens/user_selection_screen.h",
- "login/screens/voice_interaction_value_prop_screen.cc",
- "login/screens/voice_interaction_value_prop_screen.h",
- "login/screens/voice_interaction_value_prop_screen_view.h",
- "login/screens/wait_for_container_ready_screen.cc",
- "login/screens/wait_for_container_ready_screen.h",
- "login/screens/wait_for_container_ready_screen_view.h",
"login/screens/welcome_screen.cc",
"login/screens/welcome_screen.h",
"login/screens/welcome_view.h",
@@ -2157,7 +2145,6 @@
"arc/policy/arc_policy_bridge_unittest.cc",
"arc/process/arc_process_unittest.cc",
"arc/tts/arc_tts_service_unittest.cc",
- "arc/voice_interaction/arc_voice_interaction_framework_service_unittest.cc",
"arc/voice_interaction/fake_voice_interaction_controller.cc",
"arc/voice_interaction/voice_interaction_controller_client_unittest.cc",
"arc/wallpaper/arc_wallpaper_service_unittest.cc",
diff --git a/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.cc b/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.cc
index 7aee95ff..e97e8e5 100644
--- a/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.cc
+++ b/chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.h"
+#include <string>
+
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
@@ -63,15 +65,13 @@
arc_session_manager_->RequestArcDataRemoval();
}
- // If the OOBE or Assistant Wizard screen is shown, don't kill the
- // mini-container. We'll do it if and when the user declines the TOS. We need
- // to check |is_play_store_enabled| to handle the case where |kArcEnabled| is
- // managed but some of the preferences still need to be set by the user.
+ // If the OOBE is shown, don't kill the mini-container. We'll do it if and
+ // when the user declines the TOS. We need to check |is_play_store_enabled| to
+ // handle the case where |kArcEnabled| is managed but some of the preferences
+ // still need to be set by the user.
// TODO(cmtm): This feature isn't covered by unittests. Add a unittest for it.
- if (!(IsArcOobeOptInActive() || IsArcOptInWizardForAssistantActive()) ||
- is_play_store_enabled) {
+ if (!IsArcOobeOptInActive() || is_play_store_enabled)
UpdateArcSessionManager();
- }
if (is_play_store_enabled)
return;
diff --git a/chrome/browser/chromeos/arc/arc_service_launcher.cc b/chrome/browser/chromeos/arc/arc_service_launcher.cc
index da57e48..7fb32d9 100644
--- a/chrome/browser/chromeos/arc/arc_service_launcher.cc
+++ b/chrome/browser/chromeos/arc/arc_service_launcher.cc
@@ -41,8 +41,6 @@
#include "chrome/browser/chromeos/arc/tts/arc_tts_service.h"
#include "chrome/browser/chromeos/arc/user_session/arc_user_session_service.h"
#include "chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h"
#include "chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/arc/arc_usb_host_permission_manager.h"
@@ -198,8 +196,6 @@
ArcUsbHostBridge::GetForBrowserContext(profile);
ArcUsbHostPermissionManager::GetForBrowserContext(profile);
ArcUserSessionService::GetForBrowserContext(profile);
- ArcVoiceInteractionArcHomeService::GetForBrowserContext(profile);
- ArcVoiceInteractionFrameworkService::GetForBrowserContext(profile);
ArcVolumeMounterBridge::GetForBrowserContext(profile);
ArcWakeLockBridge::GetForBrowserContext(profile);
ArcWallpaperService::GetForBrowserContext(profile);
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc
index 058fc678..b01f9133 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager.cc
+++ b/chrome/browser/chromeos/arc/arc_session_manager.cc
@@ -684,7 +684,7 @@
// the initial request.
// |prefs::kArcProvisioningInitiatedFromOobe| is reset when provisioning is
// done or ARC is opted out.
- if (IsArcOobeOptInActive() || IsArcOptInWizardForAssistantActive())
+ if (IsArcOobeOptInActive())
prefs->SetBoolean(prefs::kArcProvisioningInitiatedFromOobe, true);
// If it is marked that sign in has been successfully done or if Play Store is
@@ -828,7 +828,7 @@
return;
}
- if (IsArcOobeOptInActive() || IsArcOptInWizardForAssistantActive()) {
+ if (IsArcOobeOptInActive()) {
VLOG(1) << "Use OOBE negotiator.";
terms_of_service_negotiator_ =
std::make_unique<ArcTermsOfServiceOobeNegotiator>();
diff --git a/chrome/browser/chromeos/arc/arc_util.cc b/chrome/browser/chromeos/arc/arc_util.cc
index 0f78055..fc49aa6 100644
--- a/chrome/browser/chromeos/arc/arc_util.cc
+++ b/chrome/browser/chromeos/arc/arc_util.cc
@@ -438,14 +438,7 @@
// Use the legacy logic for first sign-in OOBE OptIn flow. Make sure the user
// is new.
- if (!user_manager::UserManager::Get()->IsCurrentUserNew())
- return false;
-
- // Differentiate the case when Assistant Wizard is started later for the new
- // user session. For example, OOBE was shown and user pressed Skip button.
- // Later in the same user session user activates Assistant and we show
- // Assistant Wizard with ARC terms. This case is not considered as OOBE OptIn.
- return !IsArcOptInWizardForAssistantActive();
+ return user_manager::UserManager::Get()->IsCurrentUserNew();
}
bool IsArcOobeOptInConfigurationBased() {
@@ -467,28 +460,6 @@
return auto_accept->GetBool();
}
-bool IsArcOptInWizardForAssistantActive() {
- // Check if Assistant Wizard is currently showing.
- // TODO(b/65861628): Redesign the OptIn flow since there is no longer reason
- // to have two different OptIn flows.
- chromeos::LoginDisplayHost* host = chromeos::LoginDisplayHost::default_host();
- if (!host || !host->IsVoiceInteractionOobe())
- return false;
-
- // Make sure the wizard controller is active and have the ARC ToS screen
- // showing for the voice interaction OptIn flow.
- const chromeos::WizardController* wizard_controller =
- host->GetWizardController();
- if (!wizard_controller)
- return false;
-
- const chromeos::BaseScreen* screen = wizard_controller->current_screen();
- if (!screen)
- return false;
- return screen->screen_id() ==
- chromeos::OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE;
-}
-
bool IsArcTermsOfServiceNegotiationNeeded(const Profile* profile) {
DCHECK(profile);
@@ -613,8 +584,7 @@
ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile(
const Profile* profile) {
- if (!chromeos::switches::IsAssistantEnabled() &&
- !chromeos::switches::IsVoiceInteractionFlagsEnabled()) {
+ if (!chromeos::switches::IsAssistantEnabled()) {
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_FLAG;
}
@@ -627,45 +597,28 @@
if (profile->IsLegacySupervised())
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_SUPERVISED_USER;
- if (chromeos::switches::IsVoiceInteractionFlagsEnabled()) {
- if (!chromeos::switches::IsVoiceInteractionLocalesSupported())
- return ash::mojom::AssistantAllowedState::DISALLOWED_BY_LOCALE;
-
- const PrefService* prefs = profile->GetPrefs();
- if (prefs->IsManagedPreference(prefs::kArcEnabled) &&
- !prefs->GetBoolean(prefs::kArcEnabled)) {
- return ash::mojom::AssistantAllowedState::DISALLOWED_BY_ARC_POLICY;
- }
-
- if (!IsArcAllowedForProfile(profile))
- return ash::mojom::AssistantAllowedState::DISALLOWED_BY_ARC_DISALLOWED;
- }
-
if (chromeos::DemoSession::IsDeviceInDemoMode())
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_DEMO_MODE;
if (user_manager::UserManager::Get()->IsLoggedInAsPublicAccount())
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_PUBLIC_SESSION;
- if (chromeos::switches::IsAssistantEnabled()) {
- const std::string kAllowedLocales[] = {ULOC_US, ULOC_UK, ULOC_CANADA,
- ULOC_CANADA_FRENCH};
+ const std::string kAllowedLocales[] = {ULOC_US, ULOC_UK, ULOC_CANADA,
+ ULOC_CANADA_FRENCH};
- const PrefService* prefs = profile->GetPrefs();
- std::string pref_locale =
- prefs->GetString(language::prefs::kApplicationLocale);
+ const PrefService* prefs = profile->GetPrefs();
+ std::string pref_locale =
+ prefs->GetString(language::prefs::kApplicationLocale);
- if (!pref_locale.empty()) {
- base::ReplaceChars(pref_locale, "-", "_", &pref_locale);
- bool disallowed = !base::ContainsValue(kAllowedLocales, pref_locale);
+ if (!pref_locale.empty()) {
+ base::ReplaceChars(pref_locale, "-", "_", &pref_locale);
+ bool disallowed = !base::ContainsValue(kAllowedLocales, pref_locale);
- if (disallowed &&
- base::CommandLine::ForCurrentProcess()
- ->GetSwitchValueASCII(
- chromeos::switches::kVoiceInteractionLocales)
- .find(pref_locale) == std::string::npos) {
- return ash::mojom::AssistantAllowedState::DISALLOWED_BY_LOCALE;
- }
+ if (disallowed && base::CommandLine::ForCurrentProcess()
+ ->GetSwitchValueASCII(
+ chromeos::switches::kVoiceInteractionLocales)
+ .find(pref_locale) == std::string::npos) {
+ return ash::mojom::AssistantAllowedState::DISALLOWED_BY_LOCALE;
}
}
diff --git a/chrome/browser/chromeos/arc/arc_util.h b/chrome/browser/chromeos/arc/arc_util.h
index 0f8982b..fe4b1cb 100644
--- a/chrome/browser/chromeos/arc/arc_util.h
+++ b/chrome/browser/chromeos/arc/arc_util.h
@@ -138,10 +138,6 @@
// Returns true if opt-in during ChromeOS OOBE is triggered by configuration.
bool IsArcOobeOptInConfigurationBased();
-// Returns true if OPA opt-in window is currently showing and active screen is
-// ARC ToS.
-bool IsArcOptInWizardForAssistantActive();
-
// Returns true if Terms of Service negotiation is needed. Otherwise false.
bool IsArcTermsOfServiceNegotiationNeeded(const Profile* profile);
diff --git a/chrome/browser/chromeos/arc/arc_util_unittest.cc b/chrome/browser/chromeos/arc/arc_util_unittest.cc
index aebae871..dc982ed 100644
--- a/chrome/browser/chromeos/arc/arc_util_unittest.cc
+++ b/chrome/browser/chromeos/arc/arc_util_unittest.cc
@@ -36,6 +36,7 @@
#include "chromeos/dbus/fake_oobe_configuration_client.h"
#include "components/account_id/account_id.h"
#include "components/arc/arc_prefs.h"
+#include "components/language/core/browser/pref_names.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/testing_pref_service.h"
@@ -170,6 +171,7 @@
void SetUp() override {
command_line_ = std::make_unique<base::test::ScopedCommandLine>();
+ feature_list_.InitAndEnableFeature(chromeos::switches::kAssistantFeature);
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
profile_manager_ = std::make_unique<TestingProfileManager>(
@@ -209,6 +211,7 @@
private:
std::unique_ptr<base::test::ScopedCommandLine> command_line_;
+ base::test::ScopedFeatureList feature_list_;
content::TestBrowserThreadBundle thread_bundle_;
chromeos::ScopedCrosSettingsTestHelper cros_settings_test_helper_;
base::ScopedTempDir data_dir_;
@@ -505,21 +508,7 @@
EXPECT_FALSE(IsArcPlayStoreEnabledPreferenceManagedForProfile(profile()));
}
-TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_Flag) {
- base::CommandLine::ForCurrentProcess()->InitFromArgv({
- "", "--arc-availability=officially-supported",
- });
- ScopedLogIn login(GetFakeUserManager(),
- AccountId::FromUserEmailGaiaId(
- profile()->GetProfileUserName(), kTestGaiaId));
- EXPECT_EQ(ash::mojom::AssistantAllowedState::DISALLOWED_BY_FLAG,
- IsAssistantAllowedForProfile(profile()));
-}
-
TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_SecondaryUser) {
- base::CommandLine::ForCurrentProcess()->InitFromArgv(
- {"", "--arc-availability=officially-supported",
- "--enable-voice-interaction"});
ScopedLogIn login2(
GetFakeUserManager(),
AccountId::FromUserEmailGaiaId("user2@gmail.com", "0123456789"));
@@ -532,9 +521,6 @@
}
TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_SupervisedUser) {
- base::CommandLine::ForCurrentProcess()->InitFromArgv(
- {"", "--arc-availability=officially-supported",
- "--enable-voice-interaction"});
ScopedLogIn login(GetFakeUserManager(),
AccountId::FromUserEmailGaiaId(
profile()->GetProfileUserName(), kTestGaiaId));
@@ -544,10 +530,8 @@
}
TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_Locale) {
- base::CommandLine::ForCurrentProcess()->InitFromArgv(
- {"", "--arc-availability=officially-supported",
- "--enable-voice-interaction"});
- base::test::ScopedRestoreICUDefaultLocale scoped_locale("he");
+ profile()->GetTestingPrefService()->SetString(
+ language::prefs::kApplicationLocale, "he");
ScopedLogIn login(GetFakeUserManager(),
AccountId::FromUserEmailGaiaId(
profile()->GetProfileUserName(), kTestGaiaId));
@@ -556,38 +540,7 @@
IsAssistantAllowedForProfile(profile()));
}
-TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_Managed) {
- base::CommandLine::ForCurrentProcess()->InitFromArgv(
- {"", "--arc-availability=officially-supported",
- "--enable-voice-interaction"});
- ScopedLogIn login(GetFakeUserManager(),
- AccountId::FromUserEmailGaiaId(
- profile()->GetProfileUserName(), kTestGaiaId));
- ASSERT_EQ(ash::mojom::AssistantAllowedState::ALLOWED,
- IsAssistantAllowedForProfile(profile()));
-
- profile()->GetTestingPrefService()->SetManagedPref(
- prefs::kArcEnabled, std::make_unique<base::Value>(false));
-
- EXPECT_EQ(ash::mojom::AssistantAllowedState::DISALLOWED_BY_ARC_POLICY,
- IsAssistantAllowedForProfile(profile()));
-
- profile()->GetTestingPrefService()->SetManagedPref(
- prefs::kArcEnabled, std::make_unique<base::Value>(true));
-
- EXPECT_EQ(ash::mojom::AssistantAllowedState::ALLOWED,
- IsAssistantAllowedForProfile(profile()));
-
- profile()->GetTestingPrefService()->RemoveManagedPref(prefs::kArcEnabled);
-
- EXPECT_EQ(ash::mojom::AssistantAllowedState::ALLOWED,
- IsAssistantAllowedForProfile(profile()));
-}
-
TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_DemoMode) {
- base::CommandLine::ForCurrentProcess()->InitFromArgv(
- {"", "--arc-availability=officially-supported",
- "--enable-voice-interaction"});
chromeos::DemoSession::SetDemoConfigForTesting(
chromeos::DemoSession::DemoModeConfig::kOnline);
ScopedLogIn login(GetFakeUserManager(),
@@ -601,9 +554,6 @@
}
TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_PublicSession) {
- base::CommandLine::ForCurrentProcess()->InitFromArgv(
- {"", "--arc-availability=officially-supported",
- "--enable-voice-interaction"});
ScopedLogIn login(GetFakeUserManager(),
AccountId::FromUserEmail(profile()->GetProfileUserName()),
user_manager::USER_TYPE_PUBLIC_ACCOUNT);
@@ -1080,56 +1030,6 @@
EXPECT_FALSE(IsArcOobeOptInActive());
}
-TEST_F(ArcOobeOpaOptInActiveInTest, NewUserAndAssistantWizard) {
- CreateLoginDisplayHost();
- GetFakeUserManager()->set_current_user_new(true);
- login_display_host()->StartVoiceInteractionOobe();
- login_display_host()->StartWizard(
- chromeos::OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE);
- EXPECT_FALSE(IsArcOobeOptInActive());
- EXPECT_TRUE(IsArcOptInWizardForAssistantActive());
-}
-
-// Emulate the following case.
-// Create a new profile on the device.
-// ARC OOBE ToS is expected to be shown, and the user "SKIP" it.
-// Then, the user tries to use Assistant. In such a case, ARC OOBE ToS wizard
-// is used unlike other scenarios to enable ARC during a session, which use
-// ArcSupport.
-// Because, IsArcOobeOptInActive() checks the UI state, this test checks if it
-// works expected for Assistant cases.
-TEST_F(ArcOobeOpaOptInActiveInTest, NoOobeOptInForPlayStoreNotAvailable) {
- // No OOBE OptIn when Play Store is not available.
- auto* command_line = base::CommandLine::ForCurrentProcess();
- command_line->InitFromArgv(
- {"", "--arc-availability=installed",
- "--arc-start-mode=always-start-with-no-play-store"});
- CreateLoginDisplayHost();
- GetFakeUserManager()->set_current_user_new(true);
- EXPECT_FALSE(IsArcOobeOptInActive());
-}
-
-TEST_F(ArcOobeOpaOptInActiveInTest, OptInWizardForAssistantActive) {
- // OPA OptIn is active when wizard is started and ARC ToS screen is currently
- // showing.
- EXPECT_FALSE(IsArcOptInWizardForAssistantActive());
- CreateLoginDisplayHost();
- EXPECT_FALSE(IsArcOptInWizardForAssistantActive());
- GetFakeUserManager()->set_current_user_new(true);
- EXPECT_FALSE(IsArcOptInWizardForAssistantActive());
- login_display_host()->StartVoiceInteractionOobe();
- EXPECT_FALSE(IsArcOptInWizardForAssistantActive());
- login_display_host()->StartWizard(
- chromeos::OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP);
- EXPECT_FALSE(IsArcOptInWizardForAssistantActive());
- login_display_host()->StartWizard(
- chromeos::OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE);
- EXPECT_TRUE(IsArcOptInWizardForAssistantActive());
- // Assistant wizard can be started for any user session.
- GetFakeUserManager()->set_current_user_new(false);
- EXPECT_TRUE(IsArcOptInWizardForAssistantActive());
-}
-
using DemoSetupFlowArcOptInTest = ArcOobeTest;
TEST_F(DemoSetupFlowArcOptInTest, NoTermsOfServiceOobeNegotiationNeeded) {
diff --git a/chrome/browser/chromeos/arc/voice_interaction/DEPS b/chrome/browser/chromeos/arc/voice_interaction/DEPS
deleted file mode 100644
index 7e420b4..0000000
--- a/chrome/browser/chromeos/arc/voice_interaction/DEPS
+++ /dev/null
@@ -1,6 +0,0 @@
-specific_include_rules = {
- "arc_voice_interaction_framework_service\.cc": [
- # TODO(mash): Fix. https://crbug.com/557397.
- "+ash/shell.h",
- ],
-}
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.cc b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.cc
deleted file mode 100644
index d92516c..0000000
--- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.cc
+++ /dev/null
@@ -1,317 +0,0 @@
-// Copyright 2017 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/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.h"
-
-#include <utility>
-#include <vector>
-
-#include "ash/public/cpp/scale_utility.h"
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/memory/singleton.h"
-#include "base/strings/string16.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h"
-#include "chrome/browser/chromeos/first_run/first_run.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h"
-#include "chrome/browser/ui/app_list/arc/arc_pai_starter.h"
-#include "chrome/browser/ui/ash/assistant/assistant_context_util.h"
-#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
-#include "chromeos/constants/chromeos_switches.h"
-#include "components/arc/arc_bridge_service.h"
-#include "components/arc/arc_browser_context_keyed_service_factory_base.h"
-#include "components/arc/arc_prefs.h"
-#include "components/arc/arc_service_manager.h"
-#include "components/arc/connection_holder.h"
-#include "components/prefs/pref_service.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/web_contents.h"
-#include "ui/accessibility/ax_assistant_structure.h"
-#include "ui/accessibility/mojom/ax_assistant_structure.mojom.h"
-#include "url/gurl.h"
-
-namespace arc {
-
-namespace {
-
-constexpr base::TimeDelta kAssistantStartedTimeout =
- base::TimeDelta::FromMinutes(1);
-constexpr base::TimeDelta kWizardCompletedTimeout =
- base::TimeDelta::FromMinutes(1);
-
-mojom::VoiceInteractionStructurePtr CreateVoiceInteractionStructure(
- const ui::AssistantTree& tree,
- const ui::AssistantNode& node) {
- auto structure = mojom::VoiceInteractionStructure::New();
- structure->text = node.text;
- structure->text_size = node.text_size;
-
- structure->bold = node.bold;
- structure->italic = node.italic;
- structure->underline = node.underline;
- structure->line_through = node.line_through;
- structure->color = node.color;
- structure->bgcolor = node.bgcolor;
-
- structure->role = node.role;
-
- structure->class_name = node.class_name;
- structure->rect = node.rect;
-
- if (node.selection.has_value()) {
- structure->selection =
- gfx::Range(node.selection->start(), node.selection->end());
- }
-
- for (int child : node.children_indices) {
- structure->children.push_back(
- CreateVoiceInteractionStructure(tree, *tree.nodes[child]));
- }
-
- return structure;
-}
-
-void RequestVoiceInteractionStructureCallback(
- ArcVoiceInteractionArcHomeService::GetVoiceInteractionStructureCallback
- callback,
- ax::mojom::AssistantExtraPtr assistant_extra,
- std::unique_ptr<ui::AssistantTree> assistant_tree) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- // The assist structure starts with 2 dummy nodes: Url node and title
- // node. Then we attach all nodes in view hierarchy.
- auto root = mojom::VoiceInteractionStructure::New();
- if (!assistant_tree || !assistant_extra) {
- std::move(callback).Run(std::move(root));
- return;
- }
-
- root->rect = assistant_extra->bounds_pixel;
- root->class_name = "android.view.dummy.root.WebUrl";
- root->text = base::UTF8ToUTF16(assistant_extra->url.spec());
-
- auto title_node = mojom::VoiceInteractionStructure::New();
- title_node->rect = gfx::Rect(assistant_extra->bounds_pixel.size());
- title_node->class_name = "android.view.dummy.WebTitle";
- title_node->text = assistant_extra->title;
-
- title_node->children.push_back(CreateVoiceInteractionStructure(
- *assistant_tree, *assistant_tree->nodes.front()));
- root->children.push_back(std::move(title_node));
- std::move(callback).Run(std::move(root));
-}
-
-// Singleton factory for ArcVoiceInteractionArcHomeService.
-class ArcVoiceInteractionArcHomeServiceFactory
- : public internal::ArcBrowserContextKeyedServiceFactoryBase<
- ArcVoiceInteractionArcHomeService,
- ArcVoiceInteractionArcHomeServiceFactory> {
- public:
- // Factory name used by ArcBrowserContextKeyedServiceFactoryBase.
- static constexpr const char* kName =
- "ArcVoiceInteractionArcHomeServiceFactory";
-
- static ArcVoiceInteractionArcHomeServiceFactory* GetInstance() {
- return base::Singleton<ArcVoiceInteractionArcHomeServiceFactory>::get();
- }
-
- private:
- friend base::DefaultSingletonTraits<ArcVoiceInteractionArcHomeServiceFactory>;
-
- ArcVoiceInteractionArcHomeServiceFactory() {
- DependsOn(ArcAppListPrefsFactory::GetInstance());
- DependsOn(ArcVoiceInteractionFrameworkService::GetFactory());
- }
- ~ArcVoiceInteractionArcHomeServiceFactory() override = default;
-
- // BrowserContextKeyedServiceFactory override:
- KeyedService* BuildServiceInstanceFor(
- content::BrowserContext* context) const override {
- if (!chromeos::switches::IsVoiceInteractionEnabled())
- return nullptr;
- return ArcBrowserContextKeyedServiceFactoryBase::BuildServiceInstanceFor(
- context);
- }
-};
-
-} // namespace
-
-// static
-const char ArcVoiceInteractionArcHomeService::kAssistantPackageName[] =
- "com.google.android.googlequicksearchbox";
-
-// static
-ArcVoiceInteractionArcHomeService*
-ArcVoiceInteractionArcHomeService::GetForBrowserContext(
- content::BrowserContext* context) {
- return ArcVoiceInteractionArcHomeServiceFactory::GetForBrowserContext(
- context);
-}
-
-ArcVoiceInteractionArcHomeService::ArcVoiceInteractionArcHomeService(
- content::BrowserContext* context,
- ArcBridgeService* bridge_service)
- : context_(context),
- arc_bridge_service_(bridge_service),
- assistant_started_timeout_(kAssistantStartedTimeout),
- wizard_completed_timeout_(kWizardCompletedTimeout) {
- arc_bridge_service_->voice_interaction_arc_home()->SetHost(this);
- arc_bridge_service_->voice_interaction_arc_home()->AddObserver(this);
- ArcSessionManager::Get()->AddObserver(this);
-}
-
-ArcVoiceInteractionArcHomeService::~ArcVoiceInteractionArcHomeService() =
- default;
-
-void ArcVoiceInteractionArcHomeService::Shutdown() {
- ResetTimeouts();
- arc_bridge_service_->voice_interaction_arc_home()->RemoveObserver(this);
- arc_bridge_service_->voice_interaction_arc_home()->SetHost(nullptr);
- ArcSessionManager::Get()->RemoveObserver(this);
-}
-
-void ArcVoiceInteractionArcHomeService::OnArcPlayStoreEnabledChanged(
- bool enabled) {
- if (!pending_pai_lock_)
- return;
-
- pending_pai_lock_ = false;
- LockPai();
-}
-
-void ArcVoiceInteractionArcHomeService::LockPai() {
- ResetTimeouts();
- arc::ArcPaiStarter* pai_starter =
- arc::ArcSessionManager::Get()->pai_starter();
- if (!pai_starter) {
- DLOG(ERROR) << "There is no PAI starter.";
- // We could be starting before ARC session is started when user initiated
- // voice interaction first before ARC is enabled. We will remember this
- // and wait for ARC session started to try locking again.
- pending_pai_lock_ = true;
- return;
- }
- pai_starter->AcquireLock();
-}
-
-void ArcVoiceInteractionArcHomeService::UnlockPai() {
- ResetTimeouts();
- arc::ArcPaiStarter* pai_starter =
- arc::ArcSessionManager::Get()->pai_starter();
- if (!pai_starter || !pai_starter->locked())
- return;
- pai_starter->ReleaseLock();
-}
-
-void ArcVoiceInteractionArcHomeService::OnAssistantStarted() {
- VLOG(1) << "Assistant flow started";
- LockPai();
-}
-
-void ArcVoiceInteractionArcHomeService::OnAssistantAppRequested() {
- VLOG(1) << "Assistant app start request";
-
- ResetTimeouts();
-
- ArcAppListPrefs::Get(context_)->AddObserver(this);
-
- assistant_started_timer_.Start(
- FROM_HERE, assistant_started_timeout_,
- base::Bind(&ArcVoiceInteractionArcHomeService::OnAssistantStartTimeout,
- base::Unretained(this)));
-}
-
-void ArcVoiceInteractionArcHomeService::OnAssistantCanceled() {
- VLOG(1) << "Assistant flow canceled";
- UnlockPai();
-}
-
-void ArcVoiceInteractionArcHomeService::OnTaskCreated(
- int32_t task_id,
- const std::string& package_name,
- const std::string& activity,
- const std::string& intent) {
- if (package_name != kAssistantPackageName)
- return;
-
- VLOG(1) << "Assistant app created";
-
- DCHECK_EQ(-1, assistant_task_id_);
- assistant_task_id_ = task_id;
- assistant_started_timer_.Stop();
-}
-
-void ArcVoiceInteractionArcHomeService::OnTaskDestroyed(int32_t task_id) {
- if (task_id != assistant_task_id_)
- return;
-
- VLOG(1) << "Assistant app exited";
-
- ResetTimeouts();
- wizard_completed_timer_.Start(
- FROM_HERE, wizard_completed_timeout_,
- base::Bind(&ArcVoiceInteractionArcHomeService::OnWizardCompleteTimeout,
- base::Unretained(this)));
-}
-
-void ArcVoiceInteractionArcHomeService::ResetTimeouts() {
- ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(context_);
- if (arc_prefs)
- arc_prefs->RemoveObserver(this);
-
- assistant_started_timer_.Stop();
- wizard_completed_timer_.Stop();
-}
-
-void ArcVoiceInteractionArcHomeService::OnAssistantStartTimeout() {
- LOG(WARNING) << "Failed to start Assistant app.";
- UnlockPai();
-}
-
-void ArcVoiceInteractionArcHomeService::OnWizardCompleteTimeout() {
- LOG(WARNING) << "Assistant app was not completed successfully.";
- UnlockPai();
-}
-
-void ArcVoiceInteractionArcHomeService::OnConnectionClosed() {
- VLOG(1) << "Voice interaction instance is closed.";
- UnlockPai();
-}
-
-void ArcVoiceInteractionArcHomeService::GetVoiceInteractionStructure(
- GetVoiceInteractionStructureCallback callback) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- PrefService* prefs = Profile::FromBrowserContext(context_)->GetPrefs();
- auto* framework_service =
- ArcVoiceInteractionFrameworkService::GetForBrowserContext(context_);
- if (!framework_service->ValidateTimeSinceUserInteraction() ||
- !prefs->GetBoolean(prefs::kVoiceInteractionEnabled) ||
- !prefs->GetBoolean(prefs::kVoiceInteractionContextEnabled)) {
- std::move(callback).Run(mojom::VoiceInteractionStructure::New());
- return;
- }
-
- RequestAssistantStructureForActiveBrowserWindow(base::BindOnce(
- &RequestVoiceInteractionStructureCallback, std::move(callback)));
-}
-
-void ArcVoiceInteractionArcHomeService::OnVoiceInteractionOobeSetupComplete() {
- VLOG(1) << "Assistant wizard is completed.";
- UnlockPai();
- chromeos::first_run::MaybeLaunchDialogImmediately();
-}
-
-// static
-mojom::VoiceInteractionStructurePtr
-ArcVoiceInteractionArcHomeService::CreateVoiceInteractionStructureForTesting(
- const ui::AssistantTree& tree,
- const ui::AssistantNode& node) {
- return CreateVoiceInteractionStructure(tree, node);
-}
-
-} // namespace arc
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.h b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.h
deleted file mode 100644
index 7ed239d3..0000000
--- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_ARC_VOICE_INTERACTION_ARC_VOICE_INTERACTION_ARC_HOME_SERVICE_H_
-#define CHROME_BROWSER_CHROMEOS_ARC_VOICE_INTERACTION_ARC_VOICE_INTERACTION_ARC_HOME_SERVICE_H_
-
-#include <string>
-
-#include "base/macros.h"
-#include "base/timer/timer.h"
-#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
-#include "components/arc/common/voice_interaction_arc_home.mojom.h"
-#include "components/arc/connection_observer.h"
-#include "components/keyed_service/core/keyed_service.h"
-#include "ui/accessibility/ax_tree_update.h"
-
-namespace content {
-class BrowserContext;
-} // namespace content
-
-namespace ui {
-struct AssistantTree;
-struct AssistantNode;
-} // namespace ui
-
-namespace arc {
-
-class ArcBridgeService;
-
-// ArcVoiceInteractionArcHomeService provides view hierarchy to to ARC to be
-// used by VoiceInteractionSession. This class lives on the UI thread.
-class ArcVoiceInteractionArcHomeService
- : public KeyedService,
- public mojom::VoiceInteractionArcHomeHost,
- public ConnectionObserver<mojom::VoiceInteractionArcHomeInstance>,
- public ArcAppListPrefs::Observer,
- public ArcSessionManager::Observer {
- public:
- // Returns singleton instance for the given BrowserContext,
- // or nullptr if the browser |context| is not allowed to use ARC.
- static ArcVoiceInteractionArcHomeService* GetForBrowserContext(
- content::BrowserContext* context);
-
- static const char kAssistantPackageName[];
-
- ArcVoiceInteractionArcHomeService(content::BrowserContext* context,
- ArcBridgeService* bridge_service);
- ~ArcVoiceInteractionArcHomeService() override;
-
- // Notifies that assistant flow has been started and we have to lock PAI.
- void OnAssistantStarted();
- // Notifies that assistant flow expects Android assistant app started.
- void OnAssistantAppRequested();
- // Notifies that assistant flow has been canceled.
- void OnAssistantCanceled();
-
- // KeyedService overrides:
- void Shutdown() override;
-
- // ConnectionObserver<mojom::VoiceInteractionArcHomeInstance> overrides;
- void OnConnectionClosed() override;
-
- // Gets view hierarchy from current focused app and send it to ARC.
- void GetVoiceInteractionStructure(
- GetVoiceInteractionStructureCallback callback) override;
- void OnVoiceInteractionOobeSetupComplete() override;
-
- static mojom::VoiceInteractionStructurePtr
- CreateVoiceInteractionStructureForTesting(const ui::AssistantTree& tree,
- const ui::AssistantNode& node);
-
- void set_assistant_started_timeout_for_testing(
- const base::TimeDelta& timeout) {
- assistant_started_timeout_ = timeout;
- }
-
- void set_wizard_completed_timeout_for_testing(
- const base::TimeDelta& timeout) {
- wizard_completed_timeout_ = timeout;
- }
-
- private:
- // ArcAppListPrefs::Observer:
- void OnTaskCreated(int32_t task_id,
- const std::string& package_name,
- const std::string& activity,
- const std::string& intent) override;
- void OnTaskDestroyed(int32_t task_id) override;
-
- // ArcSessionManager::Observer:
- void OnArcPlayStoreEnabledChanged(bool enabled) override;
-
- // Locks/Unlocks Play Auto Install.
- void LockPai();
- void UnlockPai();
-
- // Resets all optional timeouts and observers.
- void ResetTimeouts();
- // Callback to handle timeout of waiting assistant Android app to start.
- void OnAssistantStartTimeout();
- // Callback to handle timeout of waiting wizard to complete.
- void OnWizardCompleteTimeout();
-
- content::BrowserContext* const context_;
- ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager.
-
- int32_t assistant_task_id_ = -1;
- // Waits until assistant is actually started.
- base::OneShotTimer assistant_started_timer_;
- base::TimeDelta assistant_started_timeout_;
-
- // Waits for wizard completed notification.
- base::OneShotTimer wizard_completed_timer_;
- base::TimeDelta wizard_completed_timeout_;
-
- // Whether there is a pending request to lock PAI before it's available.
- bool pending_pai_lock_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(ArcVoiceInteractionArcHomeService);
-};
-
-} // namespace arc
-#endif // CHROME_BROWSER_CHROMEOS_ARC_VOICE_INTERACTION_ARC_VOICE_INTERACTION_ARC_HOME_SERVICE_H_
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service_browsertest.cc b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service_browsertest.cc
deleted file mode 100644
index d597a82..0000000
--- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service_browsertest.cc
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright 2017 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/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.h"
-
-#include <string>
-#include <vector>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/run_loop.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/test/base/in_process_browser_test.h"
-#include "chrome/test/base/interactive_test_utils.h"
-#include "content/public/test/browser_test.h"
-#include "content/public/test/test_utils.h"
-#include "ui/accessibility/ax_assistant_structure.h"
-#include "ui/accessibility/ax_tree_update.h"
-
-namespace arc {
-
-namespace {
-
-class AXTreeSnapshotWaiter {
- public:
- AXTreeSnapshotWaiter() = default;
-
- void Wait() { loop_.Run(); }
-
- const ui::AXTreeUpdate& snapshot() const { return snapshot_; }
-
- void ReceiveSnapshot(const ui::AXTreeUpdate& snapshot) {
- snapshot_ = snapshot;
- loop_.Quit();
- }
-
- private:
- ui::AXTreeUpdate snapshot_;
- base::RunLoop loop_;
-
- DISALLOW_COPY_AND_ASSIGN(AXTreeSnapshotWaiter);
-};
-
-} // namespace
-
-class ArcVoiceInteractionArcHomeServiceTest : public InProcessBrowserTest {
- public:
- ArcVoiceInteractionArcHomeServiceTest() = default;
- ~ArcVoiceInteractionArcHomeServiceTest() override = default;
-
- protected:
- mojom::VoiceInteractionStructurePtr GetVoiceInteractionStructure(
- const std::string& html) {
- GURL url("data:text/html," + html);
- ui_test_utils::NavigateToURL(browser(), url);
- auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents();
- AXTreeSnapshotWaiter waiter;
- web_contents->RequestAXTreeSnapshot(
- base::BindOnce(&AXTreeSnapshotWaiter::ReceiveSnapshot,
- base::Unretained(&waiter)),
- ui::kAXModeComplete);
- waiter.Wait();
- std::unique_ptr<ui::AssistantTree> tree =
- ui::CreateAssistantTree(waiter.snapshot(), false);
-
- return ArcVoiceInteractionArcHomeService::
- CreateVoiceInteractionStructureForTesting(*tree, *tree->nodes.front());
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ArcVoiceInteractionArcHomeServiceTest);
-};
-
-IN_PROC_BROWSER_TEST_F(ArcVoiceInteractionArcHomeServiceTest,
- VoiceInteractionStructurePositionTest) {
- auto result = GetVoiceInteractionStructure(
- "<div style='position:absolute;width:200px;height:200px'>"
- "<p style='position:absolute;top:20px;left:20px;margin:0'>Hello</p>"
- "</div>");
- ASSERT_FALSE(result.is_null());
- ASSERT_EQ(result->children.size(), 1ul);
- ASSERT_EQ(result->children[0]->children.size(), 1ul);
-
- auto& child = result->children[0]->children[0];
- ASSERT_EQ(base::UTF16ToUTF8(child->text), "Hello");
- ASSERT_EQ(child->rect.x(), 20);
- ASSERT_EQ(child->rect.y(), 20);
-}
-
-IN_PROC_BROWSER_TEST_F(ArcVoiceInteractionArcHomeServiceTest,
- VoiceInteractionStructureInputSelectionTest) {
- auto result = GetVoiceInteractionStructure(
- "<html>"
- " <body>"
- " <input id='input' value='Hello, world'/>"
- " <script type='text/javascript'>"
- " var input = document.getElementById('input');"
- " input.select();"
- " input.selectionStart = 0;"
- " input.selectionEnd = 5;"
- " </script>"
- " </body>"
- "</html>");
- auto& content_root = result->children[0];
- ASSERT_EQ(content_root->children.size(), 1ul);
- auto& child = content_root->children[0];
- ASSERT_FALSE(child.is_null());
- ASSERT_EQ(base::UTF16ToUTF8(child->text), "Hello, world");
- EXPECT_EQ(gfx::Range(0, 5), child->selection);
-}
-
-IN_PROC_BROWSER_TEST_F(ArcVoiceInteractionArcHomeServiceTest,
- VoiceInteractionStructureSectionTest) {
- // Help ensure accessibility states are tested correctly.
- // When the states are not tested correctly (bit shifted), the div appears to
- // be focusable, causing the child text to be aggregated for the div.
- auto result = GetVoiceInteractionStructure(
- "<div role='section' aria-expanded='false'>"
- "Hello<img>"
- "</div>");
- ASSERT_FALSE(result.is_null());
-
- auto& child = result->children[0];
- ASSERT_EQ(base::UTF16ToUTF8(child->text), "");
-}
-
-IN_PROC_BROWSER_TEST_F(ArcVoiceInteractionArcHomeServiceTest,
- VoiceInteractionStructureSelectTest) {
- // Help ensure accessibility states are tested correctly.
- // When the states are not tested correctly (bit shifted), the option appears
- // to have ax::mojom::State::kProtected, and text is incorrectly set as
- // password dots.
- auto result = GetVoiceInteractionStructure(
- "<div><select><option>1</option></select></div>");
- ASSERT_FALSE(result.is_null());
-
- auto& child = result->children[0];
- ASSERT_EQ(base::UTF16ToUTF8(child->text), "");
- ASSERT_EQ(base::UTF16ToUTF8(child->children[0]->text), "1");
-}
-
-// Flaky on chromeos: http://crbug.com/870319
-#if defined(OS_CHROMEOS)
-#define MAYBE_VoiceInteractionStructureMultipleSelectionTest \
- DISABLED_VoiceInteractionStructureMultipleSelectionTest
-#else
-#define MAYBE_VoiceInteractionStructureMultipleSelectionTest \
- VoiceInteractionStructureMultipleSelectionTest
-#endif
-IN_PROC_BROWSER_TEST_F(ArcVoiceInteractionArcHomeServiceTest,
- MAYBE_VoiceInteractionStructureMultipleSelectionTest) {
- auto result = GetVoiceInteractionStructure(
- "<html>"
- " <body>"
- " <b id='node1'>foo</b><b>middle</b><b id='node2'>bar</b>"
- " <script type='text/javascript'>"
- " var element1 = document.getElementById('node1');"
- " var node1 = element1.childNodes.item(0);"
- " var range=document.createRange();"
- " range.setStart(node1, 1);"
- " var element2 = document.getElementById('node2');"
- " var node2 = element2.childNodes.item(0);"
- " range.setEnd(node2, 1);"
- " var selection=window.getSelection();"
- " selection.removeAllRanges();"
- " selection.addRange(range);"
- " </script>"
- " </body>"
- "</html>");
- ASSERT_EQ(result->children.size(), 1ul);
- auto& content_root = result->children[0];
- ASSERT_EQ(content_root->children.size(), 3ul);
-
- auto& grand_child1 = content_root->children[0];
- EXPECT_EQ(gfx::Range(1, 3), grand_child1->selection);
-
- auto& grand_child2 = content_root->children[1];
- EXPECT_EQ(gfx::Range(0, 6), grand_child2->selection);
-
- auto& grand_child3 = content_root->children[2];
- EXPECT_EQ(gfx::Range(0, 1), grand_child3->selection);
-}
-
-} // namespace arc
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
deleted file mode 100644
index 0927fdff..0000000
--- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.cc
+++ /dev/null
@@ -1,611 +0,0 @@
-// Copyright 2017 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/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h"
-
-#include <utility>
-#include <vector>
-
-#include "ash/public/cpp/shell_window_ids.h"
-#include "ash/shell.h"
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/command_line.h"
-#include "base/containers/flat_set.h"
-#include "base/logging.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/singleton.h"
-#include "base/metrics/histogram_macros.h"
-#include "base/metrics/user_metrics.h"
-#include "base/metrics/user_metrics_action.h"
-#include "base/task/post_task.h"
-#include "chrome/browser/chromeos/arc/arc_util.h"
-#include "chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/highlighter_controller_client.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.h"
-#include "chrome/browser/chromeos/login/helper.h"
-#include "chrome/browser/chromeos/login/ui/login_display_host_webui.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
-#include "chrome/common/pref_names.h"
-#include "chromeos/constants/chromeos_switches.h"
-#include "components/arc/arc_bridge_service.h"
-#include "components/arc/arc_browser_context_keyed_service_factory_base.h"
-#include "components/arc/arc_prefs.h"
-#include "components/arc/arc_util.h"
-#include "components/arc/connection_holder.h"
-#include "components/session_manager/core/session_manager.h"
-#include "content/public/browser/browser_thread.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/window.h"
-#include "ui/base/ui_base_features.h"
-#include "ui/compositor/layer.h"
-#include "ui/compositor/layer_owner.h"
-#include "ui/compositor/layer_tree_owner.h"
-#include "ui/gfx/codec/jpeg_codec.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/image/image.h"
-#include "ui/gfx/image/image_util.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/snapshot/snapshot.h"
-#include "ui/snapshot/snapshot_aura.h"
-#include "ui/wm/core/window_util.h"
-#include "ui/wm/public/activation_client.h"
-
-namespace mojo {
-
-// Map VoiceInteractionState from arc::mojom into ash::mojom. The duplicate
-// definition is because we do not want to use extensible widely.
-// (crbug.com/731893).
-template <>
-struct TypeConverter<ash::mojom::VoiceInteractionState,
- arc::mojom::VoiceInteractionState> {
- static ash::mojom::VoiceInteractionState Convert(
- arc::mojom::VoiceInteractionState state) {
- switch (state) {
- case arc::mojom::VoiceInteractionState::NOT_READY:
- return ash::mojom::VoiceInteractionState::NOT_READY;
- case arc::mojom::VoiceInteractionState::STOPPED:
- return ash::mojom::VoiceInteractionState::STOPPED;
- case arc::mojom::VoiceInteractionState::RUNNING:
- return ash::mojom::VoiceInteractionState::RUNNING;
- }
-
- NOTREACHED() << "Invalid state: " << static_cast<int>(state);
- return ash::mojom::VoiceInteractionState::NOT_READY;
- }
-};
-
-} // namespace mojo
-
-namespace arc {
-
-namespace {
-
-using LayerSet = base::flat_set<const ui::Layer*>;
-
-// Time out for a context query from container since user initiated
-// interaction. This must be strictly less than
-// kMaxTimeSinceUserInteractionForHistogram so that the histogram
-// could cover the range of normal operations.
-constexpr base::TimeDelta kAllowedTimeSinceUserInteraction =
- base::TimeDelta::FromSeconds(2);
-constexpr base::TimeDelta kMaxTimeSinceUserInteractionForHistogram =
- base::TimeDelta::FromSeconds(5);
-
-constexpr int32_t kContextRequestMaxRemainingCount = 2;
-
-std::unique_ptr<ui::LayerTreeOwner> CreateLayerTreeForSnapshot(
- aura::Window* root_window) {
- LayerSet blocked_layers;
- for (auto* browser : *BrowserList::GetInstance()) {
- if (browser->profile()->IsOffTheRecord())
- blocked_layers.insert(browser->window()->GetNativeWindow()->layer());
- }
-
- LayerSet excluded_layers;
- // Exclude metalayer-related layers. This will also include other layers
- // under kShellWindowId_OverlayContainer which is fine.
- // TODO(crbug.com/757012): Mash support.
- if (!features::IsMultiProcessMash()) {
- aura::Window* overlay_container = ash::Shell::GetContainer(
- root_window, ash::kShellWindowId_OverlayContainer);
- if (overlay_container != nullptr)
- excluded_layers.insert(overlay_container->layer());
- }
-
- auto layer_tree_owner = ::wm::RecreateLayersWithClosure(
- root_window, base::BindRepeating(
- [](LayerSet blocked_layers, LayerSet excluded_layers,
- ui::LayerOwner* owner) -> std::unique_ptr<ui::Layer> {
- // Parent layer is excluded meaning that it's pointless
- // to clone current child and all its descendants. This
- // reduces the number of layers to create.
- if (blocked_layers.count(owner->layer()->parent()))
- return nullptr;
- if (blocked_layers.count(owner->layer())) {
- auto layer = std::make_unique<ui::Layer>(
- ui::LayerType::LAYER_SOLID_COLOR);
- layer->SetBounds(owner->layer()->bounds());
- layer->SetColor(SK_ColorBLACK);
- return layer;
- }
- if (excluded_layers.count(owner->layer()))
- return nullptr;
- return owner->RecreateLayer();
- },
- std::move(blocked_layers), std::move(excluded_layers)));
-
- // layer_tree_owner cannot be null since we are starting off from the root
- // window, which could never be incognito.
- DCHECK(layer_tree_owner);
-
- auto* root_layer = layer_tree_owner->root();
- // The root layer might have a scaling transform applied (if the user has
- // changed the UI scale via Ctrl-Shift-Plus/Minus).
- // Clear the transform so that the snapshot is taken at 1:1 scale relative
- // to screen pixels.
- root_layer->SetTransform(gfx::Transform());
- root_window->layer()->Add(root_layer);
- root_window->layer()->StackAtBottom(root_layer);
- return layer_tree_owner;
-}
-
-void EncodeAndReturnImage(
- ArcVoiceInteractionFrameworkService::CaptureFullscreenCallback callback,
- std::unique_ptr<ui::LayerTreeOwner> old_layer_owner,
- gfx::Image image) {
- old_layer_owner.reset();
- base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE,
- base::TaskTraits{base::MayBlock(), base::TaskPriority::USER_BLOCKING},
- // We use SkBitmap here to avoid passing in gfx::Image directly, which
- // shares a single gfx::ImageStorage that's not threadsafe.
- // Alternatively, we could also pass in |image| with std::move().
- base::BindOnce(
- [](SkBitmap image) -> std::vector<uint8_t> {
- std::vector<uint8_t> res;
- gfx::JPEGCodec::Encode(image, 100, &res);
- return res;
- },
- image.AsBitmap()),
- std::move(callback));
-}
-
-// Singleton factory for ArcVoiceInteractionFrameworkService.
-class ArcVoiceInteractionFrameworkServiceFactory
- : public internal::ArcBrowserContextKeyedServiceFactoryBase<
- ArcVoiceInteractionFrameworkService,
- ArcVoiceInteractionFrameworkServiceFactory> {
- public:
- // Factory name used by ArcBrowserContextKeyedServiceFactoryBase.
- static constexpr const char* kName =
- "ArcVoiceInteractionFrameworkServiceFactory";
-
- static ArcVoiceInteractionFrameworkServiceFactory* GetInstance() {
- return base::Singleton<ArcVoiceInteractionFrameworkServiceFactory>::get();
- }
-
- private:
- friend base::DefaultSingletonTraits<
- ArcVoiceInteractionFrameworkServiceFactory>;
- ArcVoiceInteractionFrameworkServiceFactory() = default;
- ~ArcVoiceInteractionFrameworkServiceFactory() override = default;
-
- // BrowserContextKeyedServiceFactory override:
- KeyedService* BuildServiceInstanceFor(
- content::BrowserContext* context) const override {
- if (!chromeos::switches::IsVoiceInteractionEnabled())
- return nullptr;
- return ArcBrowserContextKeyedServiceFactoryBase::BuildServiceInstanceFor(
- context);
- }
-};
-
-} // namespace
-
-// static
-ArcVoiceInteractionFrameworkService*
-ArcVoiceInteractionFrameworkService::GetForBrowserContext(
- content::BrowserContext* context) {
- return ArcVoiceInteractionFrameworkServiceFactory::GetForBrowserContext(
- context);
-}
-
-KeyedServiceBaseFactory* ArcVoiceInteractionFrameworkService::GetFactory() {
- return ArcVoiceInteractionFrameworkServiceFactory::GetInstance();
-}
-
-ArcVoiceInteractionFrameworkService::ArcVoiceInteractionFrameworkService(
- content::BrowserContext* context,
- ArcBridgeService* bridge_service)
- : context_(context),
- arc_bridge_service_(bridge_service),
- highlighter_client_(std::make_unique<HighlighterControllerClient>(this)),
- weak_ptr_factory_(this) {
- arc_bridge_service_->voice_interaction_framework()->SetHost(this);
- arc_bridge_service_->voice_interaction_framework()->AddObserver(this);
- ArcSessionManager::Get()->AddObserver(this);
- chromeos::CrasAudioHandler::Get()->AddAudioObserver(this);
-}
-
-ArcVoiceInteractionFrameworkService::~ArcVoiceInteractionFrameworkService() {
- chromeos::CrasAudioHandler::Get()->RemoveAudioObserver(this);
- ArcSessionManager::Get()->RemoveObserver(this);
- arc_bridge_service_->voice_interaction_framework()->RemoveObserver(this);
- arc_bridge_service_->voice_interaction_framework()->SetHost(nullptr);
-}
-
-void ArcVoiceInteractionFrameworkService::OnConnectionReady() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- if (is_request_pending_) {
- is_request_pending_ = false;
- if (is_pending_request_toggle_) {
- mojom::VoiceInteractionFrameworkInstance* framework_instance =
- ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- ToggleVoiceInteractionSession);
- DCHECK(framework_instance);
- framework_instance->ToggleVoiceInteractionSession(IsHomescreenActive());
- } else {
- mojom::VoiceInteractionFrameworkInstance* framework_instance =
- ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- StartVoiceInteractionSession);
- DCHECK(framework_instance);
- framework_instance->StartVoiceInteractionSession(IsHomescreenActive());
- }
- }
-
- highlighter_client_->Attach();
-}
-
-void ArcVoiceInteractionFrameworkService::OnConnectionClosed() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- highlighter_client_->Detach();
-}
-
-void ArcVoiceInteractionFrameworkService::CaptureFullscreen(
- CaptureFullscreenCallback callback) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- if (!ValidateTimeSinceUserInteraction()) {
- std::move(callback).Run(std::vector<uint8_t>{});
- return;
- }
-
- // Since ARC currently only runs in primary display, we restrict
- // the screenshot to it.
- // TODO(crbug.com/757012): Mash support.
- if (features::IsMultiProcessMash()) {
- std::move(callback).Run(std::vector<uint8_t>{});
- return;
- }
- aura::Window* window = ash::Shell::GetPrimaryRootWindow();
- DCHECK(window);
-
- auto old_layer_owner = CreateLayerTreeForSnapshot(window);
- ui::GrabLayerSnapshotAsync(
- old_layer_owner->root(), gfx::Rect(window->bounds().size()),
- base::Bind(&EncodeAndReturnImage, base::Passed(std::move(callback)),
- base::Passed(std::move(old_layer_owner))));
-}
-
-void ArcVoiceInteractionFrameworkService::SetVoiceInteractionState(
- arc::mojom::VoiceInteractionState voice_interaction_state) {
- ash::mojom::VoiceInteractionState state =
- mojo::ConvertTo<ash::mojom::VoiceInteractionState>(
- voice_interaction_state);
- DCHECK_NE(state_, state);
- // Assume voice interaction state changing from NOT_READY to a state other
- // than ready indicates container boot complete and it's safe to synchronize
- // voice interaction flags. VoiceInteractionEnabled is locked at true in
- // Android side so we don't need to synchronize it here.
- if (state_ == ash::mojom::VoiceInteractionState::NOT_READY) {
- PrefService* prefs = Profile::FromBrowserContext(context_)->GetPrefs();
- bool value_prop_accepted =
- prefs->GetBoolean(prefs::kArcVoiceInteractionValuePropAccepted);
-
- bool enable_voice_interaction =
- value_prop_accepted &&
- prefs->GetBoolean(prefs::kVoiceInteractionEnabled);
- SetVoiceInteractionEnabled(enable_voice_interaction, base::DoNothing());
-
- SetVoiceInteractionContextEnabled(
- enable_voice_interaction &&
- prefs->GetBoolean(prefs::kVoiceInteractionContextEnabled));
- }
-
- // If voice session stopped running, we also stop the assist layer session.
- if (state_ == ash::mojom::VoiceInteractionState::RUNNING)
- highlighter_client_->Exit();
-
- state_ = state;
- arc::VoiceInteractionControllerClient::Get()->NotifyStatusChanged(state);
-}
-
-void ArcVoiceInteractionFrameworkService::ShowMetalayer() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- NotifyMetalayerStatusChanged(true);
-}
-
-void ArcVoiceInteractionFrameworkService::HideMetalayer() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- NotifyMetalayerStatusChanged(false);
-}
-
-void ArcVoiceInteractionFrameworkService::OnArcPlayStoreEnabledChanged(
- bool enabled) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (enabled)
- return;
-
- SetVoiceInteractionSetupCompletedInternal(false);
- SetVoiceInteractionEnabled(false, base::DoNothing());
- SetVoiceInteractionContextEnabled(false);
-}
-
-void ArcVoiceInteractionFrameworkService::OnHotwordTriggered(uint64_t tv_sec,
- uint64_t tv_nsec) {
- InitiateUserInteraction(false /* is_toggle */);
-}
-
-void ArcVoiceInteractionFrameworkService::StartVoiceInteractionSetupWizard() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- // This screen is shown after the Just-A-Sec screen, which blocks until
- // application sync'd is received. At that point, framework service should
- // already be initialized. Here we get a method that is defined in version 1
- // to ensure the connection is established.
- // TODO(muyuanli): This is a hack for backward compatibility and should be
- // removed once Android side is checked in and stablized, then we should
- // DCHECK the |setting_applied| parameter in the lambda. See
- // crbug.com/768935.
- DCHECK(ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- StartVoiceInteractionSession));
- SetVoiceInteractionEnabled(
- true, base::BindOnce(
- [](base::OnceClosure next, bool setting_applied) {
- if (!setting_applied)
- DVLOG(1) << "Not synchronizing settings: version mismatch";
- std::move(next).Run();
- },
- base::BindOnce(&ArcVoiceInteractionFrameworkService::
- StartVoiceInteractionSetupWizardActivity,
- weak_ptr_factory_.GetWeakPtr())));
-}
-
-void ArcVoiceInteractionFrameworkService::ShowVoiceInteractionSettings() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- arc::mojom::VoiceInteractionFrameworkInstance* framework_instance =
- ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- ShowVoiceInteractionSettings);
- if (!framework_instance)
- return;
- framework_instance->ShowVoiceInteractionSettings();
-}
-
-void ArcVoiceInteractionFrameworkService::NotifyMetalayerStatusChanged(
- bool visible) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- mojom::VoiceInteractionFrameworkInstance* framework_instance =
- ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- SetMetalayerVisibility);
- if (!framework_instance)
- return;
- framework_instance->SetMetalayerVisibility(visible);
-}
-
-void ArcVoiceInteractionFrameworkService::SetVoiceInteractionEnabled(
- bool enable,
- VoiceInteractionSettingCompleteCallback callback) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- PrefService* prefs = Profile::FromBrowserContext(context_)->GetPrefs();
-
- prefs->SetBoolean(prefs::kVoiceInteractionEnabled, enable);
- if (!enable)
- prefs->SetBoolean(prefs::kVoiceInteractionContextEnabled, false);
-
- mojom::VoiceInteractionFrameworkInstance* framework_instance =
- ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- SetVoiceInteractionEnabled);
- if (!framework_instance) {
- std::move(callback).Run(false);
- return;
- }
- framework_instance->SetVoiceInteractionEnabled(
- enable, base::BindOnce(std::move(callback), true));
-}
-
-void ArcVoiceInteractionFrameworkService::SetVoiceInteractionContextEnabled(
- bool enable) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- PrefService* prefs = Profile::FromBrowserContext(context_)->GetPrefs();
- prefs->SetBoolean(prefs::kVoiceInteractionContextEnabled, enable);
-
- mojom::VoiceInteractionFrameworkInstance* framework_instance =
- ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- SetVoiceInteractionContextEnabled);
- if (!framework_instance)
- return;
- framework_instance->SetVoiceInteractionContextEnabled(enable);
-}
-
-void ArcVoiceInteractionFrameworkService::SetVoiceInteractionSetupCompleted() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- SetVoiceInteractionSetupCompletedInternal(true);
- SetVoiceInteractionEnabled(true, base::DoNothing());
- SetVoiceInteractionContextEnabled(true);
-}
-
-void ArcVoiceInteractionFrameworkService::StartSessionFromUserInteraction(
- const gfx::Rect& rect) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- if (!InitiateUserInteraction(false /* is_toggle */))
- return;
-
- if (rect.IsEmpty()) {
- mojom::VoiceInteractionFrameworkInstance* framework_instance =
- ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- StartVoiceInteractionSession);
- DCHECK(framework_instance);
- framework_instance->StartVoiceInteractionSession(IsHomescreenActive());
- } else {
- mojom::VoiceInteractionFrameworkInstance* framework_instance =
- ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- StartVoiceInteractionSessionForRegion);
- DCHECK(framework_instance);
- framework_instance->StartVoiceInteractionSessionForRegion(rect);
- }
- VLOG(1) << "Sent voice interaction request.";
-}
-
-void ArcVoiceInteractionFrameworkService::ToggleSessionFromUserInteraction() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- if (!InitiateUserInteraction(true /* is_toggle */))
- return;
-
- mojom::VoiceInteractionFrameworkInstance* framework_instance =
- ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- ToggleVoiceInteractionSession);
- DCHECK(framework_instance);
- framework_instance->ToggleVoiceInteractionSession(IsHomescreenActive());
-}
-
-bool ArcVoiceInteractionFrameworkService::ValidateTimeSinceUserInteraction() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- if (!context_request_remaining_count_) {
- // Allowed number of requests used up. But we still have additional
- // requests. It's likely that there is something malicious going on.
- LOG(ERROR) << "Illegal context request from container.";
- UMA_HISTOGRAM_BOOLEAN("VoiceInteraction.IllegalContextRequest", true);
- return false;
- }
- auto elapsed = base::TimeTicks::Now() - user_interaction_start_time_;
- elapsed = elapsed > kMaxTimeSinceUserInteractionForHistogram
- ? kMaxTimeSinceUserInteractionForHistogram
- : elapsed;
-
- UMA_HISTOGRAM_CUSTOM_COUNTS(
- "VoiceInteraction.UserInteractionToRequestArrival",
- elapsed.InMilliseconds(), 1,
- kMaxTimeSinceUserInteractionForHistogram.InMilliseconds(), 20);
-
- if (elapsed > kAllowedTimeSinceUserInteraction) {
- LOG(ERROR) << "Timed out since last user interaction.";
- context_request_remaining_count_ = 0;
- return false;
- }
-
- context_request_remaining_count_--;
- return true;
-}
-
-void ArcVoiceInteractionFrameworkService::StartVoiceInteractionOobe() {
- if (chromeos::LoginDisplayHost::default_host())
- return;
- // The display host will be destructed at the end of OOBE flow.
- auto* display_host = new chromeos::LoginDisplayHostWebUI();
- display_host->StartVoiceInteractionOobe();
-}
-
-bool ArcVoiceInteractionFrameworkService::InitiateUserInteraction(
- bool is_toggle) {
- VLOG(1) << "Start voice interaction.";
- PrefService* prefs = Profile::FromBrowserContext(context_)->GetPrefs();
- if (!prefs->GetBoolean(prefs::kArcVoiceInteractionValuePropAccepted) ||
- arc::IsArcTermsOfServiceOobeNegotiationNeeded()) {
- VLOG(1) << "Voice interaction feature or ARC not accepted.";
- should_start_runtime_flow_ = true;
- // If voice interaction value prop has not been accepted, show the value
- // prop OOBE page again.
- StartVoiceInteractionOobe();
- return false;
- }
-
- if (!prefs->GetBoolean(prefs::kVoiceInteractionEnabled))
- return false;
-
- if (state_ == ash::mojom::VoiceInteractionState::NOT_READY) {
- // If the container side is not ready, we will be waiting for a while.
- arc::VoiceInteractionControllerClient::Get()->NotifyStatusChanged(
- ash::mojom::VoiceInteractionState::NOT_READY);
- }
-
- ArcBootPhaseMonitorBridge::RecordFirstAppLaunchDelayUMA(context_);
- if (!arc_bridge_service_->voice_interaction_framework()->IsConnected()) {
- VLOG(1) << "Instance not ready.";
- SetArcCpuRestriction(false);
- is_request_pending_ = true;
- is_pending_request_toggle_ = is_toggle;
- return false;
- }
-
- user_interaction_start_time_ = base::TimeTicks::Now();
- context_request_remaining_count_ = kContextRequestMaxRemainingCount;
- return true;
-}
-
-void ArcVoiceInteractionFrameworkService::
- SetVoiceInteractionSetupCompletedInternal(bool completed) {
- PrefService* prefs = Profile::FromBrowserContext(context_)->GetPrefs();
- prefs->SetBoolean(prefs::kArcVoiceInteractionValuePropAccepted, completed);
-}
-
-bool ArcVoiceInteractionFrameworkService::IsHomescreenActive() {
- // Homescreen is considered to be active if there are no active windows.
- // TODO(crbug.com/757012): Mash support.
- if (features::IsMultiProcessMash())
- return false;
- return !ash::Shell::Get()->activation_client()->GetActiveWindow();
-}
-
-void ArcVoiceInteractionFrameworkService::
- StartVoiceInteractionSetupWizardActivity() {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- arc::mojom::VoiceInteractionFrameworkInstance* framework_instance =
- ARC_GET_INSTANCE_FOR_METHOD(
- arc_bridge_service_->voice_interaction_framework(),
- StartVoiceInteractionSetupWizard);
-
- if (!framework_instance)
- return;
-
- if (should_start_runtime_flow_) {
- should_start_runtime_flow_ = false;
- VLOG(1) << "Starting runtime setup flow.";
- framework_instance->StartVoiceInteractionSession(IsHomescreenActive());
- return;
- }
- framework_instance->StartVoiceInteractionSetupWizard();
-}
-
-std::unique_ptr<ui::LayerTreeOwner>
-ArcVoiceInteractionFrameworkService::CreateLayerTreeForSnapshotForTesting(
- aura::Window* root_window) const {
- return CreateLayerTreeForSnapshot(root_window);
-}
-
-} // namespace arc
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h
deleted file mode 100644
index 24a8d90..0000000
--- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_ARC_VOICE_INTERACTION_ARC_VOICE_INTERACTION_FRAMEWORK_SERVICE_H_
-#define CHROME_BROWSER_CHROMEOS_ARC_VOICE_INTERACTION_ARC_VOICE_INTERACTION_FRAMEWORK_SERVICE_H_
-
-#include <memory>
-
-#include "ash/public/interfaces/voice_interaction_controller.mojom.h"
-#include "base/callback_forward.h"
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/time/time.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
-#include "chromeos/audio/cras_audio_handler.h"
-#include "components/arc/common/voice_interaction_framework.mojom.h"
-#include "components/arc/connection_observer.h"
-#include "components/keyed_service/core/keyed_service.h"
-
-class KeyedServiceBaseFactory;
-
-namespace content {
-class BrowserContext;
-} // namespace content
-
-namespace gfx {
-class Rect;
-} // namespace gfx
-
-namespace ui {
-class LayerTreeOwner;
-} // namespace ui
-
-namespace arc {
-
-class ArcBridgeService;
-class HighlighterControllerClient;
-
-// This provides voice interaction context (currently screenshots)
-// to ARC to be used by VoiceInteractionSession. This class lives on the UI
-// thread.
-class ArcVoiceInteractionFrameworkService
- : public chromeos::CrasAudioHandler::AudioObserver,
- public KeyedService,
- public mojom::VoiceInteractionFrameworkHost,
- public ConnectionObserver<mojom::VoiceInteractionFrameworkInstance>,
- public ArcSessionManager::Observer {
- public:
- // Returns singleton instance for the given BrowserContext,
- // or nullptr if the browser |context| is not allowed to use ARC.
- static ArcVoiceInteractionFrameworkService* GetForBrowserContext(
- content::BrowserContext* context);
-
- // Returns factory for ArcVoiceInteractionFrameworkService.
- static KeyedServiceBaseFactory* GetFactory();
-
- ArcVoiceInteractionFrameworkService(content::BrowserContext* context,
- ArcBridgeService* bridge_service);
- ~ArcVoiceInteractionFrameworkService() override;
-
- // ConnectionObserver<mojom::VoiceInteractionFrameworkInstance> overrides.
- void OnConnectionReady() override;
- void OnConnectionClosed() override;
-
- // mojom::VoiceInteractionFrameworkHost overrides.
- void CaptureFullscreen(CaptureFullscreenCallback callback) override;
- void SetVoiceInteractionState(
- arc::mojom::VoiceInteractionState state) override;
-
- void ShowMetalayer();
- void HideMetalayer();
-
- // ArcSessionManager::Observer overrides.
- void OnArcPlayStoreEnabledChanged(bool enabled) override;
-
- // CrasAudioHandler::AudioObserver overrides.
- void OnHotwordTriggered(uint64_t tv_sec, uint64_t tv_nsec) override;
-
- // Starts a voice interaction session after user-initiated interaction.
- // Records a timestamp and sets number of allowed requests to 2 since by
- // design, there will be one request for screenshot and the other for
- // voice interaction context.
- // |region| refers to the selected region on the screen to be passed to
- // VoiceInteractionFrameworkInstance::StartVoiceInteractionSessionForRegion().
- // If |region| is empty,
- // VoiceInteractionFrameworkInstance::StartVoiceInteraction() is called.
- void StartSessionFromUserInteraction(const gfx::Rect& region);
-
- // Similar to StartSessionFromUserInteraction but stops voice interaction
- // seesion if it is already running.
- void ToggleSessionFromUserInteraction();
-
- using VoiceInteractionSettingCompleteCallback =
- base::OnceCallback<void(bool)>;
- // Turn on / off voice interaction in ARC. |callback| will be called with
- // |true| if setting is applied to Android side.
- void SetVoiceInteractionEnabled(
- bool enable,
- VoiceInteractionSettingCompleteCallback callback);
-
- // Turn on / off voice interaction context (screenshot and structural data)
- // in ARC.
- void SetVoiceInteractionContextEnabled(bool enable);
-
- // Checks whether the caller is called within the time limit since last user
- // initiated interaction. Logs UMA metric when it's not.
- bool ValidateTimeSinceUserInteraction();
-
- // Start the voice interaction setup wizard in container.
- void StartVoiceInteractionSetupWizard();
-
- // Show the voice interaction settings in container.
- void ShowVoiceInteractionSettings();
-
- // Set voice interaction setup completed flag and notify the change.
- void SetVoiceInteractionSetupCompleted();
-
- // Starts voice interaction OOBE flow.
- void StartVoiceInteractionOobe();
-
- HighlighterControllerClient* GetHighlighterClientForTesting() const {
- return highlighter_client_.get();
- }
-
- ash::mojom::VoiceInteractionState GetStateForTesting() const {
- return state_;
- }
-
- std::unique_ptr<ui::LayerTreeOwner> CreateLayerTreeForSnapshotForTesting(
- aura::Window* root_window) const;
-
- // For supporting ArcServiceManager::GetService<T>().
- static const char kArcServiceName[];
-
- private:
- void NotifyMetalayerStatusChanged(bool visible);
-
- bool InitiateUserInteraction(bool is_toggle);
-
- void SetVoiceInteractionSetupCompletedInternal(bool completed);
-
- bool IsHomescreenActive();
-
- void StartVoiceInteractionSetupWizardActivity();
-
- content::BrowserContext* context_;
- ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager
-
- // Whether there is a pending request to start/toggle voice interaction.
- bool is_request_pending_ = false;
-
- // Whether the pending request is toggle the voice interaction.
- bool is_pending_request_toggle_ = false;
-
- // Whether we should launch runtime setup flow for voice interaction.
- bool should_start_runtime_flow_ = false;
-
- // The current state voice interaction service is. There is usually a long
- // delay after boot before the service is ready. We wait for the container
- // to tell us if it is ready to quickly serve voice interaction requests.
- // We also give user proper feedback based on the state.
- ash::mojom::VoiceInteractionState state_ =
- ash::mojom::VoiceInteractionState::NOT_READY;
-
- // The time when a user initated an interaction.
- base::TimeTicks user_interaction_start_time_;
-
- // The number of allowed requests from container. Maximum is 2 (1 for
- // screenshot and 1 for view hierarchy). This amount decreases after each
- // context request or resets when allowed time frame is elapsed. When this
- // quota is 0, but we still get requests from the container side, we assume
- // something malicious is going on.
- int32_t context_request_remaining_count_ = 0;
-
- std::unique_ptr<HighlighterControllerClient> highlighter_client_;
-
- base::WeakPtrFactory<ArcVoiceInteractionFrameworkService> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(ArcVoiceInteractionFrameworkService);
-};
-
-} // namespace arc
-#endif // CHROME_BROWSER_CHROMEOS_ARC_VOICE_INTERACTION_ARC_VOICE_INTERACTION_FRAMEWORK_SERVICE_H_
diff --git a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service_unittest.cc b/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service_unittest.cc
deleted file mode 100644
index f2224bc..0000000
--- a/chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service_unittest.cc
+++ /dev/null
@@ -1,431 +0,0 @@
-// Copyright 2017 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/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h"
-
-#include <memory>
-#include <string>
-#include <utility>
-
-#include "ash/public/interfaces/constants.mojom.h"
-#include "ash/shell.h"
-#include "base/bind.h"
-#include "base/files/scoped_temp_dir.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/fake_voice_interaction_controller.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/highlighter_controller_client.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/test/base/chrome_ash_test_base.h"
-#include "chrome/test/base/test_browser_window.h"
-#include "chrome/test/base/test_browser_window_aura.h"
-#include "chrome/test/base/testing_profile.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/fake_cras_audio_client.h"
-#include "components/arc/arc_bridge_service.h"
-#include "components/arc/arc_util.h"
-#include "components/arc/test/connection_holder_util.h"
-#include "components/arc/test/fake_arc_session.h"
-#include "components/arc/test/fake_voice_interaction_framework_instance.h"
-#include "components/prefs/pref_service.h"
-#include "components/session_manager/core/session_manager.h"
-#include "services/service_manager/public/cpp/service.h"
-#include "services/service_manager/public/cpp/service_binding.h"
-#include "services/service_manager/public/cpp/test/test_connector_factory.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/compositor/layer.h"
-#include "ui/compositor/layer_tree_owner.h"
-
-namespace arc {
-
-namespace {
-
-class TestHighlighterController : public ash::mojom::HighlighterController,
- public service_manager::Service {
- public:
- explicit TestHighlighterController(
- service_manager::mojom::ServiceRequest request)
- : service_binding_(this, std::move(request)) {}
- ~TestHighlighterController() override = default;
-
- void CallHandleSelection(const gfx::Rect& rect) {
- client_->HandleSelection(rect);
- }
-
- void CallHandleEnabledStateChange(bool enabled) {
- is_enabled_ = enabled;
- client_->HandleEnabledStateChange(enabled);
- }
-
- bool client_attached() const { return static_cast<bool>(client_); }
-
- // ash::mojom::HighlighterController:
- void SetClient(ash::mojom::HighlighterControllerClientPtr client) override {
- DCHECK(!client_);
- client_ = std::move(client);
- // Okay to use base::Unretained(this), as |client_| will be destroyed before
- // |this|.
- client_.set_connection_error_handler(
- base::BindOnce(&TestHighlighterController::OnClientConnectionLost,
- base::Unretained(this)));
- }
-
- void ExitHighlighterMode() override {
- // simulate exiting current session.
- CallHandleEnabledStateChange(false);
- }
-
- void FlushMojo() { client_.FlushForTesting(); }
-
- bool is_enabled() { return is_enabled_; }
-
- // service_manager::Service:
- void OnBindInterface(const service_manager::BindSourceInfo& source_info,
- const std::string& interface_name,
- mojo::ScopedMessagePipeHandle interface_pipe) override {
- DCHECK(interface_name == ash::mojom::HighlighterController::Name_);
- binding_.Bind(
- ash::mojom::HighlighterControllerRequest(std::move(interface_pipe)));
- }
-
- private:
- void OnClientConnectionLost() {
- client_.reset();
- binding_.Close();
- }
-
- service_manager::ServiceBinding service_binding_;
- mojo::Binding<ash::mojom::HighlighterController> binding_{this};
- ash::mojom::HighlighterControllerClientPtr client_;
- bool is_enabled_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(TestHighlighterController);
-};
-
-std::unique_ptr<TestBrowserWindow> CreateTestBrowserWindow(
- aura::Window* parent) {
- auto window = std::make_unique<aura::Window>(
- nullptr, aura::client::WINDOW_TYPE_NORMAL, parent->env());
- window->Init(ui::LAYER_TEXTURED);
- window->SetBounds(gfx::Rect(0, 0, 200, 200));
- parent->AddChild(window.get());
- return std::make_unique<TestBrowserWindowAura>(std::move(window));
-}
-
-ui::Layer* FindLayer(ui::Layer* root, ui::Layer* target) {
- if (root == target)
- return target;
- for (auto* child : root->children()) {
- auto* result = FindLayer(child, target);
- if (result)
- return result;
- }
- return nullptr;
-}
-
-} // namespace
-
-class ArcVoiceInteractionFrameworkServiceTest : public ChromeAshTestBase {
- public:
- ArcVoiceInteractionFrameworkServiceTest() = default;
-
- void SetUp() override {
- ChromeAshTestBase::SetUp();
- SetRunningOutsideAsh();
- // Setup test profile.
- ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- TestingProfile::Builder profile_builder;
- profile_builder.SetProfileName("user@gmail.com");
- profile_builder.SetPath(temp_dir_.GetPath().AppendASCII("TestArcProfile"));
- profile_ = profile_builder.Build();
-
- // Setup dependencies for voice interaction framework service.
- session_manager_ = std::make_unique<session_manager::SessionManager>();
- arc_session_manager_ = std::make_unique<ArcSessionManager>(
- std::make_unique<ArcSessionRunner>(base::Bind(FakeArcSession::Create)));
- arc_bridge_service_ = std::make_unique<ArcBridgeService>();
-
- voice_interaction_controller_ =
- std::make_unique<FakeVoiceInteractionController>();
- voice_interaction_controller_client_ =
- std::make_unique<VoiceInteractionControllerClient>();
- highlighter_controller_ = std::make_unique<TestHighlighterController>(
- connector_factory_.RegisterInstance(ash::mojom::kServiceName));
- framework_service_ = std::make_unique<ArcVoiceInteractionFrameworkService>(
- profile_.get(), arc_bridge_service_.get());
- framework_service_->GetHighlighterClientForTesting()
- ->SetConnectorForTesting(connector_factory_.GetDefaultConnector());
- voice_interaction_controller_client()->SetControllerForTesting(
- voice_interaction_controller_->CreateInterfacePtrAndBind());
- framework_instance_ =
- std::make_unique<FakeVoiceInteractionFrameworkInstance>();
- arc_bridge_service_->voice_interaction_framework()->SetInstance(
- framework_instance_.get());
- WaitForInstanceReady(arc_bridge_service_->voice_interaction_framework());
- // Flushing is required for the AttachClient call to get through to the
- // highligther controller.
- FlushHighlighterControllerMojo();
-
- framework_service()->SetVoiceInteractionSetupCompleted();
- // Flushing is required for the notify mojo call to get through to the voice
- // interaction controller.
- FlushVoiceInteractionControllerMojo();
- }
-
- void TearDown() override {
- arc_bridge_service_->voice_interaction_framework()->CloseInstance(
- framework_instance_.get());
- voice_interaction_controller_.reset();
- voice_interaction_controller_client_.reset();
- framework_instance_.reset();
- framework_service_.reset();
- arc_bridge_service_.reset();
- arc_session_manager_.reset();
- session_manager_.reset();
- profile_.reset();
- ChromeAshTestBase::TearDown();
- }
-
- protected:
- ArcBridgeService* arc_bridge_service() const {
- return arc_bridge_service_.get();
- }
-
- ArcVoiceInteractionFrameworkService* framework_service() const {
- return framework_service_.get();
- }
-
- FakeVoiceInteractionFrameworkInstance* framework_instance() const {
- return framework_instance_.get();
- }
-
- TestHighlighterController* highlighter_controller() const {
- return highlighter_controller_.get();
- }
-
- FakeVoiceInteractionController* voice_interaction_controller() {
- return voice_interaction_controller_.get();
- }
-
- VoiceInteractionControllerClient* voice_interaction_controller_client() {
- return voice_interaction_controller_client_.get();
- }
-
- void FlushHighlighterControllerMojo() {
- framework_service_->GetHighlighterClientForTesting()->FlushMojoForTesting();
- }
-
- void FlushVoiceInteractionControllerMojo() {
- voice_interaction_controller_client()->FlushMojoForTesting();
- }
-
- TestingProfile* profile() const { return profile_.get(); }
-
- private:
- std::unique_ptr<TestingProfile> profile_;
- base::ScopedTempDir temp_dir_;
- std::unique_ptr<session_manager::SessionManager> session_manager_;
- std::unique_ptr<ArcBridgeService> arc_bridge_service_;
- std::unique_ptr<ArcSessionManager> arc_session_manager_;
- service_manager::TestConnectorFactory connector_factory_;
- std::unique_ptr<TestHighlighterController> highlighter_controller_;
- std::unique_ptr<FakeVoiceInteractionController> voice_interaction_controller_;
- std::unique_ptr<ArcVoiceInteractionFrameworkService> framework_service_;
- std::unique_ptr<FakeVoiceInteractionFrameworkInstance> framework_instance_;
- std::unique_ptr<VoiceInteractionControllerClient>
- voice_interaction_controller_client_;
-
- DISALLOW_COPY_AND_ASSIGN(ArcVoiceInteractionFrameworkServiceTest);
-};
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest, StartSetupWizard) {
- framework_service()->StartVoiceInteractionSetupWizard();
- // The signal to start setup wizard should be sent.
- EXPECT_EQ(1u, framework_instance()->setup_wizard_count());
-}
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest, ShowSettings) {
- framework_service()->ShowVoiceInteractionSettings();
- // The signal to show voice interaction settings should be sent.
- EXPECT_EQ(1u, framework_instance()->show_settings_count());
-}
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest, StartSession) {
- framework_service()->StartSessionFromUserInteraction(gfx::Rect());
- FlushVoiceInteractionControllerMojo();
- // The signal to start voice interaction session should be sent.
- EXPECT_EQ(1u, framework_instance()->start_session_count());
-}
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest, StartSessionWithoutFlag) {
- // Remove the voice interaction enabled flag.
- framework_service()->SetVoiceInteractionEnabled(false,
- base::BindOnce([](bool) {}));
-
- framework_service()->StartSessionFromUserInteraction(gfx::Rect());
- // The signal should not be sent when voice interaction disabled.
- EXPECT_EQ(0u, framework_instance()->start_session_count());
-}
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest, StartSessionWithoutInstance) {
- // Reset the framework instance.
- arc_bridge_service()->voice_interaction_framework()->CloseInstance(
- framework_instance());
-
- framework_service()->StartSessionFromUserInteraction(gfx::Rect());
- // A notification should be sent if the container is not ready yet.
- FlushVoiceInteractionControllerMojo();
- EXPECT_EQ(ash::mojom::VoiceInteractionState::NOT_READY,
- voice_interaction_controller()->voice_interaction_state());
- // The signal should not be sent when framework instance not ready.
- EXPECT_EQ(0u, framework_instance()->start_session_count());
-}
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest, ToggleSession) {
- framework_service()->ToggleSessionFromUserInteraction();
- FlushVoiceInteractionControllerMojo();
- // The signal to toggle voice interaction session should be sent.
- EXPECT_EQ(1u, framework_instance()->toggle_session_count());
-}
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest, HotwordTriggered) {
- auto* audio_client = static_cast<chromeos::FakeCrasAudioClient*>(
- chromeos::DBusThreadManager::Get()->GetCrasAudioClient());
- audio_client->NotifyHotwordTriggeredForTesting(0, 0);
- EXPECT_TRUE(framework_service()->ValidateTimeSinceUserInteraction());
-}
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest, HighlighterControllerClient) {
- EXPECT_TRUE(highlighter_controller()->client_attached());
-
- // Enabled state should propagate to the framework instance.
- highlighter_controller()->CallHandleEnabledStateChange(true);
- highlighter_controller()->FlushMojo();
- EXPECT_EQ(1u, framework_instance()->set_metalayer_visibility_count());
- EXPECT_TRUE(framework_instance()->metalayer_visible());
-
- // Disabled state should propagate to the framework instance.
- framework_instance()->ResetCounters();
- highlighter_controller()->CallHandleEnabledStateChange(false);
- highlighter_controller()->FlushMojo();
- EXPECT_EQ(1u, framework_instance()->set_metalayer_visibility_count());
- EXPECT_FALSE(framework_instance()->metalayer_visible());
-
- // Enable the state again.
- framework_instance()->ResetCounters();
- highlighter_controller()->CallHandleEnabledStateChange(true);
- highlighter_controller()->FlushMojo();
- EXPECT_EQ(1u, framework_instance()->set_metalayer_visibility_count());
- EXPECT_TRUE(framework_instance()->metalayer_visible());
-
- // Simulate a valid selection.
- framework_instance()->ResetCounters();
- const gfx::Rect selection(100, 200, 300, 400);
- highlighter_controller()->CallHandleSelection(selection);
- highlighter_controller()->CallHandleEnabledStateChange(false);
- highlighter_controller()->FlushMojo();
- // Neither the selected region nor the state update should reach the
- // framework instance yet.
- EXPECT_EQ(0u, framework_instance()->start_session_for_region_count());
- EXPECT_EQ(0u, framework_instance()->set_metalayer_visibility_count());
- EXPECT_TRUE(framework_instance()->metalayer_visible());
- framework_service()
- ->GetHighlighterClientForTesting()
- ->SimulateSelectionTimeoutForTesting();
- // After a timeout, the selected region should reach the framework instance.
- EXPECT_EQ(1u, framework_instance()->start_session_for_region_count());
- EXPECT_EQ(selection.ToString(),
- framework_instance()->selected_region().ToString());
- // However, the state update should not be explicitly sent to the framework
- // instance, since the state change is implied with a valid selection.
- EXPECT_EQ(0u, framework_instance()->set_metalayer_visibility_count());
-
- // Clear the framework instance to simulate the container crash.
- // The client should become detached.
- arc_bridge_service()->voice_interaction_framework()->CloseInstance(
- framework_instance());
- FlushHighlighterControllerMojo();
- EXPECT_FALSE(highlighter_controller()->client_attached());
-
- // Set the framework instance again to simulate the container restart.
- // The client should become attached again.
- arc_bridge_service()->voice_interaction_framework()->SetInstance(
- framework_instance());
- WaitForInstanceReady(arc_bridge_service()->voice_interaction_framework());
- FlushHighlighterControllerMojo();
- EXPECT_TRUE(highlighter_controller()->client_attached());
-
- // State update should reach the client normally.
- framework_instance()->ResetCounters();
- highlighter_controller()->CallHandleEnabledStateChange(true);
- highlighter_controller()->FlushMojo();
- EXPECT_EQ(1u, framework_instance()->set_metalayer_visibility_count());
- EXPECT_TRUE(framework_instance()->metalayer_visible());
-}
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest,
- ExitVoiceInteractionAlsoExitHighlighter) {
- highlighter_controller()->CallHandleEnabledStateChange(true);
-
- framework_service()->ToggleSessionFromUserInteraction();
- framework_instance()->FlushMojoForTesting();
- FlushHighlighterControllerMojo();
- EXPECT_EQ(ash::mojom::VoiceInteractionState::RUNNING,
- framework_service()->GetStateForTesting());
-
- framework_service()->ToggleSessionFromUserInteraction();
- framework_instance()->FlushMojoForTesting();
- FlushHighlighterControllerMojo();
- EXPECT_EQ(ash::mojom::VoiceInteractionState::STOPPED,
- framework_service()->GetStateForTesting());
-
- EXPECT_FALSE(highlighter_controller()->is_enabled());
-}
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest,
- VoiceInteractionControllerClient) {
- FakeVoiceInteractionController* controller = voice_interaction_controller();
- VoiceInteractionControllerClient* controller_client =
- voice_interaction_controller_client();
- // The voice interaction flags should be set after the initial setup.
- EXPECT_EQ(controller->voice_interaction_state(),
- ash::mojom::VoiceInteractionState::STOPPED);
-
- // Send the signal to set the voice interaction state.
- controller_client->NotifyStatusChanged(
- ash::mojom::VoiceInteractionState::RUNNING);
- FlushVoiceInteractionControllerMojo();
- EXPECT_EQ(controller->voice_interaction_state(),
- ash::mojom::VoiceInteractionState::RUNNING);
-}
-
-TEST_F(ArcVoiceInteractionFrameworkServiceTest,
- CapturingScreenshotBlocksIncognitoWindows) {
- auto browser_window =
- CreateTestBrowserWindow(ash::Shell::GetPrimaryRootWindow());
- Browser::CreateParams params(profile(), true);
- params.type = Browser::TYPE_TABBED;
- params.window = browser_window.get();
- Browser browser(params);
- browser_window->GetNativeWindow()->Show();
-
- profile()->ForceIncognito(true);
- // Layer::RecreateLayer() will replace the window's layer with the newly
- // created layer. Thus, we need to save the |old_layer| for comparison.
- auto* old_layer = browser_window->GetNativeWindow()->layer();
- auto layer_owner = framework_service()->CreateLayerTreeForSnapshotForTesting(
- ash::Shell::GetPrimaryRootWindow());
- EXPECT_FALSE(FindLayer(layer_owner->root(), old_layer));
-
- profile()->ForceIncognito(false);
- old_layer = browser_window->GetNativeWindow()->layer();
- layer_owner = framework_service()->CreateLayerTreeForSnapshotForTesting(
- ash::Shell::GetPrimaryRootWindow());
- EXPECT_TRUE(FindLayer(layer_owner->root(), old_layer));
-
- ash::Shell::GetPrimaryRootWindow()->RemoveChild(
- browser_window->GetNativeWindow());
-}
-
-} // namespace arc
diff --git a/chrome/browser/chromeos/arc/voice_interaction/highlighter_controller_client.cc b/chrome/browser/chromeos/arc/voice_interaction/highlighter_controller_client.cc
deleted file mode 100644
index b10a089e..0000000
--- a/chrome/browser/chromeos/arc/voice_interaction/highlighter_controller_client.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2017 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/chromeos/arc/voice_interaction/highlighter_controller_client.h"
-
-#include <utility>
-
-#include "ash/public/interfaces/constants.mojom.h"
-#include "base/time/time.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h"
-#include "content/public/common/service_manager_connection.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "services/service_manager/public/cpp/connector.h"
-
-namespace arc {
-
-namespace {
-constexpr int kSelectionReportDelayMs = 600;
-}
-
-HighlighterControllerClient::HighlighterControllerClient(
- ArcVoiceInteractionFrameworkService* service)
- : binding_(this), service_(service) {}
-
-HighlighterControllerClient::~HighlighterControllerClient() = default;
-
-void HighlighterControllerClient::Attach() {
- ConnectToHighlighterController();
- ash::mojom::HighlighterControllerClientPtr client;
- binding_.Bind(mojo::MakeRequest(&client));
- highlighter_controller_->SetClient(std::move(client));
-}
-
-void HighlighterControllerClient::Detach() {
- binding_.Close();
-}
-
-void HighlighterControllerClient::SimulateSelectionTimeoutForTesting() {
- DCHECK(delay_timer_ && delay_timer_->IsRunning());
- delay_timer_->FireNow();
- delay_timer_.reset();
-}
-
-void HighlighterControllerClient::FlushMojoForTesting() {
- highlighter_controller_.FlushForTesting();
-}
-
-void HighlighterControllerClient::Exit() {
- highlighter_controller_->ExitHighlighterMode();
-}
-
-void HighlighterControllerClient::ConnectToHighlighterController() {
- // Connector can be overridden for testing.
- if (!connector_) {
- connector_ =
- content::ServiceManagerConnection::GetForProcess()->GetConnector();
- }
- connector_->BindInterface(ash::mojom::kServiceName, &highlighter_controller_);
-}
-
-void HighlighterControllerClient::HandleSelection(const gfx::Rect& rect) {
- // Delay the actual voice interaction service invocation for better
- // visual synchronization with the metalayer animation.
- delay_timer_ = std::make_unique<base::OneShotTimer>();
- delay_timer_->Start(
- FROM_HERE, base::TimeDelta::FromMilliseconds(kSelectionReportDelayMs),
- base::Bind(&HighlighterControllerClient::ReportSelection,
- base::Unretained(this), rect));
-}
-
-void HighlighterControllerClient::HandleEnabledStateChange(bool enabled) {
- // ArcVoiceInteractionFrameworkService::HideMetalayer() causes the container
- // to show a toast-like prompt. This toast is redundant and causes
- // unnecessary flicker if the full voice interaction UI is about to be
- // displayed soon. |start_session_pending| is a good signal that the session
- // is about to start, but it is not guaranteed: 1) The user might re-enter the
- // metalayer mode before the timer fires.
- // In this case the container will keep showing the prompt for the
- // metalayer mode.
- // 2) The session might fail to start due to a peculiar combination of
- // failures on the way to the voice interaction UI. This is an open
- // problem.
- if (enabled)
- service_->ShowMetalayer();
- else if (!start_session_pending())
- service_->HideMetalayer();
-}
-
-void HighlighterControllerClient::ReportSelection(const gfx::Rect& rect) {
- service_->StartSessionFromUserInteraction(rect);
-}
-
-} // namespace arc
diff --git a/chrome/browser/chromeos/arc/voice_interaction/highlighter_controller_client.h b/chrome/browser/chromeos/arc/voice_interaction/highlighter_controller_client.h
deleted file mode 100644
index a8f2aee..0000000
--- a/chrome/browser/chromeos/arc/voice_interaction/highlighter_controller_client.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_ARC_VOICE_INTERACTION_HIGHLIGHTER_CONTROLLER_CLIENT_H_
-#define CHROME_BROWSER_CHROMEOS_ARC_VOICE_INTERACTION_HIGHLIGHTER_CONTROLLER_CLIENT_H_
-
-#include <memory>
-
-#include "ash/public/interfaces/highlighter_controller.mojom.h"
-#include "base/macros.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace gfx {
-class Rect;
-} // namespace gfx
-
-namespace base {
-class OneShotTimer;
-} // namespace base
-
-namespace service_manager {
-class Connector;
-} // namespace service_manager
-
-namespace arc {
-
-class ArcVoiceInteractionFrameworkService;
-
-class HighlighterControllerClient
- : public ash::mojom::HighlighterControllerClient {
- public:
- explicit HighlighterControllerClient(
- ArcVoiceInteractionFrameworkService* service);
- ~HighlighterControllerClient() override;
-
- // Attaches the client to the controller.
- void Attach();
-
- // Detaches the client from the controller.
- void Detach();
-
- void SetConnectorForTesting(service_manager::Connector* connector) {
- connector_ = connector;
- }
-
- void SimulateSelectionTimeoutForTesting();
-
- void FlushMojoForTesting();
-
- // Request to exit curent session.
- void Exit();
-
- private:
- void ConnectToHighlighterController();
-
- // ash::mojom::HighlighterControllerClient:
- void HandleSelection(const gfx::Rect& rect) override;
- void HandleEnabledStateChange(bool enabled) override;
-
- void ReportSelection(const gfx::Rect& rect);
-
- bool start_session_pending() const { return delay_timer_.get(); }
-
- // Unowned pointer to a mojo connector.
- service_manager::Connector* connector_ = nullptr;
-
- // Binds to the client interface.
- mojo::Binding<ash::mojom::HighlighterControllerClient> binding_;
-
- // HighlighterController interface in ash.
- ash::mojom::HighlighterControllerPtr highlighter_controller_;
-
- ArcVoiceInteractionFrameworkService* service_;
-
- std::unique_ptr<base::OneShotTimer> delay_timer_;
-
- DISALLOW_COPY_AND_ASSIGN(HighlighterControllerClient);
-};
-
-} // namespace arc
-
-#endif // CHROME_BROWSER_CHROMEOS_ARC_VOICE_INTERACTION_HIGHLIGHTER_CONTROLLER_CLIENT_H_
diff --git a/chrome/browser/chromeos/first_run/first_run.cc b/chrome/browser/chromeos/first_run/first_run.cc
index 3458ed8..842f8ea 100644
--- a/chrome/browser/chromeos/first_run/first_run.cc
+++ b/chrome/browser/chromeos/first_run/first_run.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/chromeos/first_run/first_run.h"
+
#include "base/command_line.h"
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h"
#include "chrome/browser/chromeos/first_run/first_run_controller.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
@@ -138,24 +139,7 @@
}
}
- // If voice interaction value prop needs to be shown, the tutorial will be
- // shown after the voice interaction OOBE flow.
- if (account_supported && arc::IsArcPlayStoreEnabledForProfile(profile_) &&
- !profile_->GetPrefs()->GetBoolean(
- arc::prefs::kArcVoiceInteractionValuePropAccepted)) {
- auto* service =
- arc::ArcVoiceInteractionFrameworkService::GetForBrowserContext(
- profile_);
- if (service) {
- service->StartVoiceInteractionOobe();
- } else {
- // Try launching the tutorial in case the voice interaction framework
- // service is unavailable. See https://crbug.com/809756.
- TryLaunchFirstRunDialog(profile_);
- }
- } else {
TryLaunchFirstRunDialog(profile_);
- }
delete this;
}
diff --git a/chrome/browser/chromeos/login/oobe_screen.cc b/chrome/browser/chromeos/login/oobe_screen.cc
index 16d3648..b4d4d271 100644
--- a/chrome/browser/chromeos/login/oobe_screen.cc
+++ b/chrome/browser/chromeos/login/oobe_screen.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/chromeos/login/oobe_screen.h"
+#include <vector>
+
#include "base/command_line.h"
#include "base/logging.h"
#include "base/stl_util.h"
@@ -46,8 +48,6 @@
"userBoard", // SCREEN_USER_SELECTION
"ad-password-change", // SCREEN_ACTIVE_DIRECTORY_PASSWORD_CHANGE
"encryption-migration", // SCREEN_ENCRYPTION_MIGRATION
- "voice-interaction-value-prop", // SCREEN_VOICE_INTERACTION_VALUE_PROP
- "wait-for-container-ready", // SCREEN_WAIT_FOR_CONTAINTER_READY
"supervision-transition", // SCREEN_SUPERVISION_TRANSITION
"update-required", // SCREEN_UPDATE_REQUIRED
"assistant-optin-flow", // SCREEN_ASSISTANT_OPTIN_FLOW
diff --git a/chrome/browser/chromeos/login/oobe_screen.h b/chrome/browser/chromeos/login/oobe_screen.h
index 38ddba4..20354bc 100644
--- a/chrome/browser/chromeos/login/oobe_screen.h
+++ b/chrome/browser/chromeos/login/oobe_screen.h
@@ -45,8 +45,6 @@
SCREEN_USER_SELECTION,
SCREEN_ACTIVE_DIRECTORY_PASSWORD_CHANGE,
SCREEN_ENCRYPTION_MIGRATION,
- SCREEN_VOICE_INTERACTION_VALUE_PROP,
- SCREEN_WAIT_FOR_CONTAINER_READY,
SCREEN_SUPERVISION_TRANSITION,
SCREEN_UPDATE_REQUIRED,
SCREEN_ASSISTANT_OPTIN_FLOW,
diff --git a/chrome/browser/chromeos/login/screens/screen_exit_code.cc b/chrome/browser/chromeos/login/screens/screen_exit_code.cc
index ee983c8..17c259c 100644
--- a/chrome/browser/chromeos/login/screens/screen_exit_code.cc
+++ b/chrome/browser/chromeos/login/screens/screen_exit_code.cc
@@ -60,14 +60,6 @@
return "ARC_TERMS_OF_SERVICE_ACCEPTED";
case ScreenExitCode::UPDATE_ERROR_UPDATING_CRITICAL_UPDATE:
return "UPDATE_ERROR_UPDATING_CRITICAL_UPDATE";
- case ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_SKIPPED:
- return "VOICE_INTERACTION_VALUE_PROP_SKIPPED";
- case ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_ACCEPTED:
- return "VOICE_INTERACTION_VALUE_PROP_ACCEPTED";
- case ScreenExitCode::WAIT_FOR_CONTAINER_READY_FINISHED:
- return "WAIT_FOR_CONTAINER_READY_FINISHED";
- case ScreenExitCode::WAIT_FOR_CONTAINER_READY_ERROR:
- return "WAIT_FOR_CONTAINER_READY_ERROR";
case ScreenExitCode::SYNC_CONSENT_FINISHED:
return "SYNC_CONSENT_FINISHED";
case ScreenExitCode::DEMO_MODE_SETUP_FINISHED:
diff --git a/chrome/browser/chromeos/login/screens/screen_exit_code.h b/chrome/browser/chromeos/login/screens/screen_exit_code.h
index 3aba6b1..b19a2cf 100644
--- a/chrome/browser/chromeos/login/screens/screen_exit_code.h
+++ b/chrome/browser/chromeos/login/screens/screen_exit_code.h
@@ -51,10 +51,6 @@
UPDATE_ERROR_UPDATING_CRITICAL_UPDATE = 25,
ENCRYPTION_MIGRATION_FINISHED = 26,
ENCRYPTION_MIGRATION_SKIPPED = 27,
- VOICE_INTERACTION_VALUE_PROP_SKIPPED = 28,
- VOICE_INTERACTION_VALUE_PROP_ACCEPTED = 29,
- WAIT_FOR_CONTAINER_READY_FINISHED = 30,
- WAIT_FOR_CONTAINER_READY_ERROR = 31,
SYNC_CONSENT_FINISHED = 32,
DEMO_MODE_SETUP_FINISHED = 33,
DEMO_MODE_SETUP_CANCELED = 34,
diff --git a/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.cc b/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.cc
deleted file mode 100644
index d42360b..0000000
--- a/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2017 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/chromeos/login/screens/voice_interaction_value_prop_screen.h"
-
-#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.h"
-#include "chrome/browser/chromeos/login/screens/base_screen_delegate.h"
-#include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen_view.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/profiles/profile_manager.h"
-
-namespace chromeos {
-namespace {
-
-constexpr const char kUserActionSkipPressed[] = "skip-pressed";
-constexpr const char kUserActionNextPressed[] = "next-pressed";
-
-} // namespace
-
-VoiceInteractionValuePropScreen::VoiceInteractionValuePropScreen(
- BaseScreenDelegate* base_screen_delegate,
- VoiceInteractionValuePropScreenView* view)
- : BaseScreen(base_screen_delegate,
- OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP),
- view_(view) {
- DCHECK(view_);
- if (view_)
- view_->Bind(this);
-}
-
-VoiceInteractionValuePropScreen::~VoiceInteractionValuePropScreen() {
- if (view_)
- view_->Unbind();
-}
-
-void VoiceInteractionValuePropScreen::Show() {
- if (!view_)
- return;
-
- view_->Show();
- GetVoiceInteractionHomeService()->OnAssistantStarted();
-}
-
-void VoiceInteractionValuePropScreen::Hide() {
- if (view_)
- view_->Hide();
-}
-
-void VoiceInteractionValuePropScreen::OnViewDestroyed(
- VoiceInteractionValuePropScreenView* view) {
- if (view_ == view)
- view_ = nullptr;
-}
-
-void VoiceInteractionValuePropScreen::OnUserAction(
- const std::string& action_id) {
- if (action_id == kUserActionSkipPressed)
- OnSkipPressed();
- else if (action_id == kUserActionNextPressed)
- OnNextPressed();
- else
- BaseScreen::OnUserAction(action_id);
-}
-
-void VoiceInteractionValuePropScreen::OnSkipPressed() {
- GetVoiceInteractionHomeService()->OnAssistantCanceled();
- Finish(ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_SKIPPED);
-}
-
-void VoiceInteractionValuePropScreen::OnNextPressed() {
- GetVoiceInteractionHomeService()->OnAssistantAppRequested();
- Finish(ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_ACCEPTED);
-}
-
-arc::ArcVoiceInteractionArcHomeService*
-VoiceInteractionValuePropScreen::GetVoiceInteractionHomeService() {
- Profile* const profile = ProfileManager::GetActiveUserProfile();
- DCHECK(profile);
- arc::ArcVoiceInteractionArcHomeService* const home_service =
- arc::ArcVoiceInteractionArcHomeService::GetForBrowserContext(profile);
- DCHECK(home_service);
- return home_service;
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.h b/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.h
deleted file mode 100644
index 56846322..0000000
--- a/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_VOICE_INTERACTION_VALUE_PROP_SCREEN_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_VOICE_INTERACTION_VALUE_PROP_SCREEN_H_
-
-#include <string>
-
-#include "base/macros.h"
-#include "chrome/browser/chromeos/login/screens/base_screen.h"
-
-namespace arc {
-class ArcVoiceInteractionArcHomeService;
-}
-
-namespace chromeos {
-
-class VoiceInteractionValuePropScreenView;
-class BaseScreenDelegate;
-
-class VoiceInteractionValuePropScreen : public BaseScreen {
- public:
- VoiceInteractionValuePropScreen(BaseScreenDelegate* base_screen_delegate,
- VoiceInteractionValuePropScreenView* view);
- ~VoiceInteractionValuePropScreen() override;
-
- // Called when view is destroyed so there's no dead reference to it.
- void OnViewDestroyed(VoiceInteractionValuePropScreenView* view_);
-
- // BaseScreen:
- void Show() override;
- void Hide() override;
- void OnUserAction(const std::string& action_id) override;
-
- private:
- void OnSkipPressed();
- void OnNextPressed();
-
- arc::ArcVoiceInteractionArcHomeService* GetVoiceInteractionHomeService();
-
- VoiceInteractionValuePropScreenView* view_;
-
- DISALLOW_COPY_AND_ASSIGN(VoiceInteractionValuePropScreen);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_VOICE_INTERACTION_VALUE_PROP_SCREEN_H_
diff --git a/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen_view.h b/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen_view.h
deleted file mode 100644
index bb403b7..0000000
--- a/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen_view.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_VOICE_INTERACTION_VALUE_PROP_SCREEN_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_VOICE_INTERACTION_VALUE_PROP_SCREEN_VIEW_H_
-
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-
-namespace chromeos {
-
-class VoiceInteractionValuePropScreen;
-
-// Interface for dependency injection between VoiceInteractionValuePropScreen
-// and its WebUI representation.
-class VoiceInteractionValuePropScreenView {
- public:
- constexpr static OobeScreen kScreenId =
- OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP;
-
- virtual ~VoiceInteractionValuePropScreenView() {}
-
- virtual void Bind(VoiceInteractionValuePropScreen* screen) = 0;
- virtual void Unbind() = 0;
- virtual void Show() = 0;
- virtual void Hide() = 0;
-
- protected:
- VoiceInteractionValuePropScreenView() = default;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(VoiceInteractionValuePropScreenView);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_VOICE_INTERACTION_VALUE_PROP_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/wait_for_container_ready_screen.cc b/chrome/browser/chromeos/login/screens/wait_for_container_ready_screen.cc
deleted file mode 100644
index 7c1cfc34..0000000
--- a/chrome/browser/chromeos/login/screens/wait_for_container_ready_screen.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2017 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/chromeos/login/screens/wait_for_container_ready_screen.h"
-
-#include "chrome/browser/chromeos/login/screens/base_screen_delegate.h"
-#include "chrome/browser/chromeos/login/screens/wait_for_container_ready_screen_view.h"
-
-namespace chromeos {
-
-WaitForContainerReadyScreen::WaitForContainerReadyScreen(
- BaseScreenDelegate* base_screen_delegate,
- WaitForContainerReadyScreenView* view)
- : BaseScreen(base_screen_delegate,
- OobeScreen::SCREEN_WAIT_FOR_CONTAINER_READY),
- view_(view) {
- DCHECK(view_);
- if (view_)
- view_->Bind(this);
-}
-
-WaitForContainerReadyScreen::~WaitForContainerReadyScreen() {
- if (view_)
- view_->Unbind();
-}
-
-void WaitForContainerReadyScreen::Show() {
- if (!view_)
- return;
-
- view_->Show();
-}
-
-void WaitForContainerReadyScreen::Hide() {
- if (view_)
- view_->Hide();
-}
-
-void WaitForContainerReadyScreen::OnViewDestroyed(
- WaitForContainerReadyScreenView* view) {
- if (view_ == view)
- view_ = nullptr;
-}
-
-void WaitForContainerReadyScreen::OnContainerReady() {
- Finish(ScreenExitCode::WAIT_FOR_CONTAINER_READY_FINISHED);
-}
-
-void WaitForContainerReadyScreen::OnContainerError() {
- Finish(ScreenExitCode::WAIT_FOR_CONTAINER_READY_ERROR);
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/wait_for_container_ready_screen.h b/chrome/browser/chromeos/login/screens/wait_for_container_ready_screen.h
deleted file mode 100644
index 2224b52..0000000
--- a/chrome/browser/chromeos/login/screens/wait_for_container_ready_screen.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WAIT_FOR_CONTAINER_READY_SCREEN_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WAIT_FOR_CONTAINER_READY_SCREEN_H_
-
-#include <string>
-
-#include "base/macros.h"
-#include "chrome/browser/chromeos/login/screens/base_screen.h"
-
-namespace chromeos {
-
-class WaitForContainerReadyScreenView;
-class BaseScreenDelegate;
-
-class WaitForContainerReadyScreen : public BaseScreen {
- public:
- WaitForContainerReadyScreen(BaseScreenDelegate* base_screen_delegate,
- WaitForContainerReadyScreenView* view);
- ~WaitForContainerReadyScreen() override;
-
- // BaseScreen:
- void Show() override;
- void Hide() override;
-
- // Called when view is destroyed so there's no dead reference to it.
- void OnViewDestroyed(WaitForContainerReadyScreenView* view_);
-
- // Called when the container is ready, exit the screen.
- void OnContainerReady();
-
- // Called when error occurs or timeout, exit the screen.
- void OnContainerError();
-
- private:
- WaitForContainerReadyScreenView* view_;
-
- DISALLOW_COPY_AND_ASSIGN(WaitForContainerReadyScreen);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WAIT_FOR_CONTAINER_READY_SCREEN_H_
diff --git a/chrome/browser/chromeos/login/screens/wait_for_container_ready_screen_view.h b/chrome/browser/chromeos/login/screens/wait_for_container_ready_screen_view.h
deleted file mode 100644
index a9f67cd..0000000
--- a/chrome/browser/chromeos/login/screens/wait_for_container_ready_screen_view.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WAIT_FOR_CONTAINER_READY_SCREEN_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WAIT_FOR_CONTAINER_READY_SCREEN_VIEW_H_
-
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-
-namespace chromeos {
-
-class WaitForContainerReadyScreen;
-
-// Interface for dependency injection between WaitForContainerReadyScreen
-// and its WebUI representation.
-class WaitForContainerReadyScreenView {
- public:
- constexpr static OobeScreen kScreenId =
- OobeScreen::SCREEN_WAIT_FOR_CONTAINER_READY;
-
- virtual ~WaitForContainerReadyScreenView() {}
-
- virtual void Bind(WaitForContainerReadyScreen* screen) = 0;
- virtual void Unbind() = 0;
- virtual void Show() = 0;
- virtual void Hide() = 0;
-
- protected:
- WaitForContainerReadyScreenView() = default;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WaitForContainerReadyScreenView);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WAIT_FOR_CONTAINER_READY_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/ui/fake_login_display_host.cc b/chrome/browser/chromeos/login/ui/fake_login_display_host.cc
index d73cd40..58479bb 100644
--- a/chrome/browser/chromeos/login/ui/fake_login_display_host.cc
+++ b/chrome/browser/chromeos/login/ui/fake_login_display_host.cc
@@ -94,14 +94,6 @@
void FakeLoginDisplayHost::StartArcKiosk(const AccountId& account_id) {}
-void FakeLoginDisplayHost::StartVoiceInteractionOobe() {
- is_voice_interaction_oobe_ = true;
-}
-
-bool FakeLoginDisplayHost::IsVoiceInteractionOobe() {
- return is_voice_interaction_oobe_;
-}
-
void FakeLoginDisplayHost::CompleteLogin(const UserContext& user_context) {}
void FakeLoginDisplayHost::OnGaiaScreenReady() {}
diff --git a/chrome/browser/chromeos/login/ui/fake_login_display_host.h b/chrome/browser/chromeos/login/ui/fake_login_display_host.h
index 9b33ac8e..2e06c28 100644
--- a/chrome/browser/chromeos/login/ui/fake_login_display_host.h
+++ b/chrome/browser/chromeos/login/ui/fake_login_display_host.h
@@ -45,8 +45,6 @@
bool is_auto_launch) override;
void StartDemoAppLaunch() override;
void StartArcKiosk(const AccountId& account_id) override;
- void StartVoiceInteractionOobe() override;
- bool IsVoiceInteractionOobe() override;
void CompleteLogin(const chromeos::UserContext& user_context) override;
void OnGaiaScreenReady() override;
void SetDisplayEmail(const std::string& email) override;
@@ -73,8 +71,6 @@
private:
class FakeBaseScreen;
- bool is_voice_interaction_oobe_ = false;
-
// SessionManager is required by the constructor of WizardController.
std::unique_ptr<session_manager::SessionManager> session_manager_;
std::unique_ptr<FakeBaseScreen> fake_screen_;
diff --git a/chrome/browser/chromeos/login/ui/login_display_host.h b/chrome/browser/chromeos/login/ui/login_display_host.h
index cefe92fe..6d91e9eb 100644
--- a/chrome/browser/chromeos/login/ui/login_display_host.h
+++ b/chrome/browser/chromeos/login/ui/login_display_host.h
@@ -129,12 +129,6 @@
// Starts ARC kiosk splash screen.
virtual void StartArcKiosk(const AccountId& account_id) = 0;
- // Start voice interaction OOBE.
- virtual void StartVoiceInteractionOobe() = 0;
-
- // Returns whether current host is for voice interaction OOBE.
- virtual bool IsVoiceInteractionOobe() = 0;
-
// Show the gaia dialog. |can_close| determines if the user is allowed to
// close the dialog. If available, |account| is preloaded in the gaia dialog.
virtual void ShowGaiaDialog(
diff --git a/chrome/browser/chromeos/login/ui/login_display_host_mojo.cc b/chrome/browser/chromeos/login/ui/login_display_host_mojo.cc
index a81213a..be1b8ce 100644
--- a/chrome/browser/chromeos/login/ui/login_display_host_mojo.cc
+++ b/chrome/browser/chromeos/login/ui/login_display_host_mojo.cc
@@ -236,15 +236,6 @@
NOTIMPLEMENTED();
}
-void LoginDisplayHostMojo::StartVoiceInteractionOobe() {
- NOTIMPLEMENTED();
-}
-
-bool LoginDisplayHostMojo::IsVoiceInteractionOobe() {
- NOTIMPLEMENTED();
- return false;
-}
-
void LoginDisplayHostMojo::ShowGaiaDialog(
bool can_close,
const base::Optional<AccountId>& prefilled_account) {
diff --git a/chrome/browser/chromeos/login/ui/login_display_host_mojo.h b/chrome/browser/chromeos/login/ui/login_display_host_mojo.h
index b30a530..b2d12fb 100644
--- a/chrome/browser/chromeos/login/ui/login_display_host_mojo.h
+++ b/chrome/browser/chromeos/login/ui/login_display_host_mojo.h
@@ -82,8 +82,6 @@
void OnStartAppLaunch() override;
void OnStartArcKiosk() override;
void OnBrowserCreated() override;
- void StartVoiceInteractionOobe() override;
- bool IsVoiceInteractionOobe() override;
void ShowGaiaDialog(
bool can_close,
const base::Optional<AccountId>& prefilled_account) override;
diff --git a/chrome/browser/chromeos/login/ui/login_display_host_webui.cc b/chrome/browser/chromeos/login/ui/login_display_host_webui.cc
index ccd0709..3f0446d4f 100644
--- a/chrome/browser/chromeos/login/ui/login_display_host_webui.cc
+++ b/chrome/browser/chromeos/login/ui/login_display_host_webui.cc
@@ -709,10 +709,6 @@
login_view_->set_should_emit_login_prompt_visible(false);
}
-bool LoginDisplayHostWebUI::IsVoiceInteractionOobe() {
- return is_voice_interaction_oobe_;
-}
-
////////////////////////////////////////////////////////////////////////////////
// LoginDisplayHostWebUI, public
@@ -835,11 +831,6 @@
}
if (GetOobeUI()) {
- // Reset widget size for voice interaction OOBE, since the screen rotation
- // will break the widget size if it is not full screen.
- if (is_voice_interaction_oobe_)
- login_window_->SetSize(primary_display.work_area_size());
-
const gfx::Size& size = primary_display.size();
GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(),
size.height());
@@ -992,20 +983,11 @@
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
params.bounds = CalculateScreenBounds(gfx::Size());
- // Disable fullscreen state for voice interaction OOBE since the shelf should
- // be visible.
- if (!is_voice_interaction_oobe_)
- params.show_state = ui::SHOW_STATE_FULLSCREEN;
+ params.show_state = ui::SHOW_STATE_FULLSCREEN;
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
- // Put the voice interaction oobe inside AlwaysOnTop container instead of
- // LockScreenContainer.
- if (is_voice_interaction_oobe_) {
- params.keep_on_top = true;
- } else {
- ash_util::SetupWidgetInitParamsForContainer(
- ¶ms, ash::kShellWindowId_LockScreenContainer);
- }
+ ash_util::SetupWidgetInitParamsForContainer(
+ ¶ms, ash::kShellWindowId_LockScreenContainer);
login_window_ = new views::Widget;
login_window_->Init(params);
@@ -1017,13 +999,9 @@
DisableRestrictiveProxyCheckForTest();
}
- // For voice interaction OOBE, we do not want the animation here.
- if (!is_voice_interaction_oobe_) {
- login_window_->SetVisibilityAnimationDuration(
- base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs));
- login_window_->SetVisibilityAnimationTransition(
- views::Widget::ANIMATE_HIDE);
- }
+ login_window_->SetVisibilityAnimationDuration(
+ base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs));
+ login_window_->SetVisibilityAnimationTransition(views::Widget::ANIMATE_HIDE);
login_window_->AddObserver(this);
login_window_->AddRemovalsObserver(this);
@@ -1106,14 +1084,6 @@
}
}
-void LoginDisplayHostWebUI::StartVoiceInteractionOobe() {
- is_voice_interaction_oobe_ = true;
- finalize_animation_type_ = ANIMATION_NONE;
- StartWizard(OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP);
- // We should emit this signal only at login screen (after reboot or sign out).
- login_view_->set_should_emit_login_prompt_visible(false);
-}
-
void LoginDisplayHostWebUI::ShowGaiaDialog(
bool can_close,
const base::Optional<AccountId>& prefilled_account) {
@@ -1162,7 +1132,7 @@
if (login_prompt_visible_time_.is_null())
return;
- if (is_voice_interaction_oobe_ || !CanPlayStartupSound())
+ if (!CanPlayStartupSound())
return;
need_to_play_startup_sound_ = false;
diff --git a/chrome/browser/chromeos/login/ui/login_display_host_webui.h b/chrome/browser/chromeos/login/ui/login_display_host_webui.h
index 818c46b..63a10bd 100644
--- a/chrome/browser/chromeos/login/ui/login_display_host_webui.h
+++ b/chrome/browser/chromeos/login/ui/login_display_host_webui.h
@@ -74,8 +74,6 @@
void OnPreferencesChanged() override;
void OnStartAppLaunch() override;
void OnStartArcKiosk() override;
- bool IsVoiceInteractionOobe() override;
- void StartVoiceInteractionOobe() override;
void OnBrowserCreated() override;
void ShowGaiaDialog(
bool can_close,
@@ -270,8 +268,6 @@
// After OOBE is completed, this is always initialized with true.
bool oobe_startup_sound_played_ = false;
- bool is_voice_interaction_oobe_ = false;
-
// True if we need to play startup sound when audio device becomes available.
bool need_to_play_startup_sound_ = false;
diff --git a/chrome/browser/chromeos/login/ui/mock_login_display_host.h b/chrome/browser/chromeos/login/ui/mock_login_display_host.h
index b6f7bbb4..580ae8c 100644
--- a/chrome/browser/chromeos/login/ui/mock_login_display_host.h
+++ b/chrome/browser/chromeos/login/ui/mock_login_display_host.h
@@ -51,8 +51,6 @@
MOCK_METHOD3(StartAppLaunch, void(const std::string&, bool, bool));
MOCK_METHOD0(StartDemoAppLaunch, void(void));
MOCK_METHOD1(StartArcKiosk, void(const AccountId&));
- MOCK_METHOD0(StartVoiceInteractionOobe, void(void));
- MOCK_METHOD0(IsVoiceInteractionOobe, bool(void));
MOCK_METHOD2(ShowGaiaDialog,
void(bool can_close,
const base::Optional<AccountId>& prefilled_account));
diff --git a/chrome/browser/chromeos/login/ui/webui_login_view.cc b/chrome/browser/chromeos/login/ui/webui_login_view.cc
index 3abc23d..f1c5c5b 100644
--- a/chrome/browser/chromeos/login/ui/webui_login_view.cc
+++ b/chrome/browser/chromeos/login/ui/webui_login_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/login/ui/webui_login_view.h"
#include <memory>
+#include <utility>
#include "ash/public/cpp/ash_features.h"
#include "base/bind.h"
@@ -547,13 +548,6 @@
}
bool WebUILoginView::MoveFocusToSystemTray(bool reverse) {
- // The focus should not move to the system tray if voice interaction OOBE is
- // active.
- if (LoginDisplayHost::default_host() &&
- LoginDisplayHost::default_host()->IsVoiceInteractionOobe()) {
- return false;
- }
-
LoginScreenClient::Get()->login_screen()->FocusLoginShelf(reverse);
return true;
}
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index ad900e5e..b80d0621 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -32,7 +32,6 @@
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h"
#include "chrome/browser/chromeos/customization/customization_document.h"
#include "chrome/browser/chromeos/login/configuration_keys.h"
#include "chrome/browser/chromeos/login/demo_mode/demo_session.h"
@@ -70,8 +69,6 @@
#include "chrome/browser/chromeos/login/screens/update_required_screen.h"
#include "chrome/browser/chromeos/login/screens/update_screen.h"
#include "chrome/browser/chromeos/login/screens/user_image_screen.h"
-#include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.h"
-#include "chrome/browser/chromeos/login/screens/wait_for_container_ready_screen.h"
#include "chrome/browser/chromeos/login/screens/welcome_view.h"
#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h"
#include "chrome/browser/chromeos/login/session/user_session_manager.h"
@@ -429,12 +426,6 @@
} else if (screen == OobeScreen::SCREEN_ENCRYPTION_MIGRATION) {
return std::make_unique<EncryptionMigrationScreen>(
this, oobe_ui->GetEncryptionMigrationScreenView());
- } else if (screen == OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP) {
- return std::make_unique<VoiceInteractionValuePropScreen>(
- this, oobe_ui->GetVoiceInteractionValuePropScreenView());
- } else if (screen == OobeScreen::SCREEN_WAIT_FOR_CONTAINER_READY) {
- return std::make_unique<WaitForContainerReadyScreen>(
- this, oobe_ui->GetWaitForContainerReadyScreenView());
} else if (screen == OobeScreen::SCREEN_SUPERVISION_TRANSITION) {
return std::make_unique<SupervisionTransitionScreen>(
this, oobe_ui->GetSupervisionTransitionScreenView());
@@ -606,14 +597,8 @@
UpdateStatusAreaVisibilityForScreen(
OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE);
SetCurrentScreen(GetScreen(OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE));
- // Assistant Wizard also uses wizard for ARC opt-in, unlike other scenarios
- // which use ArcSupport for now, because we're interested in only OOBE flow.
- // Note that this part also needs to be updated on b/65861628.
- // TODO(khmel): add unit test once we have support for OobeUI.
- if (!GetLoginDisplayHost()->IsVoiceInteractionOobe()) {
- ProfileManager::GetActiveUserProfile()->GetPrefs()->SetBoolean(
- arc::prefs::kArcTermsShownInOobe, true);
- }
+ ProfileManager::GetActiveUserProfile()->GetPrefs()->SetBoolean(
+ arc::prefs::kArcTermsShownInOobe, true);
} else {
ShowAssistantOptInFlowScreen();
}
@@ -672,33 +657,6 @@
SetCurrentScreen(GetScreen(OobeScreen::SCREEN_ENCRYPTION_MIGRATION));
}
-void WizardController::ShowVoiceInteractionValuePropScreen() {
- if (ShouldShowVoiceInteractionValueProp()) {
- VLOG(1) << "Showing voice interaction value prop screen.";
- UpdateStatusAreaVisibilityForScreen(
- OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP);
- SetCurrentScreen(
- GetScreen(OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP));
- } else {
- OnOobeFlowFinished();
- }
-}
-
-void WizardController::ShowWaitForContainerReadyScreen() {
- DCHECK(is_in_session_oobe_);
- // At this point we could make sure the value prop flow has been accepted.
- // Set the value prop pref as accepted in framework service.
- auto* service =
- arc::ArcVoiceInteractionFrameworkService::GetForBrowserContext(
- ProfileManager::GetActiveUserProfile());
- if (service)
- service->SetVoiceInteractionSetupCompleted();
-
- UpdateStatusAreaVisibilityForScreen(
- OobeScreen::SCREEN_WAIT_FOR_CONTAINER_READY);
- SetCurrentScreen(GetScreen(OobeScreen::SCREEN_WAIT_FOR_CONTAINER_READY));
-}
-
void WizardController::ShowSupervisionTransitionScreen() {
VLOG(1) << "Showing supervision transition screen.";
UpdateStatusAreaVisibilityForScreen(
@@ -986,11 +944,6 @@
return;
}
- if (is_in_session_oobe_) {
- ShowWaitForContainerReadyScreen();
- return;
- }
-
// If the recommend app screen should be shown, show it after the user
// finished with the PlayStore Terms of Service. Otherwise, advance to the
// assistant opt-in flow screen.
@@ -1019,23 +972,6 @@
ShowAssistantOptInFlowScreen();
}
-void WizardController::OnVoiceInteractionValuePropSkipped() {
- OnOobeFlowFinished();
-}
-
-void WizardController::OnVoiceInteractionValuePropAccepted() {
- if (is_in_session_oobe_ && arc::IsArcTermsOfServiceOobeNegotiationNeeded()) {
- ShowArcTermsOfServiceScreen();
- return;
- }
- ShowWaitForContainerReadyScreen();
-}
-
-void WizardController::OnWaitForContainerReadyFinished() {
- OnOobeFlowFinished();
- StartVoiceInteractionSetupWizard();
-}
-
void WizardController::OnSupervisionTransitionFinished() {
OnOobeFlowFinished();
}
@@ -1382,10 +1318,6 @@
ShowDeviceDisabledScreen();
} else if (screen == OobeScreen::SCREEN_ENCRYPTION_MIGRATION) {
ShowEncryptionMigrationScreen();
- } else if (screen == OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP) {
- ShowVoiceInteractionValuePropScreen();
- } else if (screen == OobeScreen::SCREEN_WAIT_FOR_CONTAINER_READY) {
- ShowWaitForContainerReadyScreen();
} else if (screen == OobeScreen::SCREEN_UPDATE_REQUIRED) {
ShowUpdateRequiredScreen();
} else if (screen == OobeScreen::SCREEN_ASSISTANT_OPTIN_FLOW) {
@@ -1531,18 +1463,6 @@
case ScreenExitCode::WRONG_HWID_WARNING_SKIPPED:
OnWrongHWIDWarningSkipped();
break;
- case ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_SKIPPED:
- OnVoiceInteractionValuePropSkipped();
- break;
- case ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_ACCEPTED:
- OnVoiceInteractionValuePropAccepted();
- break;
- case ScreenExitCode::WAIT_FOR_CONTAINER_READY_FINISHED:
- OnWaitForContainerReadyFinished();
- break;
- case ScreenExitCode::WAIT_FOR_CONTAINER_READY_ERROR:
- OnOobeFlowFinished();
- break;
case ScreenExitCode::SYNC_CONSENT_FINISHED:
OnSyncConsentFinished();
break;
@@ -1826,31 +1746,6 @@
return true;
}
-bool WizardController::ShouldShowVoiceInteractionValueProp() const {
- // If the OOBE flow was initiated from voice interaction shortcut, we will
- // show Arc terms later.
- if (!is_in_session_oobe_ && !arc::IsArcPlayStoreEnabledForProfile(
- ProfileManager::GetActiveUserProfile())) {
- VLOG(1) << "Skip Voice Interaction Value Prop screen because Arc Terms is "
- << "skipped.";
- return false;
- }
- if (!chromeos::switches::IsVoiceInteractionEnabled()) {
- VLOG(1) << "Skip Voice Interaction Value Prop screen because voice "
- << "interaction service is disabled.";
- return false;
- }
- return true;
-}
-
-void WizardController::StartVoiceInteractionSetupWizard() {
- auto* service =
- arc::ArcVoiceInteractionFrameworkService::GetForBrowserContext(
- ProfileManager::GetActiveUserProfile());
- if (service)
- service->StartVoiceInteractionSetupWizard();
-}
-
void WizardController::StartEnrollmentScreen(bool force_interactive) {
VLOG(1) << "Showing enrollment screen."
<< " Forcing interactive enrollment: " << force_interactive << ".";
diff --git a/chrome/browser/chromeos/login/wizard_controller.h b/chrome/browser/chromeos/login/wizard_controller.h
index 93319ac..88842f78 100644
--- a/chrome/browser/chromeos/login/wizard_controller.h
+++ b/chrome/browser/chromeos/login/wizard_controller.h
@@ -177,8 +177,6 @@
void ShowHIDDetectionScreen();
void ShowDeviceDisabledScreen();
void ShowEncryptionMigrationScreen();
- void ShowVoiceInteractionValuePropScreen();
- void ShowWaitForContainerReadyScreen();
void ShowSupervisionTransitionScreen();
void ShowUpdateRequiredScreen();
void ShowAssistantOptInFlowScreen();
@@ -223,8 +221,6 @@
void OnRecommendAppsSkipped();
void OnRecommendAppsSelected();
void OnAppDownloadingFinished();
- void OnVoiceInteractionValuePropSkipped();
- void OnVoiceInteractionValuePropAccepted();
void OnAutoEnrollmentCheckCompleted();
void OnDemoSetupFinished();
void OnDemoSetupCanceled();
@@ -323,9 +319,6 @@
// Returns false if timezone has already been resolved.
bool SetOnTimeZoneResolvedForTesting(const base::Closure& callback);
- // Returns true if voice interaction value prop should be shown.
- bool ShouldShowVoiceInteractionValueProp() const;
-
// Start voice interaction setup wizard in container
void StartVoiceInteractionSetupWizard();
diff --git a/chrome/browser/resources/chromeos/login/custom_elements_login.html b/chrome/browser/resources/chromeos/login/custom_elements_login.html
index 058144b..4f39445 100644
--- a/chrome/browser/resources/chromeos/login/custom_elements_login.html
+++ b/chrome/browser/resources/chromeos/login/custom_elements_login.html
@@ -24,8 +24,6 @@
<include src="oobe_enrollment.html">
<include src="oobe_reset.html">
<include src="oobe_reset_confirmation_overlay.html">
-<include src="oobe_voice_interaction_value_prop.html">
-<include src="oobe_wait_for_container_ready.html">
<include src="oobe_supervision_transition.html">
<include src="encryption_migration.html">
<include src="enrollment_license_card.html">
diff --git a/chrome/browser/resources/chromeos/login/custom_elements_login.js b/chrome/browser/resources/chromeos/login/custom_elements_login.js
index ca82561..146da25 100644
--- a/chrome/browser/resources/chromeos/login/custom_elements_login.js
+++ b/chrome/browser/resources/chromeos/login/custom_elements_login.js
@@ -30,8 +30,6 @@
// <include src="oobe_reset.js">
// <include src="oobe_reset_confirmation_overlay.js">
// <include src="encryption_migration.js">
-// <include src="oobe_voice_interaction_value_prop.js">
-// <include src="oobe_wait_for_container_ready.js">
// <include src="oobe_supervision_transition.js">
// <include src="enrollment_license_card.js">
// <include src="sync_consent.js">
diff --git a/chrome/browser/resources/chromeos/login/custom_elements_oobe.html b/chrome/browser/resources/chromeos/login/custom_elements_oobe.html
index 32f671d..3e206d96 100644
--- a/chrome/browser/resources/chromeos/login/custom_elements_oobe.html
+++ b/chrome/browser/resources/chromeos/login/custom_elements_oobe.html
@@ -29,8 +29,6 @@
<include src="oobe_network.html">
<include src="oobe_network_icons.html">
<include src="oobe_welcome.html">
-<include src="oobe_voice_interaction_value_prop.html">
-<include src="oobe_wait_for_container_ready.html">
<include src="oobe_supervision_transition.html">
<include src="offline_ad_login.html">
<include src="active_directory_password_change.html">
diff --git a/chrome/browser/resources/chromeos/login/custom_elements_oobe.js b/chrome/browser/resources/chromeos/login/custom_elements_oobe.js
index e8269830..8d15efb 100644
--- a/chrome/browser/resources/chromeos/login/custom_elements_oobe.js
+++ b/chrome/browser/resources/chromeos/login/custom_elements_oobe.js
@@ -42,8 +42,6 @@
// <include src="offline_ad_login.js">
// <include src="active_directory_password_change.js">
// <include src="arc_terms_of_service.js">
-// <include src="oobe_voice_interaction_value_prop.js">
-// <include src="oobe_wait_for_container_ready.js">
// <include src="oobe_supervision_transition.js">
// <include src="enrollment_license_card.js">
// <include src="sync_consent.js">
diff --git a/chrome/browser/resources/chromeos/login/login.js b/chrome/browser/resources/chromeos/login/login.js
index 34408f3..6f6908d7 100644
--- a/chrome/browser/resources/chromeos/login/login.js
+++ b/chrome/browser/resources/chromeos/login/login.js
@@ -55,8 +55,6 @@
login.UnrecoverableCryptohomeErrorScreen.register();
login.ActiveDirectoryPasswordChangeScreen.register(/* lazyInit= */ true);
login.EncryptionMigrationScreen.register();
- login.VoiceInteractionValuePropScreen.register();
- login.WaitForContainerReadyScreen.register();
login.SupervisionTransitionScreen.register();
login.UpdateRequiredScreen.register();
login.DemoSetupScreen.register();
diff --git a/chrome/browser/resources/chromeos/login/login_non_lock_shared.html b/chrome/browser/resources/chromeos/login/login_non_lock_shared.html
index 763d0a9..c9d33d6e 100644
--- a/chrome/browser/resources/chromeos/login/login_non_lock_shared.html
+++ b/chrome/browser/resources/chromeos/login/login_non_lock_shared.html
@@ -14,8 +14,6 @@
<link rel="stylesheet" href="oobe_screen_terms_of_service.css">
<link rel="stylesheet" href="oobe_screen_auto_enrollment_check.css">
<link rel="stylesheet" href="oobe_screen_user_image.css">
-<link rel="stylesheet" href="oobe_screen_voice_interaction_value_prop.css">
-<link rel="stylesheet" href="oobe_screen_wait_for_container_ready.css">
<link rel="stylesheet" href="oobe_screen_supervision_transition.css">
<link rel="stylesheet" href="screen_app_launch_splash.css">
diff --git a/chrome/browser/resources/chromeos/login/login_non_lock_shared.js b/chrome/browser/resources/chromeos/login/login_non_lock_shared.js
index 67c9428..52b983c 100644
--- a/chrome/browser/resources/chromeos/login/login_non_lock_shared.js
+++ b/chrome/browser/resources/chromeos/login/login_non_lock_shared.js
@@ -13,8 +13,6 @@
// <include src="oobe_screen_enable_kiosk.js">
// <include src="oobe_screen_terms_of_service.js">
// <include src="oobe_screen_user_image.js">
-// <include src="oobe_screen_voice_interaction_value_prop.js">
-// <include src="oobe_screen_wait_for_container_ready.js">
// <include src="oobe_screen_supervision_transition.js">
// <include src="oobe_screen_assistant_optin_flow.js">
// <include src="oobe_select.js">
diff --git a/chrome/browser/resources/chromeos/login/login_screens.html b/chrome/browser/resources/chromeos/login/login_screens.html
index 753d4302a..f20bdae 100644
--- a/chrome/browser/resources/chromeos/login/login_screens.html
+++ b/chrome/browser/resources/chromeos/login/login_screens.html
@@ -3,8 +3,6 @@
<include src="oobe_screen_enable_kiosk.html">
<include src="oobe_screen_terms_of_service.html">
<include src="oobe_screen_user_image.html">
-<include src="oobe_screen_voice_interaction_value_prop.html">
-<include src="oobe_screen_wait_for_container_ready.html">
<include src="oobe_screen_supervision_transition.html">
<include src="oobe_screen_assistant_optin_flow.html">
<include src="../../../../../ui/login/account_picker/screen_account_picker.html">
diff --git a/chrome/browser/resources/chromeos/login/md_login.js b/chrome/browser/resources/chromeos/login/md_login.js
index 7be4f3c..9fc51d7 100644
--- a/chrome/browser/resources/chromeos/login/md_login.js
+++ b/chrome/browser/resources/chromeos/login/md_login.js
@@ -55,8 +55,6 @@
login.UnrecoverableCryptohomeErrorScreen.register();
login.ActiveDirectoryPasswordChangeScreen.register(/* lazyInit= */ true);
login.EncryptionMigrationScreen.register();
- login.VoiceInteractionValuePropScreen.register();
- login.WaitForContainerReadyScreen.register();
login.SupervisionTransitionScreen.register();
login.UpdateRequiredScreen.register();
login.DiscoverScreen.register();
diff --git a/chrome/browser/resources/chromeos/login/md_login_screens.html b/chrome/browser/resources/chromeos/login/md_login_screens.html
index a21a6eb..0e33276a 100644
--- a/chrome/browser/resources/chromeos/login/md_login_screens.html
+++ b/chrome/browser/resources/chromeos/login/md_login_screens.html
@@ -3,8 +3,6 @@
<include src="oobe_screen_enable_kiosk.html">
<include src="oobe_screen_terms_of_service.html">
<include src="oobe_screen_user_image.html">
-<include src="oobe_screen_voice_interaction_value_prop.html">
-<include src="oobe_screen_wait_for_container_ready.html">
<include src="oobe_screen_supervision_transition.html">
<include src="oobe_screen_assistant_optin_flow.html">
<include src="../../../../../ui/login/account_picker/md_screen_account_picker.html">
diff --git a/chrome/browser/resources/chromeos/login/oobe.js b/chrome/browser/resources/chromeos/login/oobe.js
index fa2fa3c..e72a9fd5 100644
--- a/chrome/browser/resources/chromeos/login/oobe.js
+++ b/chrome/browser/resources/chromeos/login/oobe.js
@@ -60,8 +60,6 @@
login.FatalErrorScreen.register();
login.DeviceDisabledScreen.register();
login.ActiveDirectoryPasswordChangeScreen.register(/* lazyInit= */ true);
- login.VoiceInteractionValuePropScreen.register();
- login.WaitForContainerReadyScreen.register();
login.SupervisionTransitionScreen.register();
login.DemoSetupScreen.register();
login.DemoPreferencesScreen.register();
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_voice_interaction_value_prop.css b/chrome/browser/resources/chromeos/login/oobe_screen_voice_interaction_value_prop.css
deleted file mode 100644
index 50c0ad4..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_screen_voice_interaction_value_prop.css
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Copyright 2017 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. */
-
-#voice-interaction-value-prop {
- display: flex;
- flex-flow: column;
- font-size: 16px;
- min-height: 0;
- width: 576px;
-}
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_voice_interaction_value_prop.html b/chrome/browser/resources/chromeos/login/oobe_screen_voice_interaction_value_prop.html
deleted file mode 100644
index 6a53ee5..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_screen_voice_interaction_value_prop.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!-- Copyright 2017 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. -->
-
-<div class="step faded hidden no-logo" id="voice-interaction-value-prop"
- role="group" hidden>
- <voice-interaction-value-prop-md
- id="voice-interaction-value-prop-md">
- </voice-interaction-value-prop-md>
-</div>
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_voice_interaction_value_prop.js b/chrome/browser/resources/chromeos/login/oobe_screen_voice_interaction_value_prop.js
deleted file mode 100644
index abf7f28..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_screen_voice_interaction_value_prop.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2017 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.
-
-/**
- * @fileoverview Oobe Voice Interaction Value Prop screen implementation.
- */
-
-login.createScreen(
- 'VoiceInteractionValuePropScreen', 'voice-interaction-value-prop',
- function() {
- return {
-
- /** @Override */
- onBeforeShow: function(data) {
- Oobe.getInstance().headerHidden = true;
- $('voice-interaction-value-prop-md').locale =
- loadTimeData.getString('locale');
- $('voice-interaction-value-prop-md').onBeforeShow();
- $('voice-interaction-value-prop-md').onShow();
- }
- };
- });
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_wait_for_container_ready.css b/chrome/browser/resources/chromeos/login/oobe_screen_wait_for_container_ready.css
deleted file mode 100644
index a960203..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_screen_wait_for_container_ready.css
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Copyright 2017 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. */
-
-#wait-for-container-ready {
- display: flex;
- flex-flow: column;
- font-size: 16px;
- min-height: 0;
-}
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_wait_for_container_ready.html b/chrome/browser/resources/chromeos/login/oobe_screen_wait_for_container_ready.html
deleted file mode 100644
index 74b770a..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_screen_wait_for_container_ready.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!-- Copyright 2017 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. -->
-
-<div class="step faded hidden no-logo" id="wait-for-container-ready"
- role="group" hidden>
- <wait-for-container-ready-md
- id="wait-for-container-ready-md">
- </wait-for-container-ready-md>
-</div>
-
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_wait_for_container_ready.js b/chrome/browser/resources/chromeos/login/oobe_screen_wait_for_container_ready.js
deleted file mode 100644
index db964c2..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_screen_wait_for_container_ready.js
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2017 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.
-
-/**
- * @fileoverview Oobe Wait For Container Ready screen implementation.
- */
-
-login.createScreen(
- 'WaitForContainerReadyScreen', 'wait-for-container-ready', function() {
- return {
-
- /** @Override */
- onBeforeShow: function(data) {
- Oobe.getInstance().headerHidden = true;
- $('wait-for-container-ready-md').onBeforeShow();
- },
- };
- });
diff --git a/chrome/browser/resources/chromeos/login/oobe_screens.html b/chrome/browser/resources/chromeos/login/oobe_screens.html
index d54e4a0c..714694f 100644
--- a/chrome/browser/resources/chromeos/login/oobe_screens.html
+++ b/chrome/browser/resources/chromeos/login/oobe_screens.html
@@ -10,8 +10,6 @@
<include src="oobe_screen_auto_enrollment_check.html">
<include src="oobe_screen_user_image.html">
<include src="oobe_screen_hid_detection.html">
-<include src="oobe_screen_voice_interaction_value_prop.html">
-<include src="oobe_screen_wait_for_container_ready.html">
<include src="oobe_screen_supervision_transition.html">
<include src="oobe_screen_demo_setup.html">
<include src="oobe_screen_demo_preferences.html">
diff --git a/chrome/browser/resources/chromeos/login/oobe_voice_interaction_value_prop.css b/chrome/browser/resources/chromeos/login/oobe_voice_interaction_value_prop.css
deleted file mode 100644
index 007dde1..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_voice_interaction_value_prop.css
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright 2017 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. */
-
-#value-prop-view {
- display: block;
- height: 372px;
- margin: auto;
- padding: 0;
-}
-
-.value-prop-loading #retry-button,
-.value-prop-loaded #retry-button,
-.value-prop-error #next-button {
- display: none;
-}
-
-#loading-container,
-#error-container,
-#view-container {
- position: absolute;
- visibility: hidden;
- width: 480px;
-}
-
-.value-prop-loading-animation #loading-container,
-.value-prop-loaded #view-container,
-.value-prop-error #error-container {
- visibility: visible;
-}
-
-.value-prop-loading #retry-button,
-.value-prop-loading #next-button,
-.value-prop-loading #skip-button {
- pointer-events: none;
-}
-
-.title {
- color: rgb(32, 33, 36); /* #202124 */
- font-size: 18px;
- font-weight: normal;
- margin: 0;
- min-height: 71px; /* 64 title + 7 (distance to baseline for 28px font) */
-}
-
-#subtitle {
- color: rgb(32, 33, 36); /* #202124 */
- font-size: 13px;
- line-height: 18px;
- margin: 12px 0 0 0;
- min-height: 57px; /* 64 - 7 (distance to baseline for title font) */
-}
-
-#loading-message {
- color: rgba(0, 0, 0, .54);
- font-size: 12px;
- line: 17px;
- padding: 168px 0 0 0;
-}
-
-paper-progress {
- --paper-progress-active-color: rgb(66, 133, 244);
- --paper-progress-container-color: #CEE0FC;
- --paper-progress-secondary-color: rgb(66, 133, 244);
- display: block;
- height: 3px;
- padding: 4px 0 0 0;
- width: 100%;
-}
-
-#skip-button {
- color: rgb(66, 133, 244);
-}
-
-#retry-button {
- margin-inline-end: 18px;
-}
-
-#next-button {
- margin-inline-end: 18px;
-}
diff --git a/chrome/browser/resources/chromeos/login/oobe_voice_interaction_value_prop.html b/chrome/browser/resources/chromeos/login/oobe_voice_interaction_value_prop.html
deleted file mode 100644
index 43a4128..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_voice_interaction_value_prop.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!-- Copyright 2017 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. -->
-
-<dom-module id="voice-interaction-value-prop-md">
- <template>
- <link rel="stylesheet" href="oobe_flex_layout.css">
- <link rel="stylesheet" href="oobe_voice_interaction_value_prop.css">
- <oobe-dialog id="voice-dialog" class="value-prop-loading" role="dialog"
- hide-shadow has-buttons no-footer-padding android no-header>
- <div slot="footer">
- <div id="view-container">
- <webview id="value-prop-view"></webview>
- </div>
- <div id="error-container">
- <div class="title"
- i18n-content="voiceInteractionValuePropLoadErrorTitle"></div>
- <div id="subtitle">
- <div i18n-content="voiceInteractionValuePropLoadErrorMessage"></div>
- </div>
- </div>
- <div id="loading-container">
- <div id="loading-message">
- <div i18n-content="voiceInteractionValuePropLoading"></div>
- </div>
- <paper-progress class="slow" indeterminate></paper-progress>
- </div>
- </div>
- <div slot="bottom-buttons" class="flex layout horizontal">
- <oobe-text-button id="skip-button" android on-tap="onSkipTap_"
- disabled="[[valuePropButtonsDisabled]]">
- <div i18n-content="voiceInteractionValuePropSkipButton"></div>
- </oobe-text-button>
- <div class="flex"></div>
- <oobe-text-button id="retry-button" inverse android on-tap="onRetryTap_"
- disabled="[[valuePropButtonsDisabled]]">
- <div i18n-content="voiceInteractionValuePropRetryButton"></div>
- </oobe-text-button>
- <oobe-text-button id="next-button" inverse android
- on-tap="onNextTap_" disabled="[[valuePropButtonsDisabled]]">
- <div i18n-content="voiceInteractionValuePropNextButton"></div>
- </oobe-text-button>
- </div>
- </oobe-dialog>
- </template>
-</dom-module>
diff --git a/chrome/browser/resources/chromeos/login/oobe_voice_interaction_value_prop.js b/chrome/browser/resources/chromeos/login/oobe_voice_interaction_value_prop.js
deleted file mode 100644
index 5cfac835..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_voice_interaction_value_prop.js
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright 2017 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.
-
-/**
- * @fileoverview Polymer element for displaying material design voice
- * interaction value prop screen.
- */
-
-Polymer({
- is: 'voice-interaction-value-prop-md',
-
- behaviors: [OobeDialogHostBehavior],
-
- properties: {
- /**
- * Buttons are disabled when the value prop content is loading.
- */
- valuePropButtonsDisabled: {
- type: Boolean,
- value: true,
- },
-
- /**
- * System locale.
- */
- locale: {
- type: String,
- },
-
- /**
- * Default url for local en.
- */
- defaultUrl: {
- type: String,
- value:
- 'https://www.gstatic.com/opa-android/oobe/a02187e41eed9e42/v1_omni_en_us.html',
- },
- },
-
- /**
- * Whether try to reload with the default url when a 404 error occurred.
- * @type {boolean}
- * @private
- */
- reloadWithDefaultUrl_: false,
-
- /**
- * Whether an error occurs while the webview is loading.
- * @type: {boolean}
- * @private
- */
- valuePropError_: false,
-
- /**
- * Timeout ID for loading animation.
- * @type {number}
- * @private
- */
- animationTimeout_: null,
-
- /**
- * Timeout ID for loading (will fire an error).
- * @type {number}
- * @private
- */
- loadingTimeout_: null,
-
- /**
- * The value prop view object.
- * @type {Object}
- * @private
- */
- valueView_: null,
-
- /**
- * Whether the screen has been initialized.
- * @type {boolean}
- * @private
- */
- initialized_: false,
-
- /**
- * Whether the response header has been received for the value prop view
- * @type: {boolean}
- * @private
- */
- headerReceived_: false,
-
- /**
- * On-tap event handler for skip button.
- *
- * @private
- */
- onSkipTap_: function() {
- chrome.send(
- 'login.VoiceInteractionValuePropScreen.userActed', ['skip-pressed']);
- },
-
- /**
- * On-tap event handler for retry button.
- *
- * @private
- */
- onRetryTap_: function() {
- this.reloadValueProp();
- },
-
- /**
- * On-tap event handler for next button.
- *
- * @private
- */
- onNextTap_: function() {
- chrome.send(
- 'login.VoiceInteractionValuePropScreen.userActed', ['next-pressed']);
- },
-
- /**
- * Add class to the list of classes of root elements.
- * @param {string} className class to add
- *
- * @private
- */
- addClass_: function(className) {
- this.$['voice-dialog'].classList.add(className);
- },
-
- /**
- * Remove class to the list of classes of root elements.
- * @param {string} className class to remove
- *
- * @private
- */
- removeClass_: function(className) {
- this.$['voice-dialog'].classList.remove(className);
- },
-
- /**
- * Reloads value prop.
- */
- reloadValueProp: function() {
- this.valuePropError_ = false;
- this.headerReceived_ = false;
- this.valueView_.src =
- 'https://www.gstatic.com/opa-android/oobe/a02187e41eed9e42/v1_omni_' +
- this.locale + '.html';
-
- window.clearTimeout(this.animationTimeout_);
- window.clearTimeout(this.loadingTimeout_);
- this.removeClass_('value-prop-loaded');
- this.removeClass_('value-prop-error');
- this.addClass_('value-prop-loading');
- this.valuePropButtonsDisabled = true;
-
- this.animationTimeout_ = window.setTimeout(function() {
- this.addClass_('value-prop-loading-animation');
- }.bind(this), 500);
- this.loadingTimeout_ = window.setTimeout(function() {
- this.onValueViewErrorOccurred();
- }.bind(this), 5000);
- },
-
- /**
- * Handles event when value prop view cannot be loaded.
- */
- onValueViewErrorOccurred: function(details) {
- // TODO(updowndota): Remove after bug is fixed.
- console.error('Value prop view error: ' + JSON.stringify(details));
- this.valuePropError_ = true;
- window.clearTimeout(this.animationTimeout_);
- window.clearTimeout(this.loadingTimeout_);
- this.removeClass_('value-prop-loading-animation');
- this.removeClass_('value-prop-loading');
- this.removeClass_('value-prop-loaded');
- this.addClass_('value-prop-error');
-
- this.valuePropButtonsDisabled = false;
- this.$['retry-button'].focus();
- },
-
- /**
- * Handles event when value prop view is loaded.
- */
- onValueViewContentLoad: function(details) {
- // TODO(updowndota): Remove after bug is fixed.
- console.error('Value prop view loaded: ' + JSON.stringify(details));
- if (details == null) {
- return;
- }
- if (this.valuePropError_ || !this.headerReceived_) {
- return;
- }
- if (this.reloadWithDefaultUrl_) {
- this.valueView_.src = this.defaultUrl;
- this.headerReceived_ = false;
- this.reloadWithDefaultUrl_ = false;
- return;
- }
-
- window.clearTimeout(this.animationTimeout_);
- window.clearTimeout(this.loadingTimeout_);
- this.removeClass_('value-prop-loading-animation');
- this.removeClass_('value-prop-loading');
- this.removeClass_('value-prop-error');
- this.addClass_('value-prop-loaded');
-
- this.valuePropButtonsDisabled = false;
- this.$['next-button'].focus();
- },
-
- /**
- * Handles event when webview request headers received.
- */
- onValueViewHeadersReceived: function(details) {
- // TODO(updowndota): Remove after bug is fixed.
- console.error(
- 'Value prop view header received: ' + JSON.stringify(details));
- if (details == null) {
- return;
- }
- this.headerReceived_ = true;
- if (details.statusCode == '404') {
- if (details.url != this.defaultUrl) {
- this.reloadWithDefaultUrl_ = true;
- } else {
- this.onValueViewErrorOccurred();
- }
- } else if (details.statusCode != '200') {
- this.onValueViewErrorOccurred();
- }
- },
-
- /**
- * Signal from host to show the screen.
- */
- onShow: function() {
- var requestFilter = {urls: ['<all_urls>'], types: ['main_frame']};
- this.valueView_ = this.$['value-prop-view'];
- this.locale = this.locale.replace('-', '_').toLowerCase();
-
- if (!this.initialized_) {
- this.valueView_.request.onErrorOccurred.addListener(
- this.onValueViewErrorOccurred.bind(this), requestFilter);
- this.valueView_.request.onHeadersReceived.addListener(
- this.onValueViewHeadersReceived.bind(this), requestFilter);
- this.valueView_.request.onCompleted.addListener(
- this.onValueViewContentLoad.bind(this), requestFilter);
-
- this.valueView_.addContentScripts([{
- name: 'stripLinks',
- matches: ['<all_urls>'],
- js: {
- code: 'document.querySelectorAll(\'a\').forEach(' +
- 'function(anchor){anchor.href=\'javascript:void(0)\';})'
- },
- run_at: 'document_end'
- }]);
-
- this.initialized_ = true;
- }
-
- this.reloadValueProp();
- },
-});
diff --git a/chrome/browser/resources/chromeos/login/oobe_wait_for_container_ready.css b/chrome/browser/resources/chromeos/login/oobe_wait_for_container_ready.css
deleted file mode 100644
index acb09491..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_wait_for_container_ready.css
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Copyright 2017 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. */
-
-paper-progress {
- --paper-progress-active-color: rgb(66, 133, 244);
- --paper-progress-container-color: #CEE0FC;
- --paper-progress-secondary-color: rgb(66, 133, 244);
- display: block;
- height: 3px;
- padding: 40px 0 0 0;
- width: 100%;
-}
diff --git a/chrome/browser/resources/chromeos/login/oobe_wait_for_container_ready.html b/chrome/browser/resources/chromeos/login/oobe_wait_for_container_ready.html
deleted file mode 100644
index f96b7c2..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_wait_for_container_ready.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!-- Copyright 2017 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. -->
-
-<dom-module id="wait-for-container-ready-md">
- <template>
- <link rel="stylesheet" href="oobe_flex_layout.css">
- <link rel="stylesheet" href="oobe_wait_for_container_ready.css">
- <oobe-dialog id="waitForContainerReadyDialog" role="dialog" hide-shadow
- android>
- <iron-icon src="chrome://oobe/assistant_logo.png"
- i18n-values="aria-label:voiceInteractionLogo" slot="oobe-icon">
- </iron-icon>
- <h1 slot=title" i18n-content="waitForContainerReadyTitle"></h1>
- <div slot="subtitle" i18n-content="waitForContainerReadyIntroMessage">
- </div>
- <div slot="footer">
- <paper-progress class="slow" indeterminate></paper-progress>
- </div>
- </oobe-dialog>
- </template>
-</dom-module>
diff --git a/chrome/browser/resources/chromeos/login/oobe_wait_for_container_ready.js b/chrome/browser/resources/chromeos/login/oobe_wait_for_container_ready.js
deleted file mode 100644
index 50868ae..0000000
--- a/chrome/browser/resources/chromeos/login/oobe_wait_for_container_ready.js
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2017 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.
-
-/**
- * @fileoverview Polymer element for displaying material design wait for
- * container ready screen.
- */
-
-Polymer({
- is: 'wait-for-container-ready-md',
-
- behaviors: [OobeDialogHostBehavior],
-
-});
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 90d5497..d5ac46a0 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -1641,10 +1641,6 @@
"webui/chromeos/login/user_board_screen_handler.h",
"webui/chromeos/login/user_image_screen_handler.cc",
"webui/chromeos/login/user_image_screen_handler.h",
- "webui/chromeos/login/voice_interaction_value_prop_screen_handler.cc",
- "webui/chromeos/login/voice_interaction_value_prop_screen_handler.h",
- "webui/chromeos/login/wait_for_container_ready_screen_handler.cc",
- "webui/chromeos/login/wait_for_container_ready_screen_handler.h",
"webui/chromeos/login/welcome_screen_handler.cc",
"webui/chromeos/login/welcome_screen_handler.h",
"webui/chromeos/login/wrong_hwid_screen_handler.cc",
diff --git a/chrome/browser/ui/app_list/app_list_client_impl.cc b/chrome/browser/ui/app_list/app_list_client_impl.cc
index e28cf76..5dd626a 100644
--- a/chrome/browser/ui/app_list/app_list_client_impl.cc
+++ b/chrome/browser/ui/app_list/app_list_client_impl.cc
@@ -15,7 +15,6 @@
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
@@ -244,22 +243,6 @@
model_updater_->OnPageBreakItemDeleted(id);
}
-void AppListClientImpl::StartVoiceInteractionSession() {
- auto* service =
- arc::ArcVoiceInteractionFrameworkService::GetForBrowserContext(
- ChromeLauncherController::instance()->profile());
- if (service)
- service->StartSessionFromUserInteraction(gfx::Rect());
-}
-
-void AppListClientImpl::ToggleVoiceInteractionSession() {
- auto* service =
- arc::ArcVoiceInteractionFrameworkService::GetForBrowserContext(
- ChromeLauncherController::instance()->profile());
- if (service)
- service->ToggleSessionFromUserInteraction();
-}
-
void AppListClientImpl::GetNavigableContentsFactory(
content::mojom::NavigableContentsFactoryRequest request) {
if (profile_) {
diff --git a/chrome/browser/ui/app_list/app_list_client_impl.h b/chrome/browser/ui/app_list/app_list_client_impl.h
index 952ce63..5bdaa95 100644
--- a/chrome/browser/ui/app_list/app_list_client_impl.h
+++ b/chrome/browser/ui/app_list/app_list_client_impl.h
@@ -73,8 +73,6 @@
void OnPageBreakItemAdded(const std::string& id,
const syncer::StringOrdinal& position) override;
void OnPageBreakItemDeleted(const std::string& id) override;
- void StartVoiceInteractionSession() override;
- void ToggleVoiceInteractionSession() override;
void GetNavigableContentsFactory(
content::mojom::NavigableContentsFactoryRequest request) override;
diff --git a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
index 77ff51e9..0b49077 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
@@ -24,7 +24,6 @@
#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/chromeos/arc/arc_support_host.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
-#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service.h"
#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
@@ -169,10 +168,6 @@
ArcState::ARC_WITHOUT_PLAY_STORE,
};
-constexpr ArcState kUnmanagedArcStatesWithPlayStore[] = {
- ArcState::ARC_PLAY_STORE_UNMANAGED,
-};
-
void OnPaiStartedCallback(bool* started_flag) {
*started_flag = true;
}
@@ -713,67 +708,6 @@
DISALLOW_COPY_AND_ASSIGN(ArcDefaulAppForManagedUserTest);
};
-class ArcVoiceInteractionTest : public ArcPlayStoreAppTest {
- public:
- ArcVoiceInteractionTest() = default;
- ~ArcVoiceInteractionTest() override = default;
-
- void SetUp() override {
- ArcPlayStoreAppTest::SetUp();
-
- arc::ArcSessionManager* session_manager = arc::ArcSessionManager::Get();
- DCHECK(session_manager);
-
- pai_starter_ = session_manager->pai_starter();
- DCHECK(pai_starter_);
- DCHECK(!pai_starter_->started());
- DCHECK(!pai_starter_->locked());
-
- voice_service_ = std::make_unique<arc::ArcVoiceInteractionArcHomeService>(
- profile(), arc::ArcServiceManager::Get()->arc_bridge_service());
- voice_service()->OnAssistantStarted();
-
- SendPlayStoreApp();
-
- DCHECK(!pai_starter_->started());
- DCHECK(pai_starter_->locked());
- }
-
- void TearDown() override {
- ArcPlayStoreAppTest::TearDown();
- voice_service_.reset();
- }
-
- protected:
- void SendAssistantAppStarted() {
- arc::mojom::AppInfo app;
- app.name = "Assistant";
- app.package_name =
- arc::ArcVoiceInteractionArcHomeService::kAssistantPackageName;
- app.activity = "some_activity";
-
- app_instance()->SendTaskCreated(1, app, std::string());
- }
-
- void SendAssistantAppStopped() { app_instance()->SendTaskDestroyed(1); }
-
- void WaitForPaiStarted() {
- while (!pai_starter()->started())
- base::RunLoop().RunUntilIdle();
- }
-
- arc::ArcVoiceInteractionArcHomeService* voice_service() {
- return voice_service_.get();
- }
- arc::ArcPaiStarter* pai_starter() { return pai_starter_; }
-
- private:
- arc::ArcPaiStarter* pai_starter_ = nullptr;
- std::unique_ptr<arc::ArcVoiceInteractionArcHomeService> voice_service_;
-
- DISALLOW_COPY_AND_ASSIGN(ArcVoiceInteractionTest);
-};
-
TEST_P(ArcAppModelBuilderTest, ArcPackagePref) {
ValidateHavePackages({});
app_instance()->SendRefreshPackageList(
@@ -1625,42 +1559,6 @@
EXPECT_FALSE(pai_starter->started());
}
-TEST_P(ArcVoiceInteractionTest, PaiStarterVoiceInteractionNormalFlow) {
- voice_service()->OnAssistantAppRequested();
-
- SendAssistantAppStarted();
- SendAssistantAppStopped();
-
- voice_service()->OnVoiceInteractionOobeSetupComplete();
-
- EXPECT_TRUE(pai_starter()->started());
-}
-
-TEST_P(ArcVoiceInteractionTest, PaiStarterVoiceInteractionCancel) {
- voice_service()->OnAssistantCanceled();
- EXPECT_TRUE(pai_starter()->started());
- EXPECT_FALSE(pai_starter()->locked());
-}
-
-TEST_P(ArcVoiceInteractionTest, PaiStarterVoiceInteractionAppNotStarted) {
- voice_service()->set_assistant_started_timeout_for_testing(
- base::TimeDelta::FromMilliseconds(100));
- voice_service()->OnAssistantAppRequested();
-
- WaitForPaiStarted();
-}
-
-TEST_P(ArcVoiceInteractionTest, PaiStarterVoiceInteractionWizardNotComplete) {
- voice_service()->set_wizard_completed_timeout_for_testing(
- base::TimeDelta::FromMilliseconds(100));
- voice_service()->OnAssistantAppRequested();
-
- SendAssistantAppStarted();
- SendAssistantAppStopped();
-
- WaitForPaiStarted();
-}
-
TEST_P(ArcPlayStoreAppTest,
FastAppReinstallStarterUserFinishesSelectionBeforePlayStore) {
ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
@@ -2713,9 +2611,6 @@
ArcPlayStoreAppTest,
::testing::ValuesIn(kUnmanagedArcStates));
INSTANTIATE_TEST_CASE_P(,
- ArcVoiceInteractionTest,
- ::testing::ValuesIn(kUnmanagedArcStatesWithPlayStore));
-INSTANTIATE_TEST_CASE_P(,
ArcAppModelBuilderRecreate,
::testing::ValuesIn(kUnmanagedArcStates));
INSTANTIATE_TEST_CASE_P(,
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
index 0e96e6a3..660b87c 100644
--- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <memory>
+#include <utility>
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_switches.h"
@@ -75,8 +76,6 @@
#include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h"
-#include "chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.h"
-#include "chrome/browser/ui/webui/chromeos/login/wait_for_container_ready_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h"
#include "chrome/browser/ui/webui/chromeos/user_image_source.h"
@@ -416,10 +415,6 @@
AddScreenHandler(std::make_unique<EncryptionMigrationScreenHandler>());
- AddScreenHandler(std::make_unique<VoiceInteractionValuePropScreenHandler>());
-
- AddScreenHandler(std::make_unique<WaitForContainerReadyScreenHandler>());
-
AddScreenHandler(std::make_unique<SupervisionTransitionScreenHandler>());
AddScreenHandler(std::make_unique<UpdateRequiredScreenHandler>());
@@ -606,15 +601,6 @@
return GetView<EncryptionMigrationScreenHandler>();
}
-VoiceInteractionValuePropScreenView*
-OobeUI::GetVoiceInteractionValuePropScreenView() {
- return GetView<VoiceInteractionValuePropScreenHandler>();
-}
-
-WaitForContainerReadyScreenView* OobeUI::GetWaitForContainerReadyScreenView() {
- return GetView<WaitForContainerReadyScreenHandler>();
-}
-
SupervisionTransitionScreenView* OobeUI::GetSupervisionTransitionScreenView() {
return GetView<SupervisionTransitionScreenHandler>();
}
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.h b/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
index 3bc54541..e81ae547 100644
--- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
+++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
@@ -70,8 +70,6 @@
class UserImageView;
class UpdateView;
class UpdateRequiredView;
-class VoiceInteractionValuePropScreenView;
-class WaitForContainerReadyScreenView;
class SupervisionTransitionScreenView;
class WelcomeView;
class WrongHWIDScreenView;
@@ -136,8 +134,6 @@
HIDDetectionView* GetHIDDetectionView();
DeviceDisabledScreenView* GetDeviceDisabledScreenView();
EncryptionMigrationScreenView* GetEncryptionMigrationScreenView();
- VoiceInteractionValuePropScreenView* GetVoiceInteractionValuePropScreenView();
- WaitForContainerReadyScreenView* GetWaitForContainerReadyScreenView();
SupervisionTransitionScreenView* GetSupervisionTransitionScreenView();
UpdateRequiredView* GetUpdateRequiredScreenView();
AssistantOptInFlowScreenView* GetAssistantOptInFlowScreenView();
diff --git a/chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.cc
deleted file mode 100644
index 4e3430c3..0000000
--- a/chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2017 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/chromeos/login/voice_interaction_value_prop_screen_handler.h"
-
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-#include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.h"
-#include "chrome/grit/generated_resources.h"
-#include "components/login/localized_values_builder.h"
-
-namespace {
-
-const char kJsScreenPath[] = "login.VoiceInteractionValuePropScreen";
-
-} // namespace
-
-namespace chromeos {
-
-VoiceInteractionValuePropScreenHandler::VoiceInteractionValuePropScreenHandler()
- : BaseScreenHandler(kScreenId) {
- set_call_js_prefix(kJsScreenPath);
-}
-
-VoiceInteractionValuePropScreenHandler::
- ~VoiceInteractionValuePropScreenHandler() {
- if (screen_) {
- screen_->OnViewDestroyed(this);
- }
-}
-
-void VoiceInteractionValuePropScreenHandler::DeclareLocalizedValues(
- ::login::LocalizedValuesBuilder* builder) {
- builder->Add("locale", g_browser_process->GetApplicationLocale());
- builder->Add("voiceInteractionValuePropLoading",
- IDS_VOICE_INTERACTION_VALUE_PROP_LOADING);
- builder->Add("voiceInteractionValuePropLoadErrorTitle",
- IDS_VOICE_INTERACTION_VALUE_PROP_LOAD_ERROR_TITLE);
- builder->Add("voiceInteractionValuePropLoadErrorMessage",
- IDS_VOICE_INTERACTION_VALUE_PROP_LOAD_ERROR_MESSAGE);
- builder->Add("voiceInteractionValuePropSkipButton",
- IDS_VOICE_INTERACTION_VALUE_PROP_SKIP_BUTTON);
- builder->Add("voiceInteractionValuePropRetryButton",
- IDS_VOICE_INTERACTION_VALUE_PROP_RETRY_BUTTON);
- builder->Add("voiceInteractionValuePropNextButton",
- IDS_VOICE_INTERACTION_VALUE_PROP_NEXT_BUTTION);
-}
-
-void VoiceInteractionValuePropScreenHandler::Bind(
- VoiceInteractionValuePropScreen* screen) {
- BaseScreenHandler::SetBaseScreen(screen);
- screen_ = screen;
- if (page_is_ready())
- Initialize();
-}
-
-void VoiceInteractionValuePropScreenHandler::Unbind() {
- screen_ = nullptr;
- BaseScreenHandler::SetBaseScreen(nullptr);
-}
-
-void VoiceInteractionValuePropScreenHandler::Show() {
- if (!page_is_ready() || !screen_) {
- show_on_init_ = true;
- return;
- }
-
- ShowScreen(kScreenId);
-}
-
-void VoiceInteractionValuePropScreenHandler::Hide() {}
-
-void VoiceInteractionValuePropScreenHandler::Initialize() {
- if (!screen_ || !show_on_init_)
- return;
-
- Show();
- show_on_init_ = false;
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.h
deleted file mode 100644
index 5b9d2fd..0000000
--- a/chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2017 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 CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_VOICE_INTERACTION_VALUE_PROP_SCREEN_HANDLER_H_
-#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_VOICE_INTERACTION_VALUE_PROP_SCREEN_HANDLER_H_
-
-#include <memory>
-#include <string>
-
-#include "base/macros.h"
-#include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen_view.h"
-#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
-
-namespace chromeos {
-
-class VoiceInteractionValuePropScreenHandler
- : public BaseScreenHandler,
- public VoiceInteractionValuePropScreenView {
- public:
- VoiceInteractionValuePropScreenHandler();
- ~VoiceInteractionValuePropScreenHandler() override;
-
- // BaseScreenHandler:
- void DeclareLocalizedValues(
- ::login::LocalizedValuesBuilder* builder) override;
-
- // VoiceInteractionValuePropScreenView:
- void Bind(VoiceInteractionValuePropScreen* screen) override;
- void Unbind() override;
- void Show() override;
- void Hide() override;
-
- private:
- // BaseScreenHandler:
- void Initialize() override;
-
- VoiceInteractionValuePropScreen* screen_ = nullptr;
-
- // Whether the screen should be shown right after initialization.
- bool show_on_init_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(VoiceInteractionValuePropScreenHandler);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_VOICE_INTERACTION_VALUE_PROP_SCREEN_HANDLER_H_
diff --git a/chrome/browser/ui/webui/chromeos/login/wait_for_container_ready_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/wait_for_container_ready_screen_handler.cc
deleted file mode 100644
index f8715f2e..0000000
--- a/chrome/browser/ui/webui/chromeos/login/wait_for_container_ready_screen_handler.cc
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2017 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/chromeos/login/wait_for_container_ready_screen_handler.h"
-
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-#include "chrome/browser/chromeos/login/screens/wait_for_container_ready_screen.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
-#include "chrome/grit/generated_resources.h"
-#include "components/login/localized_values_builder.h"
-
-namespace {
-
-constexpr char kJsScreenPath[] = "login.WaitForContainerReadyScreen";
-constexpr base::TimeDelta kWaitingTimeout = base::TimeDelta::FromMinutes(1);
-
-} // namespace
-
-namespace chromeos {
-
-WaitForContainerReadyScreenHandler::WaitForContainerReadyScreenHandler()
- : BaseScreenHandler(kScreenId), weak_ptr_factory_(this) {
- set_call_js_prefix(kJsScreenPath);
-}
-
-WaitForContainerReadyScreenHandler::~WaitForContainerReadyScreenHandler() {
- if (screen_) {
- screen_->OnViewDestroyed(this);
- }
- timer_.Stop();
-
- arc::ArcSessionManager::Get()->RemoveObserver(this);
- if (!profile_)
- return;
- ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_);
- if (prefs)
- prefs->RemoveObserver(this);
-}
-
-void WaitForContainerReadyScreenHandler::DeclareLocalizedValues(
- ::login::LocalizedValuesBuilder* builder) {
- builder->Add("waitForContainerReadyTitle",
- IDS_WAIT_FOR_CONTAINER_READY_TITLE);
- builder->Add("waitForContainerReadyIntroMessage",
- IDS_WAIT_FOR_CONTAINER_READY_INTRO_MESSAGE);
- builder->Add("voiceInteractionLogo", IDS_VOICE_INTERACTION_LOGO);
-}
-
-void WaitForContainerReadyScreenHandler::Bind(
- WaitForContainerReadyScreen* screen) {
- BaseScreenHandler::SetBaseScreen(screen);
- screen_ = screen;
- if (page_is_ready())
- Initialize();
-}
-
-void WaitForContainerReadyScreenHandler::Unbind() {
- screen_ = nullptr;
- BaseScreenHandler::SetBaseScreen(nullptr);
- timer_.Stop();
-}
-
-void WaitForContainerReadyScreenHandler::Show() {
- if (!page_is_ready() || !screen_) {
- show_on_init_ = true;
- return;
- }
-
- if (is_app_list_ready_) {
- NotifyContainerReady();
- return;
- }
-
- timer_.Start(
- FROM_HERE, kWaitingTimeout,
- base::Bind(&WaitForContainerReadyScreenHandler::OnMaxContainerWaitTimeout,
- weak_ptr_factory_.GetWeakPtr()));
-
- ShowScreen(kScreenId);
-}
-
-void WaitForContainerReadyScreenHandler::Hide() {}
-
-void WaitForContainerReadyScreenHandler::OnPackageListInitialRefreshed() {
- is_app_list_ready_ = true;
- if (!screen_)
- return;
-
- // TODO(updowndota): Remove the temporary delay after the potential racing
- // issue is eliminated.
- timer_.Stop();
- timer_.Start(
- FROM_HERE, base::TimeDelta::FromSeconds(5),
- base::Bind(&WaitForContainerReadyScreenHandler::NotifyContainerReady,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-void WaitForContainerReadyScreenHandler::OnArcErrorShowRequested(
- ArcSupportHost::Error error) {
- // Error occurs during Arc provisioning, close the screen.
- if (screen_)
- screen_->OnContainerError();
-}
-
-void WaitForContainerReadyScreenHandler::Initialize() {
- profile_ = ProfileManager::GetPrimaryUserProfile();
- ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_);
- if (prefs) {
- is_app_list_ready_ = prefs->package_list_initial_refreshed();
- if (!is_app_list_ready_)
- prefs->AddObserver(this);
- }
- arc::ArcSessionManager::Get()->AddObserver(this);
-
- if (!screen_ || !show_on_init_)
- return;
-
- Show();
- show_on_init_ = false;
-}
-
-void WaitForContainerReadyScreenHandler::OnMaxContainerWaitTimeout() {
- // TODO(updowndota): Add histogram to Voice Interaction OptIn flow.
- if (screen_)
- screen_->OnContainerError();
-}
-
-void WaitForContainerReadyScreenHandler::NotifyContainerReady() {
- if (screen_)
- screen_->OnContainerReady();
-}
-
-} // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/wait_for_container_ready_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/wait_for_container_ready_screen_handler.h
deleted file mode 100644
index 7baa747d..0000000
--- a/chrome/browser/ui/webui/chromeos/login/wait_for_container_ready_screen_handler.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2017 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 CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_WAIT_FOR_CONTAINER_READY_SCREEN_HANDLER_H_
-#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_WAIT_FOR_CONTAINER_READY_SCREEN_HANDLER_H_
-
-#include <memory>
-#include <string>
-
-#include "base/macros.h"
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
-#include "chrome/browser/chromeos/login/screens/wait_for_container_ready_screen_view.h"
-#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
-#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
-
-namespace chromeos {
-
-class WaitForContainerReadyScreenHandler
- : public BaseScreenHandler,
- public WaitForContainerReadyScreenView,
- public ArcAppListPrefs::Observer,
- public arc::ArcSessionManager::Observer {
- public:
- WaitForContainerReadyScreenHandler();
- ~WaitForContainerReadyScreenHandler() override;
-
- // BaseScreenHandler:
- void DeclareLocalizedValues(
- ::login::LocalizedValuesBuilder* builder) override;
-
- // WaitForContainerReadyScreenView:
- void Bind(WaitForContainerReadyScreen* screen) override;
- void Unbind() override;
- void Show() override;
- void Hide() override;
-
- // ArcAppListPrefs::Observer overrides.
- void OnPackageListInitialRefreshed() override;
-
- // ArcSessionManager::Observer overrides.
- void OnArcErrorShowRequested(ArcSupportHost::Error error) override;
-
- private:
- // BaseScreenHandler:
- void Initialize() override;
-
- // Called to notify the screen that the container is ready.
- void NotifyContainerReady();
-
- // Called when the max wait timeout is reached.
- void OnMaxContainerWaitTimeout();
-
- WaitForContainerReadyScreen* screen_ = nullptr;
-
- // Whether the screen should be shown right after initialization.
- bool show_on_init_ = false;
-
- // Whether app list is ready.
- bool is_app_list_ready_ = false;
-
- // The primary user profile.
- Profile* profile_ = nullptr;
-
- // Timer used to exit the page when timeout reaches.
- base::OneShotTimer timer_;
-
- base::WeakPtrFactory<WaitForContainerReadyScreenHandler> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(WaitForContainerReadyScreenHandler);
-};
-
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_WAIT_FOR_CONTAINER_READY_SCREEN_HANDLER_H_
diff --git a/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc b/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
index a37ce59..df4b2b0 100644
--- a/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.cc
@@ -10,7 +10,6 @@
#include "ash/public/interfaces/constants.mojom.h"
#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 "chromeos/constants/chromeos_switches.h"
#include "components/arc/arc_service_manager.h"
@@ -31,74 +30,20 @@
void GoogleAssistantHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
- "setGoogleAssistantEnabled",
- base::BindRepeating(
- &GoogleAssistantHandler::HandleSetGoogleAssistantEnabled,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "setGoogleAssistantContextEnabled",
- base::BindRepeating(
- &GoogleAssistantHandler::HandleSetGoogleAssistantContextEnabled,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
"showGoogleAssistantSettings",
base::BindRepeating(
&GoogleAssistantHandler::HandleShowGoogleAssistantSettings,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "turnOnGoogleAssistant",
- base::BindRepeating(&GoogleAssistantHandler::HandleTurnOnGoogleAssistant,
- base::Unretained(this)));
-}
-
-void GoogleAssistantHandler::HandleSetGoogleAssistantEnabled(
- const base::ListValue* args) {
- CHECK_EQ(1U, args->GetSize());
- bool enabled;
- CHECK(args->GetBoolean(0, &enabled));
-
- auto* service =
- arc::ArcVoiceInteractionFrameworkService::GetForBrowserContext(profile_);
- if (service)
- service->SetVoiceInteractionEnabled(enabled, base::BindOnce([](bool) {}));
-}
-
-void GoogleAssistantHandler::HandleSetGoogleAssistantContextEnabled(
- const base::ListValue* args) {
- CHECK_EQ(1U, args->GetSize());
- bool enabled;
- CHECK(args->GetBoolean(0, &enabled));
-
- auto* service =
- arc::ArcVoiceInteractionFrameworkService::GetForBrowserContext(profile_);
- if (service)
- service->SetVoiceInteractionContextEnabled(enabled);
}
void GoogleAssistantHandler::HandleShowGoogleAssistantSettings(
const base::ListValue* args) {
- if (chromeos::switches::IsAssistantEnabled()) {
- // Opens Google Assistant settings.
- service_manager::Connector* connector =
- content::BrowserContext::GetConnectorFor(profile_);
- ash::mojom::AssistantControllerPtr assistant_controller;
- connector->BindInterface(ash::mojom::kServiceName, &assistant_controller);
- assistant_controller->OpenAssistantSettings();
- return;
- }
-
- auto* service =
- arc::ArcVoiceInteractionFrameworkService::GetForBrowserContext(profile_);
- if (service)
- service->ShowVoiceInteractionSettings();
-}
-
-void GoogleAssistantHandler::HandleTurnOnGoogleAssistant(
- const base::ListValue* args) {
- auto* service =
- arc::ArcVoiceInteractionFrameworkService::GetForBrowserContext(profile_);
- if (service)
- service->StartSessionFromUserInteraction(gfx::Rect());
+ // Opens Google Assistant settings.
+ service_manager::Connector* connector =
+ content::BrowserContext::GetConnectorFor(profile_);
+ ash::mojom::AssistantControllerPtr assistant_controller;
+ connector->BindInterface(ash::mojom::kServiceName, &assistant_controller);
+ assistant_controller->OpenAssistantSettings();
}
} // namespace settings
diff --git a/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h b/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h
index 8ae9aab..945a7aa 100644
--- a/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h
+++ b/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h
@@ -23,14 +23,8 @@
void OnJavascriptDisallowed() override;
private:
- // WebUI call to enable the Google Assistant.
- void HandleSetGoogleAssistantEnabled(const base::ListValue* args);
- // WebUI call to enable context for the Google Assistant.
- void HandleSetGoogleAssistantContextEnabled(const base::ListValue* args);
// WebUI call to launch into the Google Assistant app settings.
void HandleShowGoogleAssistantSettings(const base::ListValue* args);
- // WebUI call to launch assistant runtime flow.
- void HandleTurnOnGoogleAssistant(const base::ListValue* args);
Profile* const profile_;
diff --git a/chrome/browser/ui/webui/settings/md_settings_ui.cc b/chrome/browser/ui/webui/settings/md_settings_ui.cc
index 9711557..903be4a 100644
--- a/chrome/browser/ui/webui/settings/md_settings_ui.cc
+++ b/chrome/browser/ui/webui/settings/md_settings_ui.cc
@@ -217,8 +217,7 @@
std::make_unique<chromeos::settings::CupsPrintersHandler>(web_ui));
AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::FingerprintHandler>(profile));
- if (chromeos::switches::IsVoiceInteractionEnabled() ||
- chromeos::switches::IsAssistantEnabled()) {
+ if (chromeos::switches::IsAssistantEnabled()) {
AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::GoogleAssistantHandler>(profile));
}
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 868b3119..908dbb5 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -1652,7 +1652,6 @@
"../browser/chromeos/arc/enterprise/arc_cert_store_bridge_browsertest.cc",
"../browser/chromeos/arc/intent_helper/arc_settings_service_browsertest.cc",
"../browser/chromeos/arc/user_session/arc_user_session_service_browsertest.cc",
- "../browser/chromeos/arc/voice_interaction/arc_voice_interaction_arc_home_service_browsertest.cc",
"../browser/chromeos/attestation/attestation_policy_browsertest.cc",
"../browser/chromeos/child_accounts/child_account_test_utils.cc",
"../browser/chromeos/child_accounts/child_account_test_utils.h",
diff --git a/chrome/test/data/extensions/theme/Cached Theme.pak b/chrome/test/data/extensions/theme/Cached Theme.pak
index e012645d..c65f898 100644
--- a/chrome/test/data/extensions/theme/Cached Theme.pak
+++ b/chrome/test/data/extensions/theme/Cached Theme.pak
Binary files differ
diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn
index 2c2da12a..adf1652e 100644
--- a/components/arc/BUILD.gn
+++ b/components/arc/BUILD.gn
@@ -263,8 +263,6 @@
"test/fake_power_instance.h",
"test/fake_timer_instance.cc",
"test/fake_timer_instance.h",
- "test/fake_voice_interaction_framework_instance.cc",
- "test/fake_voice_interaction_framework_instance.h",
"test/fake_wake_lock_instance.cc",
"test/fake_wake_lock_instance.h",
"test/fake_wallpaper_instance.cc",
diff --git a/components/arc/arc_bridge_host_impl.cc b/components/arc/arc_bridge_host_impl.cc
index a51a470..171f8ec 100644
--- a/components/arc/arc_bridge_host_impl.cc
+++ b/components/arc/arc_bridge_host_impl.cc
@@ -258,14 +258,12 @@
void ArcBridgeHostImpl::OnVoiceInteractionArcHomeInstanceReady(
mojom::VoiceInteractionArcHomeInstancePtr home_ptr) {
- OnInstanceReady(arc_bridge_service_->voice_interaction_arc_home(),
- std::move(home_ptr));
+ NOTREACHED();
}
void ArcBridgeHostImpl::OnVoiceInteractionFrameworkInstanceReady(
mojom::VoiceInteractionFrameworkInstancePtr framework_ptr) {
- OnInstanceReady(arc_bridge_service_->voice_interaction_framework(),
- std::move(framework_ptr));
+ NOTREACHED();
}
void ArcBridgeHostImpl::OnVolumeMounterInstanceReady(
diff --git a/components/arc/arc_bridge_service.h b/components/arc/arc_bridge_service.h
index 2ae2280..63d35014 100644
--- a/components/arc/arc_bridge_service.h
+++ b/components/arc/arc_bridge_service.h
@@ -85,10 +85,6 @@
class UsbHostInstance;
class VideoHost;
class VideoInstance;
-class VoiceInteractionArcHomeHost;
-class VoiceInteractionArcHomeInstance;
-class VoiceInteractionFrameworkHost;
-class VoiceInteractionFrameworkInstance;
class VolumeMounterHost;
class VolumeMounterInstance;
class WakeLockHost;
@@ -227,16 +223,6 @@
ConnectionHolder<mojom::VideoInstance, mojom::VideoHost>* video() {
return &video_;
}
- ConnectionHolder<mojom::VoiceInteractionArcHomeInstance,
- mojom::VoiceInteractionArcHomeHost>*
- voice_interaction_arc_home() {
- return &voice_interaction_arc_home_;
- }
- ConnectionHolder<mojom::VoiceInteractionFrameworkInstance,
- mojom::VoiceInteractionFrameworkHost>*
- voice_interaction_framework() {
- return &voice_interaction_framework_;
- }
ConnectionHolder<mojom::VolumeMounterInstance, mojom::VolumeMounterHost>*
volume_mounter() {
return &volume_mounter_;
@@ -302,12 +288,6 @@
ConnectionHolder<mojom::TtsInstance, mojom::TtsHost> tts_;
ConnectionHolder<mojom::UsbHostInstance, mojom::UsbHostHost> usb_host_;
ConnectionHolder<mojom::VideoInstance, mojom::VideoHost> video_;
- ConnectionHolder<mojom::VoiceInteractionArcHomeInstance,
- mojom::VoiceInteractionArcHomeHost>
- voice_interaction_arc_home_;
- ConnectionHolder<mojom::VoiceInteractionFrameworkInstance,
- mojom::VoiceInteractionFrameworkHost>
- voice_interaction_framework_;
ConnectionHolder<mojom::VolumeMounterInstance, mojom::VolumeMounterHost>
volume_mounter_;
ConnectionHolder<mojom::WakeLockInstance, mojom::WakeLockHost> wake_lock_;
diff --git a/components/arc/arc_session_impl.cc b/components/arc/arc_session_impl.cc
index b51c85e7..891f62a 100644
--- a/components/arc/arc_session_impl.cc
+++ b/components/arc/arc_session_impl.cc
@@ -474,12 +474,6 @@
request.set_skip_boot_completed_broadcast(
!base::FeatureList::IsEnabled(arc::kBootCompletedBroadcastFeature));
- // We only enable /vendor/priv-app when voice interaction is enabled
- // because voice interaction service apk would be bundled in this
- // location.
- request.set_scan_vendor_priv_app(
- chromeos::switches::IsVoiceInteractionEnabled());
-
// Set packages cache mode coming from autotests.
const std::string packages_cache_mode_string =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
diff --git a/components/arc/test/fake_voice_interaction_framework_instance.cc b/components/arc/test/fake_voice_interaction_framework_instance.cc
deleted file mode 100644
index f5b50002..0000000
--- a/components/arc/test/fake_voice_interaction_framework_instance.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2017 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 "components/arc/test/fake_voice_interaction_framework_instance.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-
-namespace arc {
-
-FakeVoiceInteractionFrameworkInstance::FakeVoiceInteractionFrameworkInstance() =
- default;
-
-FakeVoiceInteractionFrameworkInstance::
- ~FakeVoiceInteractionFrameworkInstance() = default;
-
-void FakeVoiceInteractionFrameworkInstance::InitDeprecated(
- mojom::VoiceInteractionFrameworkHostPtr host_ptr) {
- Init(std::move(host_ptr), base::DoNothing());
-}
-
-void FakeVoiceInteractionFrameworkInstance::Init(
- mojom::VoiceInteractionFrameworkHostPtr host_ptr,
- InitCallback callback) {
- host_ = std::move(host_ptr);
- std::move(callback).Run();
-}
-
-void FakeVoiceInteractionFrameworkInstance::StartVoiceInteractionSession(
- bool homescreen_is_active) {
- start_session_count_++;
- state_ = arc::mojom::VoiceInteractionState::RUNNING;
- host_->SetVoiceInteractionState(state_);
-}
-
-void FakeVoiceInteractionFrameworkInstance::ToggleVoiceInteractionSession(
- bool homescreen_is_active) {
- toggle_session_count_++;
- if (state_ == arc::mojom::VoiceInteractionState::RUNNING)
- state_ = arc::mojom::VoiceInteractionState::STOPPED;
- else
- state_ = arc::mojom::VoiceInteractionState::RUNNING;
-
- host_->SetVoiceInteractionState(state_);
-}
-
-void FakeVoiceInteractionFrameworkInstance::
- StartVoiceInteractionSessionForRegion(const gfx::Rect& region) {
- start_session_for_region_count_++;
- selected_region_ = region;
-}
-
-void FakeVoiceInteractionFrameworkInstance::SetMetalayerVisibility(
- bool visible) {
- set_metalayer_visibility_count_++;
- metalayer_visible_ = visible;
-}
-
-void FakeVoiceInteractionFrameworkInstance::SetVoiceInteractionEnabled(
- bool enable,
- SetVoiceInteractionEnabledCallback callback) {
- std::move(callback).Run();
-}
-
-void FakeVoiceInteractionFrameworkInstance::SetVoiceInteractionContextEnabled(
- bool enable) {}
-
-void FakeVoiceInteractionFrameworkInstance::StartVoiceInteractionSetupWizard() {
- setup_wizard_count_++;
-}
-
-void FakeVoiceInteractionFrameworkInstance::ShowVoiceInteractionSettings() {
- show_settings_count_++;
-}
-
-void FakeVoiceInteractionFrameworkInstance::GetVoiceInteractionSettings(
- GetVoiceInteractionSettingsCallback callback) {}
-
-void FakeVoiceInteractionFrameworkInstance::FlushMojoForTesting() {
- host_.FlushForTesting();
-}
-
-} // namespace arc
diff --git a/components/arc/test/fake_voice_interaction_framework_instance.h b/components/arc/test/fake_voice_interaction_framework_instance.h
deleted file mode 100644
index f4e669a..0000000
--- a/components/arc/test/fake_voice_interaction_framework_instance.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2017 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 COMPONENTS_ARC_TEST_FAKE_VOICE_INTERACTION_FRAMEWORK_INSTANCE_H_
-#define COMPONENTS_ARC_TEST_FAKE_VOICE_INTERACTION_FRAMEWORK_INSTANCE_H_
-
-#include <stddef.h>
-
-#include "components/arc/common/voice_interaction_framework.mojom.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace arc {
-
-class FakeVoiceInteractionFrameworkInstance
- : public mojom::VoiceInteractionFrameworkInstance {
- public:
- FakeVoiceInteractionFrameworkInstance();
- ~FakeVoiceInteractionFrameworkInstance() override;
-
- // mojom::VoiceInteractionFrameworkInstance overrides:
- void InitDeprecated(
- mojom::VoiceInteractionFrameworkHostPtr host_ptr) override;
- void Init(mojom::VoiceInteractionFrameworkHostPtr host_ptr,
- InitCallback callback) override;
- void StartVoiceInteractionSession(bool homescreen_is_active) override;
- void ToggleVoiceInteractionSession(bool homescreen_is_active) override;
- void StartVoiceInteractionSessionForRegion(const gfx::Rect& region) override;
- void SetMetalayerVisibility(bool visible) override;
- void SetVoiceInteractionEnabled(
- bool enable,
- SetVoiceInteractionEnabledCallback callback) override;
- void SetVoiceInteractionContextEnabled(bool enable) override;
- void StartVoiceInteractionSetupWizard() override;
- void ShowVoiceInteractionSettings() override;
- void GetVoiceInteractionSettings(
- GetVoiceInteractionSettingsCallback callback) override;
-
- void FlushMojoForTesting();
-
- size_t start_session_count() const { return start_session_count_; }
- size_t toggle_session_count() const { return toggle_session_count_; }
- size_t setup_wizard_count() const { return setup_wizard_count_; }
- size_t show_settings_count() const { return show_settings_count_; }
- size_t set_metalayer_visibility_count() const {
- return set_metalayer_visibility_count_;
- }
- bool metalayer_visible() const { return metalayer_visible_; }
- size_t start_session_for_region_count() const {
- return start_session_for_region_count_;
- }
- const gfx::Rect& selected_region() const { return selected_region_; }
-
- void ResetCounters() {
- start_session_count_ = 0u;
- toggle_session_count_ = 0u;
- setup_wizard_count_ = 0u;
- show_settings_count_ = 0u;
- set_metalayer_visibility_count_ = 0u;
- start_session_for_region_count_ = 0u;
- }
-
- private:
- size_t start_session_count_ = 0u;
- size_t toggle_session_count_ = 0u;
- size_t setup_wizard_count_ = 0u;
- size_t show_settings_count_ = 0u;
- size_t set_metalayer_visibility_count_ = 0u;
- bool metalayer_visible_ = true;
- size_t start_session_for_region_count_ = 0u;
- gfx::Rect selected_region_;
- mojom::VoiceInteractionFrameworkHostPtr host_;
- arc::mojom::VoiceInteractionState state_ =
- arc::mojom::VoiceInteractionState::STOPPED;
-
- DISALLOW_COPY_AND_ASSIGN(FakeVoiceInteractionFrameworkInstance);
-};
-
-} // namespace arc
-
-#endif // COMPONENTS_ARC_TEST_FAKE_VOICE_INTERACTION_FRAMEWORK_INSTANCE_H_