diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-03 01:15:10 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-03 01:15:10 +0000 |
commit | 697f04c0a9168dfb3b85f8764ad9e4fb32e369e3 (patch) | |
tree | 2a06773998e72c5ea2d06869aab03567f9463bf5 /ash/wm | |
parent | abd82e6cf2b284bc839acf9984d90111787a9065 (diff) | |
download | chromium_src-697f04c0a9168dfb3b85f8764ad9e4fb32e369e3.zip chromium_src-697f04c0a9168dfb3b85f8764ad9e4fb32e369e3.tar.gz chromium_src-697f04c0a9168dfb3b85f8764ad9e4fb32e369e3.tar.bz2 |
ash: Display system background while loading wallpaper.
When the wallpaper takes a long time to load, areas of the
screen that aren't covered by other layers are painted
white. This looks okay when we first boot, but not when
we're displaying the login after logging out or while we're
starting a guest session.
This makes us instead initialize SystemBackgroundController
immediately with either a #fefefe or black color depending
on whether this is the first Chrome run after boot or not.
Its color is updated to black after the login wallpaper
animation is finished.
BUG=151111,152751
Review URL: https://chromiumcodereview.appspot.com/11054005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm')
-rw-r--r-- | ash/wm/workspace/system_background_controller.cc | 13 | ||||
-rw-r--r-- | ash/wm/workspace/system_background_controller.h | 7 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_manager2.cc | 20 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_manager2.h | 12 |
4 files changed, 17 insertions, 35 deletions
diff --git a/ash/wm/workspace/system_background_controller.cc b/ash/wm/workspace/system_background_controller.cc index 728e3e1..363a305 100644 --- a/ash/wm/workspace/system_background_controller.cc +++ b/ash/wm/workspace/system_background_controller.cc @@ -5,6 +5,7 @@ #include "ash/wm/workspace/system_background_controller.h" #include "ash/shell_window_ids.h" +#include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" #include "ui/gfx/canvas.h" #include "ui/views/widget/widget.h" @@ -49,7 +50,8 @@ views::View* SystemBackgroundController::View::GetContentsView() { return this; } -SystemBackgroundController::SystemBackgroundController(aura::RootWindow* root) +SystemBackgroundController::SystemBackgroundController(aura::RootWindow* root, + SkColor color) : ALLOW_THIS_IN_INITIALIZER_LIST(view_(new View(this))) { views::Widget* widget = new views::Widget; views::Widget::InitParams params( @@ -62,7 +64,9 @@ SystemBackgroundController::SystemBackgroundController(aura::RootWindow* root) // flicker. params.layer_type = ui::LAYER_SOLID_COLOR; widget->Init(params); - widget->GetNativeView()->layer()->SetColor(SK_ColorBLACK); + widget->GetNativeView()->SetProperty(aura::client::kAnimationsDisabledKey, + true); + widget->GetNativeView()->layer()->SetColor(color); widget->SetBounds(params.parent->bounds()); widget->Show(); widget->GetNativeView()->SetName("SystemBackground"); @@ -73,5 +77,10 @@ SystemBackgroundController::~SystemBackgroundController() { view_->Close(); } +void SystemBackgroundController::SetColor(SkColor color) { + if (view_) + view_->GetWidget()->GetNativeView()->layer()->SetColor(color); +} + } // namespace internal } // namespace ash diff --git a/ash/wm/workspace/system_background_controller.h b/ash/wm/workspace/system_background_controller.h index ca78ab8..4b84fc0 100644 --- a/ash/wm/workspace/system_background_controller.h +++ b/ash/wm/workspace/system_background_controller.h @@ -8,6 +8,8 @@ #include "ash/ash_export.h" #include "base/basictypes.h" +typedef unsigned int SkColor; + namespace aura { class RootWindow; }; @@ -20,9 +22,12 @@ namespace internal { // level background. class ASH_EXPORT SystemBackgroundController { public: - explicit SystemBackgroundController(aura::RootWindow* root); + SystemBackgroundController(aura::RootWindow* root, SkColor color); ~SystemBackgroundController(); + // Changes the background color. + void SetColor(SkColor color); + private: class View; diff --git a/ash/wm/workspace/workspace_manager2.cc b/ash/wm/workspace/workspace_manager2.cc index 075815d..805dd18 100644 --- a/ash/wm/workspace/workspace_manager2.cc +++ b/ash/wm/workspace/workspace_manager2.cc @@ -16,7 +16,6 @@ #include "ash/wm/window_animations.h" #include "ash/wm/window_properties.h" #include "ash/wm/window_util.h" -#include "ash/wm/workspace/system_background_controller.h" #include "ash/wm/workspace/workspace_layout_manager2.h" #include "ash/wm/workspace/workspace2.h" #include "base/auto_reset.h" @@ -331,21 +330,6 @@ void WorkspaceManager2::SetActiveWorkspace(Workspace2* workspace, contents_view_->StackChildAtTop(last_active->window()); } - destroy_background_timer_.Stop(); - if (active_workspace_ == desktop_workspace()) { - base::TimeDelta delay(GetSystemBackgroundDestroyDuration()); - if (ui::LayerAnimator::slow_animation_mode()) - delay *= ui::LayerAnimator::slow_animation_scale_factor(); - // Delay an extra 100ms to make sure everything settles down before - // destroying the background. - delay += base::TimeDelta::FromMilliseconds(100); - destroy_background_timer_.Start( - FROM_HERE, delay, this, &WorkspaceManager2::DestroySystemBackground); - } else if (!background_controller_.get()) { - background_controller_.reset(new SystemBackgroundController( - contents_view_->GetRootWindow())); - } - UpdateShelfVisibility(); if (animate_type != ANIMATE_NONE) { @@ -456,10 +440,6 @@ void WorkspaceManager2::ScheduleDelete(Workspace2* workspace) { &WorkspaceManager2::ProcessDeletion); } -void WorkspaceManager2::DestroySystemBackground() { - background_controller_.reset(); -} - void WorkspaceManager2::SetUnminimizingWorkspace(Workspace2* workspace) { // The normal sequence of unminimizing a window is: Show() the window, which // triggers changing the kShowStateKey to NORMAL and lastly the window is made diff --git a/ash/wm/workspace/workspace_manager2.h b/ash/wm/workspace/workspace_manager2.h index 8a9b9db..1cd1b0c 100644 --- a/ash/wm/workspace/workspace_manager2.h +++ b/ash/wm/workspace/workspace_manager2.h @@ -36,7 +36,6 @@ namespace ash { namespace internal { class ShelfLayoutManager; -class SystemBackgroundController; class WorkspaceLayoutManager2; class WorkspaceManagerTest2; class Workspace2; @@ -139,9 +138,6 @@ class ASH_EXPORT WorkspaceManager2 // any layers. void ProcessDeletion(); - // Deletes |background_controller_|. Called from |destroy_background_timer_|. - void DestroySystemBackground(); - // Sets |unminimizing_workspace_| to |workspace|. void SetUnminimizingWorkspace(Workspace2* workspace); @@ -198,14 +194,6 @@ class ASH_EXPORT WorkspaceManager2 // See comments in SetUnminimizingWorkspace() for details. base::WeakPtrFactory<WorkspaceManager2> clear_unminimizing_workspace_factory_; - // Used to show the system level background. Non-null when the background is - // visible. - scoped_ptr<SystemBackgroundController> background_controller_; - - // Timer used to destroy the background. We wait to destroy until animations - // complete. - base::OneShotTimer<WorkspaceManager2> destroy_background_timer_; - // See comments in SetUnminimizingWorkspace() for details. Workspace2* unminimizing_workspace_; |