OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "athena/test/base/sample_activity_factory.h" | |
6 | |
7 #include <string> | |
8 | |
9 #include "athena/activity/public/activity_manager.h" | |
10 #include "athena/test/base/sample_activity.h" | |
11 #include "base/logging.h" | |
12 #include "base/strings/utf_string_conversions.h" | |
13 #include "third_party/skia/include/core/SkColor.h" | |
14 #include "url/gurl.h" | |
15 | |
16 namespace athena { | |
17 namespace test { | |
18 | |
19 namespace { | |
20 const SkColor kDefaultColor = SK_ColorRED; | |
21 const SkColor kDefaultContentColor = SK_ColorGREEN; | |
22 | |
23 const SkColor kDefaultAppColor = SK_ColorYELLOW; | |
24 const SkColor kDefaultAppContentColor = SK_ColorBLUE; | |
25 } | |
26 | |
27 SampleActivityFactory::SampleActivityFactory() {} | |
28 | |
29 SampleActivityFactory::~SampleActivityFactory() {} | |
30 | |
31 Activity* SampleActivityFactory::CreateWebActivity( | |
32 content::BrowserContext* browser_context, | |
33 const base::string16& title, | |
34 const GURL& url) { | |
35 Activity* activity = new SampleActivity( | |
36 kDefaultColor, kDefaultContentColor, base::UTF8ToUTF16(url.spec())); | |
37 ActivityManager::Get()->AddActivity(activity); | |
38 return activity; | |
39 } | |
40 | |
41 Activity* SampleActivityFactory::CreateWebActivity( | |
42 content::WebContents* contents) { | |
43 Activity* activity = | |
44 new SampleActivity(kDefaultColor, kDefaultContentColor, base::string16()); | |
45 ActivityManager::Get()->AddActivity(activity); | |
46 return activity; | |
47 } | |
48 | |
49 Activity* SampleActivityFactory::CreateAppActivity( | |
50 const std::string& app_id, | |
51 views::WebView* web_view) { | |
52 DCHECK(!web_view); | |
53 Activity* activity = new SampleActivity( | |
54 kDefaultAppColor, kDefaultAppContentColor, base::UTF8ToUTF16("App")); | |
55 ActivityManager::Get()->AddActivity(activity); | |
56 return activity; | |
57 } | |
58 | |
59 } // namespace test | |
60 } // namespace athena | |
OLD | NEW |