Skip to content

Commit

Permalink
Implemented WebUI transitions for first-run UI.
Browse files Browse the repository at this point in the history
Transitions are disabled by default because of performance problems. To enable use "enable-first-run-ui-transitions" flag.

BUG=321314

Review URL: https://codereview.chromium.org/107753004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240597 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dzhioev@chromium.org committed Dec 13, 2013
1 parent 21fafdb commit 407d82b
Show file tree
Hide file tree
Showing 23 changed files with 317 additions and 57 deletions.
6 changes: 6 additions & 0 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -6678,6 +6678,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_DISABLE_FIRST_RUN_UI_DESCRIPTION" desc="Description for the flag to disable new first-run UI.">
If disabled, overlay tutorial won't be shown after first login.
</message>
<message name="IDS_FLAGS_ENABLE_FIRST_RUN_UI_TRANSITIONS_NAME" desc="Name of the flag to enable animated transitions for the first-run tutorial.">
Enable animated transitions in the first-run tutorial.
</message>
<message name="IDS_FLAGS_ENABLE_FIRST_RUN_UI_TRANSITIONS_DESCRIPTION" desc="Description for the flag to enable animated transition in the first-run tutorial.">
If enabled, transitions during first-run tutorial are animated.
</message>
</if>
<message name="IDS_FLAGS_HIDPI_NAME" desc="Name of flag to enable/disable HiDPI Support.">
HiDPI Support
Expand Down
7 changes: 7 additions & 0 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,13 @@ const Experiment kExperiments[] = {
kOsCrOS,
SINGLE_VALUE_TYPE(chromeos::switches::kDisableFirstRunUI)
},
{
"enable-first-run-ui-transitions",
IDS_FLAGS_ENABLE_FIRST_RUN_UI_TRANSITIONS_NAME,
IDS_FLAGS_ENABLE_FIRST_RUN_UI_TRANSITIONS_DESCRIPTION,
kOsCrOS,
SINGLE_VALUE_TYPE(chromeos::switches::kEnableFirstRunUITransitions)
},
#endif
{
"disable-compositor-touch-hit-testing",
Expand Down
31 changes: 19 additions & 12 deletions chrome/browser/chromeos/first_run/first_run_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void FirstRunController::Init() {
shell_helper_->GetOverlayWidget()->SetContentsView(view);
actor_ = view->GetActor();
actor_->set_delegate(this);
shell_helper_->GetOverlayWidget()->Show();
if (actor_->IsInitialized())
OnActorInitialized();
}
Expand All @@ -85,25 +86,33 @@ void FirstRunController::Finalize() {

void FirstRunController::OnActorInitialized() {
RegisterSteps();
shell_helper_->GetOverlayWidget()->Show();
actor_->SetBackgroundVisible(true);
ShowNextStep();
}

void FirstRunController::OnNextButtonClicked(const std::string& step_name) {
DCHECK(GetCurrentStep() && GetCurrentStep()->name() == step_name);
ShowNextStep();
GetCurrentStep()->OnBeforeHide();
actor_->HideCurrentStep();
}

void FirstRunController::OnHelpButtonClicked() {
Stop();
chrome::ShowHelpForProfile(
user_profile_,
chrome::HOST_DESKTOP_TYPE_ASH,
chrome::HELP_SOURCE_MENU);
on_actor_finalized_ = base::Bind(chrome::ShowHelpForProfile,
user_profile_,
chrome::HOST_DESKTOP_TYPE_ASH,
chrome::HELP_SOURCE_MENU);
actor_->Finalize();
}

void FirstRunController::OnCloseButtonClicked() {
void FirstRunController::OnStepHidden(const std::string& step_name) {
DCHECK(GetCurrentStep() && GetCurrentStep()->name() == step_name);
GetCurrentStep()->OnAfterHide();
if (!actor_->IsFinalizing())
ShowNextStep();
}

void FirstRunController::OnActorFinalized() {
if (!on_actor_finalized_.is_null())
on_actor_finalized_.Run();
Stop();
}

Expand All @@ -128,13 +137,11 @@ void FirstRunController::RegisterSteps() {
}

void FirstRunController::ShowNextStep() {
if (GetCurrentStep())
GetCurrentStep()->OnBeforeHide();
AdvanceStep();
if (GetCurrentStep())
GetCurrentStep()->Show();
else
Stop();
actor_->Finalize();
}

void FirstRunController::AdvanceStep() {
Expand Down
7 changes: 6 additions & 1 deletion chrome/browser/chromeos/first_run/first_run_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "ash/first_run/first_run_helper.h"
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/scoped_ptr.h"
Expand Down Expand Up @@ -48,7 +49,8 @@ class FirstRunController : public FirstRunActor::Delegate,
virtual void OnActorInitialized() OVERRIDE;
virtual void OnNextButtonClicked(const std::string& step_name) OVERRIDE;
virtual void OnHelpButtonClicked() OVERRIDE;
virtual void OnCloseButtonClicked() OVERRIDE;
virtual void OnStepHidden(const std::string& step_name) OVERRIDE;
virtual void OnActorFinalized() OVERRIDE;
virtual void OnActorDestroyed() OVERRIDE;

// Overriden from ash::FirstRunHelper::Observer.
Expand All @@ -75,6 +77,9 @@ class FirstRunController : public FirstRunActor::Delegate,
// Profile used for webui and help app.
Profile* user_profile_;

// The work that should be made after actor has been finalized.
base::Closure on_actor_finalized_;

DISALLOW_COPY_AND_ASSIGN(FirstRunController);
};

Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/chromeos/first_run/step.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ void Step::OnBeforeHide() {
actor()->RemoveBackgroundHoles();
}

void Step::OnAfterHide() {
}

gfx::Size Step::GetOverlaySize() const {
return shell_helper()->GetOverlayWidget()->GetWindowBoundsInScreen().size();
}
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/chromeos/first_run/step.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class Step {
// background.
virtual void OnBeforeHide();

// Called after step has been hidden.
virtual void OnAfterHide();

// Returns size of overlay window.
gfx::Size GetOverlaySize() const;

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/first_run/steps/help_step.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void HelpStep::Show() {
actor()->ShowStepPointingTo(name(), center.x(), center.y(), kCircleRadius);
}

void HelpStep::OnBeforeHide() {
void HelpStep::OnAfterHide() {
shell_helper()->CloseTrayBubble();
}

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/first_run/steps/help_step.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class HelpStep : public Step {

// Overriden from Step.
virtual void Show() OVERRIDE;
virtual void OnBeforeHide() OVERRIDE;
virtual void OnAfterHide() OVERRIDE;
};

} // namespace first_run
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="app-list" class="step bubble points-down left">
<div id="app-list" class="step bubble points-down left transparent hidden">
<h1 i18n-content="appListHeader"></h1>
<p>
<span i18n-content="appListText1"></span><br>
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/resources/chromeos/first_run/background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions chrome/browser/resources/chromeos/first_run/first_run.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* found in the LICENSE file.
*/

[hidden] {
display: none !important;
}

html,
body {
margin: 0;
Expand All @@ -19,6 +23,23 @@ body {
width: 100%;
}

.transparent {
opacity: 0;
}

.show-animated,
.hide-animated {
transition-property: opacity;
}

.show-animated {
transition-function: ease-in;
}

.hide-animated {
transition-function: ease-out;
}

#background-container {
height: 100%;
left: 0;
Expand Down
Loading

0 comments on commit 407d82b

Please sign in to comment.