Commit 5c356944 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

first_run: Remove old System Tray support.

This CL removes old System Tray support in first_run tutorial.
In UnifiedSystemTray, we don't have HelpStep in the tutorial, so this
CL removes HelpStep related code.

This is the part 2 of removing old System Tray code.

(1) Removing the flag
(2) Removing references to IsSystemTrayUnifiedEnabled()
(3) Removing classes that are only used in old System Tray

I'll try to keep the number of CLs as small as possible to make the
history clean, but there can be multiple CLs for both part 2 and part 3
because some of them requires nontrivial refactoring to remove the
dependency to the old code.

TBR=alemate@chromium.org
TEST=trybot pass
BUG=898419

Change-Id: I97df2f9de526e0e9b443d0728a3e16e759699da5
Reviewed-on: https://chromium-review.googlesource.com/c/1301137
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603729}
parent e4b9336e
......@@ -70,10 +70,6 @@ void FirstRunHelper::CloseTrayBubble() {
->CloseBubble();
}
void FirstRunHelper::GetHelpButtonBounds(GetHelpButtonBoundsCallback cb) {
std::move(cb).Run(gfx::Rect());
}
void FirstRunHelper::OnLockStateChanged(bool locked) {
Cancel();
}
......
......@@ -32,7 +32,6 @@ class ASH_EXPORT FirstRunHelper : public mojom::FirstRunHelper,
void GetAppListButtonBounds(GetAppListButtonBoundsCallback cb) override;
void OpenTrayBubble(OpenTrayBubbleCallback cb) override;
void CloseTrayBubble() override;
void GetHelpButtonBounds(GetHelpButtonBoundsCallback cb) override;
// SessionObserver:
void OnLockStateChanged(bool locked) override;
......
......@@ -30,10 +30,6 @@ interface FirstRunHelper {
// Closes the system tray bubble menu. Does nothing if the bubble is already
// closed.
CloseTrayBubble();
// Returns the bounds of the help button on the system tray bubble menu in
// screen coordinates. Returns empty bounds if the bubble is not open.
GetHelpButtonBounds() => (gfx.mojom.Rect screen_bounds);
};
// The client for the FirstRunHelper interface, e.g. chrome.
......
......@@ -905,8 +905,6 @@ source_set("chromeos") {
"first_run/step_names.h",
"first_run/steps/app_list_step.cc",
"first_run/steps/app_list_step.h",
"first_run/steps/help_step.cc",
"first_run/steps/help_step.h",
"first_run/steps/tray_step.cc",
"first_run/steps/tray_step.h",
"hats/hats_dialog.cc",
......
......@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/public/cpp/ash_features.h"
#include "ash/public/interfaces/constants.mojom.h"
#include "ash/public/interfaces/system_tray_test_api.mojom.h"
#include "chrome/browser/chromeos/first_run/first_run.h"
......@@ -189,13 +188,6 @@ IN_PROC_BROWSER_TEST_F(FirstRunUIBrowserTest, FirstRunFlow) {
FlushForTesting();
EXPECT_TRUE(IsTrayBubbleOpen());
if (!ash::features::IsSystemTrayUnifiedEnabled()) {
AdvanceStep();
WaitForStep(first_run::kHelpStep);
FlushForTesting();
EXPECT_TRUE(IsTrayBubbleOpen());
}
AdvanceStep();
WaitForFinalization();
content::RunAllPendingInMessageLoop();
......
......@@ -4,7 +4,6 @@
#include "chrome/browser/chromeos/first_run/first_run_controller.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/shelf_prefs.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/interfaces/constants.mojom.h"
......@@ -17,7 +16,6 @@
#include "chrome/browser/chromeos/first_run/first_run_view.h"
#include "chrome/browser/chromeos/first_run/metrics.h"
#include "chrome/browser/chromeos/first_run/steps/app_list_step.h"
#include "chrome/browser/chromeos/first_run/steps/help_step.h"
#include "chrome/browser/chromeos/first_run/steps/tray_step.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/ui/ash/ash_util.h"
......@@ -206,9 +204,6 @@ void FirstRunController::OnCancelled() {
void FirstRunController::RegisterSteps() {
steps_.push_back(std::make_unique<first_run::AppListStep>(this, actor_));
steps_.push_back(std::make_unique<first_run::TrayStep>(this, actor_));
// UnifiedSystemTray does not have a help button. https://crbug.com/837502
if (!ash::features::IsSystemTrayUnifiedEnabled())
steps_.push_back(std::make_unique<first_run::HelpStep>(this, actor_));
}
void FirstRunController::ShowNextStep() {
......
// Copyright 2013 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/first_run/steps/help_step.h"
#include "ash/public/interfaces/first_run_helper.mojom.h"
#include "base/bind.h"
#include "chrome/browser/chromeos/first_run/first_run_controller.h"
#include "chrome/browser/chromeos/first_run/step_names.h"
#include "chrome/browser/ui/webui/chromeos/first_run/first_run_actor.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
namespace {
const int kCircleRadius = 19;
} // namespace
namespace chromeos {
namespace first_run {
HelpStep::HelpStep(FirstRunController* controller, FirstRunActor* actor)
: Step(kHelpStep, controller, actor) {}
void HelpStep::DoShow() {
const ash::mojom::FirstRunHelperPtr& helper_ptr =
first_run_controller()->first_run_helper_ptr();
helper_ptr->OpenTrayBubble(base::DoNothing());
// FirstRunController owns |this|, so use Unretained.
helper_ptr->GetHelpButtonBounds(base::BindOnce(
&HelpStep::ShowWithHelpButtonBounds, base::Unretained(this)));
}
void HelpStep::DoOnAfterHide() {
first_run_controller()->first_run_helper_ptr()->CloseTrayBubble();
}
void HelpStep::ShowWithHelpButtonBounds(const gfx::Rect& screen_bounds) {
gfx::Point center = screen_bounds.CenterPoint();
actor()->AddRoundHole(center.x(), center.y(), kCircleRadius);
actor()->ShowStepPointingTo(name(), center.x(), center.y(), kCircleRadius);
}
} // namespace first_run
} // namespace chromeos
// Copyright 2013 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_FIRST_RUN_STEPS_HELP_STEP_H_
#define CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEPS_HELP_STEP_H_
#include "base/macros.h"
#include "chrome/browser/chromeos/first_run/step.h"
namespace gfx {
class Rect;
}
namespace chromeos {
namespace first_run {
class HelpStep : public Step {
public:
HelpStep(FirstRunController* controller, FirstRunActor* actor);
private:
// Step:
void DoShow() override;
void DoOnAfterHide() override;
void ShowWithHelpButtonBounds(const gfx::Rect& screen_bounds);
DISALLOW_COPY_AND_ASSIGN(HelpStep);
};
} // namespace first_run
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEPS_HELP_STEP_H_
......@@ -23,7 +23,6 @@
<div id="steps">
<include src="app_list_step.html">
<include src="tray_step.html">
<include src="help_step.html">
</div>
<script src="chrome://resources/js/i18n_template.js"></script>
</body>
......
......@@ -246,8 +246,6 @@ cr.define('cr.FirstRun', function() {
}
if (stepParams.voiceInteractionEnabled)
step.setVoiceInteractionEnabled();
if (stepParams.unifiedSystemTrayEnabled)
step.setUnifiedSystemTrayEnabled(true);
step.show(true, function(step) {
step.focusDefaultControl();
this.currentStep_ = step;
......
<div id="help" class="step bubble transparent hidden">
<div id="completion-image"></div>
<h1 i18n-content="helpHeader"></h1>
<p i18n-content="helpText"></p>
<div class="controls">
<button i18n-content="helpKeepExploringButton"
class="help-button custom-appearance blue-button"></button>
<button i18n-content="helpFinishButton"
class="next-button custom-appearance white-button"></button>
</div>
</div>
......@@ -255,9 +255,9 @@ cr.define('cr.FirstRun', function() {
},
};
var HelpStep = cr.ui.define('div');
var TrayStep = cr.ui.define('div');
HelpStep.prototype = {
TrayStep.prototype = {
__proto__: Bubble.prototype,
decorate: function() {
......@@ -270,37 +270,8 @@ cr.define('cr.FirstRun', function() {
},
};
var TrayStep = cr.ui.define('div');
TrayStep.prototype = {
__proto__: HelpStep.prototype,
decorate: function() {
HelpStep.prototype.decorate.call(this);
this.setUnifiedSystemTrayEnabled(false);
},
/**
* Updates UI when UnifiedSystemTray is enabled.
*/
setUnifiedSystemTrayEnabled: function(enabled) {
Array.prototype.forEach.call(
this.getElementsByClassName('unified-system-tray-enabled'),
function(el) {
el.hidden = !enabled;
}.bind(this));
Array.prototype.forEach.call(
this.getElementsByClassName('unified-system-tray-disabled'),
function(el) {
el.hidden = enabled;
}.bind(this));
},
};
var DecorateStep = function(el) {
if (el.id == 'help')
HelpStep.decorate(el);
else if (el.id == 'tray')
if (el.id == 'tray')
TrayStep.decorate(el);
else if (el.classList.contains('bubble'))
Bubble.decorate(el);
......
......@@ -3,13 +3,8 @@
<p i18n-content="trayText"><p>
<div class="controls">
<button i18n-content="helpKeepExploringButton"
class="help-button custom-appearance blue-button
unified-system-tray-enabled"></button>
class="help-button custom-appearance blue-button"></button>
<button i18n-content="helpFinishButton"
class="next-button custom-appearance white-button
unified-system-tray-enabled"></button>
<button i18n-content="nextButton"
class="next-button custom-appearance blue-button
unified-system-tray-disabled"></button>
class="next-button custom-appearance white-button"></button>
</div>
</div>
......@@ -4,7 +4,6 @@
#include "chrome/browser/ui/webui/chromeos/first_run/first_run_handler.h"
#include "ash/public/cpp/ash_features.h"
#include "base/bind.h"
#include "base/values.h"
#include "chromeos/chromeos_switches.h"
......@@ -51,8 +50,6 @@ void FirstRunHandler::ShowStepPositioned(const std::string& name,
step_params.SetKey(
"voiceInteractionEnabled",
base::Value(chromeos::switches::IsVoiceInteractionEnabled()));
step_params.SetKey("unifiedSystemTrayEnabled",
base::Value(ash::features::IsSystemTrayUnifiedEnabled()));
web_ui()->CallJavascriptFunctionUnsafe("cr.FirstRun.showStep", step_params);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment