Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: athena/system/background_controller.cc

Issue 697143005: Fills athena background always. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/system/background_controller.h" 5 #include "athena/system/background_controller.h"
6 6
7 #include "athena/system/public/system_ui.h" 7 #include "athena/system/public/system_ui.h"
8 #include "athena/util/fill_layout_manager.h"
8 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
9 #include "ui/compositor/layer.h" 10 #include "ui/compositor/layer.h"
10 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
11 #include "ui/gfx/image/image_skia.h" 12 #include "ui/gfx/image/image_skia.h"
12 #include "ui/views/view.h" 13 #include "ui/views/view.h"
13 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
14 15
15 namespace athena { 16 namespace athena {
16 17
17 class BackgroundView : public views::View { 18 class BackgroundView : public views::View {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 gfx::ImageSkia image_; 52 gfx::ImageSkia image_;
52 views::View* system_info_view_; 53 views::View* system_info_view_;
53 54
54 DISALLOW_COPY_AND_ASSIGN(BackgroundView); 55 DISALLOW_COPY_AND_ASSIGN(BackgroundView);
55 }; 56 };
56 57
57 BackgroundController::BackgroundController(aura::Window* background_container) { 58 BackgroundController::BackgroundController(aura::Window* background_container) {
58 views::Widget* background_widget = new views::Widget; 59 views::Widget* background_widget = new views::Widget;
59 views::Widget::InitParams params( 60 views::Widget::InitParams params(
60 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 61 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
61 params.parent = background_container;
62 background_widget->Init(params); 62 background_widget->Init(params);
63 background_widget->GetNativeWindow()->SetProperty(kAlwaysFillWindowKey, true);
63 background_widget->GetNativeWindow()->layer()->SetMasksToBounds(true); 64 background_widget->GetNativeWindow()->layer()->SetMasksToBounds(true);
65 // background_widget should be reparented to |background_container| after
66 // settings kAlwaysFillWindowKey, otherwise FillLayoutManager cannot fill it
67 // properly.
68 views::Widget::ReparentNativeView(background_widget->GetNativeWindow(),
69 background_container);
64 background_view_ = new BackgroundView; 70 background_view_ = new BackgroundView;
65 background_widget->SetContentsView(background_view_); 71 background_widget->SetContentsView(background_view_);
66 background_widget->GetNativeView()->SetName("BackgroundWidget"); 72 background_widget->GetNativeView()->SetName("BackgroundWidget");
67 background_widget->Show(); 73 background_widget->Show();
68 } 74 }
69 75
70 BackgroundController::~BackgroundController() { 76 BackgroundController::~BackgroundController() {
71 // background_widget is owned by the container and will be deleted 77 // background_widget is owned by the container and will be deleted
72 // when the container is deleted. 78 // when the container is deleted.
73 } 79 }
74 80
75 void BackgroundController::SetImage(const gfx::ImageSkia& image) { 81 void BackgroundController::SetImage(const gfx::ImageSkia& image) {
76 // TODO(oshima): implement cross fede animation. 82 // TODO(oshima): implement cross fede animation.
77 background_view_->SetImage(image); 83 background_view_->SetImage(image);
78 } 84 }
79 85
80 } // namespace athena 86 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698