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

Side by Side Diff: athena/main/placeholder.cc

Issue 314303004: Use webview in web activity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « athena/main/placeholder.h ('k') | athena/main/placeholder_content.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/main/placeholder.h" 5 #include "athena/main/placeholder.h"
6 6
7 #include "athena/activity/public/activity_factory.h"
8 #include "athena/activity/public/activity_manager.h"
7 #include "athena/screen/public/screen_manager.h" 9 #include "athena/screen/public/screen_manager.h"
8 #include "base/memory/scoped_ptr.h" 10 #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 "third_party/skia/include/core/SkColor.h"
11 #include "ui/gfx/canvas.h" 12 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/image/image_skia.h" 13 #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" 14 #include "ui/views/painter.h"
16 #include "ui/views/widget/widget.h"
17 15
18 void CreateTestWindows() { 16 void CreateTestPages(content::BrowserContext* browser_context) {
19 const int kAppWindowBackgroundColor = 0xFFDDDDDD; 17 const char* kTestURLs[] = {
20 views::Widget* test_app_widget = new views::Widget; 18 "http://cyan.bikeshed.com", "https://news.google.com",
21 // Athena doesn't have frame yet. 19 "http://blue.bikeshed.com", "https://www.google.com",
22 views::Widget::InitParams params( 20 };
23 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 21 for (size_t i = 0; i < arraysize(kTestURLs); ++i) {
24 params.context = athena::ScreenManager::Get()->GetContext(); 22 athena::ActivityManager::Get()->AddActivity(
25 test_app_widget->Init(params); 23 athena::ActivityFactory::Get()->CreateWebActivity(browser_context,
26 views::Label* label = new views::Label; 24 GURL(kTestURLs[i])));
27 label->SetText(base::ASCIIToUTF16("AppWindow")); 25 }
28 label->set_background(
29 views::Background::CreateSolidBackground(kAppWindowBackgroundColor));
30 test_app_widget->SetContentsView(label);
31 test_app_widget->Show();
32 } 26 }
33 27
34 void SetupBackgroundImage() { 28 void SetupBackgroundImage() {
35 gfx::Size size(200, 200); 29 gfx::Size size(200, 200);
36 gfx::Canvas canvas(size, 1.0f, true); 30 gfx::Canvas canvas(size, 1.0f, true);
37 scoped_ptr<views::Painter> painter( 31 scoped_ptr<views::Painter> painter(
38 views::Painter::CreateVerticalGradient(SK_ColorBLUE, SK_ColorCYAN)); 32 views::Painter::CreateVerticalGradient(SK_ColorBLUE, SK_ColorCYAN));
39 painter->Paint(&canvas, size); 33 painter->Paint(&canvas, size);
40 athena::ScreenManager::Get()->SetBackgroundImage( 34 athena::ScreenManager::Get()->SetBackgroundImage(
41 gfx::ImageSkia(canvas.ExtractImageRep())); 35 gfx::ImageSkia(canvas.ExtractImageRep()));
42 } 36 }
OLDNEW
« no previous file with comments | « athena/main/placeholder.h ('k') | athena/main/placeholder_content.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698