Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
Albert Bodenhamer
2014/05/16 20:11:24
Looks like main_util is just placeholder stuff?
oshima
2014/05/16 20:14:13
Yes, this is just a dummy impl until we have real
Albert Bodenhamer
2014/05/16 20:22:20
Perhaps. When I see a file named "main_util.h/cc"
oshima
2014/05/16 22:26:33
renamed to just placeholder.h/cc as it does a bit
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "athena/main/main_util.h" | |
| 6 | |
| 7 #include "athena/screen/public/screen_manager.h" | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/strings/utf_string_conversions.h" | |
| 10 #include "third_party/skia/include/core/SkColor.h" | |
| 11 #include "ui/gfx/canvas.h" | |
| 12 #include "ui/gfx/image/image_skia.h" | |
| 13 #include "ui/views/background.h" | |
| 14 #include "ui/views/controls/label.h" | |
| 15 #include "ui/views/painter.h" | |
| 16 #include "ui/views/widget/widget.h" | |
| 17 | |
| 18 void CreateTestApp() { | |
| 19 views::Widget* test_app_widget = new views::Widget; | |
| 20 // Athena doesn't have frame yet. | |
| 21 views::Widget::InitParams params( | |
| 22 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | |
| 23 params.context = athena::ScreenManager::Get()->GetContext(); | |
| 24 test_app_widget->Init(params); | |
| 25 views::Label* label = new views::Label; | |
| 26 label->SetText(base::ASCIIToUTF16("AppWindow")); | |
| 27 label->set_background( | |
| 28 views::Background::CreateSolidBackground(SK_ColorWHITE)); | |
| 29 test_app_widget->SetContentsView(label); | |
| 30 test_app_widget->Show(); | |
| 31 } | |
| 32 | |
| 33 void SetupBackgroundImage() { | |
| 34 gfx::Size size(200, 200); | |
| 35 gfx::Canvas canvas(size, 1.0f, true); | |
| 36 scoped_ptr<views::Painter> painter( | |
| 37 views::Painter::CreateVerticalGradient(SK_ColorBLUE, SK_ColorCYAN)); | |
| 38 painter->Paint(&canvas, size); | |
| 39 athena::ScreenManager::Get()->SetBackgroundImage( | |
| 40 gfx::ImageSkia(canvas.ExtractImageRep())); | |
| 41 } | |
| OLD | NEW |