OLD | NEW |
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/main/placeholder.h" | 5 #include "athena/main/placeholder.h" |
6 | 6 |
| 7 #include "athena/main/web_task.h" |
7 #include "athena/screen/public/screen_manager.h" | 8 #include "athena/screen/public/screen_manager.h" |
| 9 #include "athena/task/public/task_manager.h" |
8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "content/public/browser/web_contents.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
11 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
12 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
13 #include "ui/views/background.h" | 16 #include "ui/views/background.h" |
14 #include "ui/views/controls/label.h" | 17 #include "ui/views/controls/label.h" |
15 #include "ui/views/painter.h" | 18 #include "ui/views/painter.h" |
16 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
17 | 20 |
18 void CreateTestWindows() { | 21 void CreateTestWindows() { |
19 const int kAppWindowBackgroundColor = 0xFFDDDDDD; | 22 const int kAppWindowBackgroundColor = 0xFFDDDDDD; |
(...skipping 13 matching lines...) Expand all Loading... |
33 | 36 |
34 void SetupBackgroundImage() { | 37 void SetupBackgroundImage() { |
35 gfx::Size size(200, 200); | 38 gfx::Size size(200, 200); |
36 gfx::Canvas canvas(size, 1.0f, true); | 39 gfx::Canvas canvas(size, 1.0f, true); |
37 scoped_ptr<views::Painter> painter( | 40 scoped_ptr<views::Painter> painter( |
38 views::Painter::CreateVerticalGradient(SK_ColorBLUE, SK_ColorCYAN)); | 41 views::Painter::CreateVerticalGradient(SK_ColorBLUE, SK_ColorCYAN)); |
39 painter->Paint(&canvas, size); | 42 painter->Paint(&canvas, size); |
40 athena::ScreenManager::Get()->SetBackgroundImage( | 43 athena::ScreenManager::Get()->SetBackgroundImage( |
41 gfx::ImageSkia(canvas.ExtractImageRep())); | 44 gfx::ImageSkia(canvas.ExtractImageRep())); |
42 } | 45 } |
| 46 |
| 47 void CreateTestPages(content::BrowserContext* browser_context) { |
| 48 const char* kTestURLs[] = { |
| 49 "http://cyan.bikeshed.com", |
| 50 "https://www.google.com", |
| 51 }; |
| 52 for (size_t i = 0; i < arraysize(kTestURLs); ++i) { |
| 53 content::WebContents::CreateParams params(browser_context); |
| 54 content::WebContents* contents = content::WebContents::Create(params); |
| 55 contents->GetController().LoadURL(GURL(kTestURLs[i]), |
| 56 content::Referrer(), |
| 57 content::PAGE_TRANSITION_TYPED, |
| 58 std::string()); |
| 59 athena::TaskManager::Get()->AddTask(new WebTask(contents)); |
| 60 contents->Focus(); |
| 61 } |
| 62 } |
OLD | NEW |