| OLD | NEW | 
|    1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include "ash/launcher/launcher.h" |    5 #include "ash/launcher/launcher.h" | 
|    6  |    6  | 
|    7 #include "ash/launcher/launcher_model.h" |    7 #include "ash/launcher/launcher_model.h" | 
|    8 #include "ash/launcher/launcher_view.h" |    8 #include "ash/launcher/launcher_view.h" | 
|    9 #include "ash/shell.h" |    9 #include "ash/shell.h" | 
|   10 #include "ash/shell_delegate.h" |   10 #include "ash/shell_delegate.h" | 
|   11 #include "ash/shell_window_ids.h" |   11 #include "ash/shell_window_ids.h" | 
|   12 #include "grit/ui_resources.h" |   12 #include "grit/ui_resources.h" | 
|   13 #include "ui/aura/window.h" |   13 #include "ui/aura/window.h" | 
|   14 #include "ui/base/resource/resource_bundle.h" |   14 #include "ui/base/resource/resource_bundle.h" | 
|   15 #include "ui/gfx/canvas.h" |   15 #include "ui/gfx/canvas.h" | 
|   16 #include "ui/gfx/compositor/layer.h" |   16 #include "ui/gfx/compositor/layer.h" | 
|   17 #include "ui/gfx/image/image.h" |   17 #include "ui/gfx/image/image.h" | 
|   18 #include "ui/views/painter.h" |   18 #include "ui/views/painter.h" | 
|   19 #include "ui/views/widget/widget.h" |   19 #include "ui/views/widget/widget.h" | 
|   20  |   20  | 
|   21 namespace aura_shell { |   21 namespace ash { | 
|   22  |   22  | 
|   23 namespace { |   23 namespace { | 
|   24  |   24  | 
|   25 // Used to draw the background of the shelf. |   25 // Used to draw the background of the shelf. | 
|   26 class ShelfPainter : public views::Painter { |   26 class ShelfPainter : public views::Painter { | 
|   27  public: |   27  public: | 
|   28   ShelfPainter() { |   28   ShelfPainter() { | 
|   29     ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |   29     ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 
|   30     image_ = *rb.GetImageNamed(IDR_AURA_LAUNCHER_BACKGROUND).ToSkBitmap(); |   30     image_ = *rb.GetImageNamed(IDR_AURA_LAUNCHER_BACKGROUND).ToSkBitmap(); | 
|   31   } |   31   } | 
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   95       delegate_view_(NULL) { |   95       delegate_view_(NULL) { | 
|   96   window_container->AddObserver(this); |   96   window_container->AddObserver(this); | 
|   97  |   97  | 
|   98   model_.reset(new LauncherModel); |   98   model_.reset(new LauncherModel); | 
|   99  |   99  | 
|  100   widget_ = new views::Widget; |  100   widget_ = new views::Widget; | 
|  101   views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |  101   views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 
|  102   params.create_texture_for_layer = true; |  102   params.create_texture_for_layer = true; | 
|  103   params.transparent = true; |  103   params.transparent = true; | 
|  104   params.parent = Shell::GetInstance()->GetContainer( |  104   params.parent = Shell::GetInstance()->GetContainer( | 
|  105       aura_shell::internal::kShellWindowId_LauncherContainer); |  105       ash::internal::kShellWindowId_LauncherContainer); | 
|  106   internal::LauncherView* launcher_view = |  106   internal::LauncherView* launcher_view = | 
|  107       new internal::LauncherView(model_.get()); |  107       new internal::LauncherView(model_.get()); | 
|  108   launcher_view->Init(); |  108   launcher_view->Init(); | 
|  109   delegate_view_ = new DelegateView; |  109   delegate_view_ = new DelegateView; | 
|  110   delegate_view_->AddChildView(launcher_view); |  110   delegate_view_->AddChildView(launcher_view); | 
|  111   params.delegate = delegate_view_; |  111   params.delegate = delegate_view_; | 
|  112   widget_->Init(params); |  112   widget_->Init(params); | 
|  113   gfx::Size pref = static_cast<views::View*>(launcher_view)->GetPreferredSize(); |  113   gfx::Size pref = static_cast<views::View*>(launcher_view)->GetPreferredSize(); | 
|  114   widget_->SetBounds(gfx::Rect(0, 0, pref.width(), pref.height())); |  114   widget_->SetBounds(gfx::Rect(0, 0, pref.width(), pref.height())); | 
|  115   widget_->SetContentsView(delegate_view_); |  115   widget_->SetContentsView(delegate_view_); | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  173   if (i != model_->items().end()) |  173   if (i != model_->items().end()) | 
|  174     model_->RemoveItemAt(i - model_->items().begin()); |  174     model_->RemoveItemAt(i - model_->items().begin()); | 
|  175 } |  175 } | 
|  176  |  176  | 
|  177 void Launcher::OnWindowVisibilityChanged(aura::Window* window, |  177 void Launcher::OnWindowVisibilityChanged(aura::Window* window, | 
|  178                                          bool visibile) { |  178                                          bool visibile) { | 
|  179   if (visibile && !known_windows_[window]) |  179   if (visibile && !known_windows_[window]) | 
|  180     MaybeAdd(window); |  180     MaybeAdd(window); | 
|  181 } |  181 } | 
|  182  |  182  | 
|  183 }  // namespace aura_shell |  183 }  // namespace ash | 
| OLD | NEW |