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

Side by Side Diff: athena/content/content_app_model_builder.cc

Issue 335003003: Introduces AppActivity and handler of chrome.shell API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: AppWindowOwner 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
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/content/public/content_app_model_builder.h" 5 #include "athena/content/public/content_app_model_builder.h"
6 6
7 #include "apps/shell/browser/shell_extension_system.h"
7 #include "athena/activity/public/activity_factory.h" 8 #include "athena/activity/public/activity_factory.h"
8 #include "athena/activity/public/activity_manager.h" 9 #include "athena/activity/public/activity_manager.h"
9 #include "ui/app_list/app_list_item.h" 10 #include "ui/app_list/app_list_item.h"
10 #include "ui/app_list/app_list_model.h" 11 #include "ui/app_list/app_list_model.h"
11 12
12 namespace athena { 13 namespace athena {
13 14
14 namespace { 15 namespace {
15 16
16 const int kIconSize = 64; 17 const int kIconSize = 64;
(...skipping 12 matching lines...) Expand all
29 bitmap.setConfig(SkBitmap::kARGB_8888_Config, kIconSize, kIconSize); 30 bitmap.setConfig(SkBitmap::kARGB_8888_Config, kIconSize, kIconSize);
30 bitmap.allocPixels(); 31 bitmap.allocPixels();
31 bitmap.eraseColor(color); 32 bitmap.eraseColor(color);
32 SetIcon(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), false /* has_shadow */); 33 SetIcon(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), false /* has_shadow */);
33 SetName(id); 34 SetName(id);
34 } 35 }
35 36
36 private: 37 private:
37 // Overridden from app_list::AppListItem: 38 // Overridden from app_list::AppListItem:
38 virtual void Activate(int event_flags) OVERRIDE { 39 virtual void Activate(int event_flags) OVERRIDE {
39 ActivityManager::Get()->AddActivity( 40 extensions::ShellExtensionSystem* extension_system =
40 ActivityFactory::Get()->CreateAppActivity( 41 static_cast<extensions::ShellExtensionSystem*>(
41 browser_context_, id_)); 42 extensions::ExtensionSystem::Get(browser_context_));
43 extension_system->LaunchApp();
42 } 44 }
43 45
44 std::string id_; 46 std::string id_;
45 content::BrowserContext* browser_context_; 47 content::BrowserContext* browser_context_;
46 48
47 DISALLOW_COPY_AND_ASSIGN(DummyItem); 49 DISALLOW_COPY_AND_ASSIGN(DummyItem);
48 }; 50 };
49 51
50 } // namespace 52 } // namespace
51 53
(...skipping 12 matching lines...) Expand all
64 new DummyItem("calendar", SK_ColorBLUE, browser_context_))); 66 new DummyItem("calendar", SK_ColorBLUE, browser_context_)));
65 model->AddItem(scoped_ptr<app_list::AppListItem>( 67 model->AddItem(scoped_ptr<app_list::AppListItem>(
66 new DummyItem("video", SK_ColorGREEN, browser_context_))); 68 new DummyItem("video", SK_ColorGREEN, browser_context_)));
67 model->AddItem(scoped_ptr<app_list::AppListItem>( 69 model->AddItem(scoped_ptr<app_list::AppListItem>(
68 new DummyItem("music", SK_ColorYELLOW, browser_context_))); 70 new DummyItem("music", SK_ColorYELLOW, browser_context_)));
69 model->AddItem(scoped_ptr<app_list::AppListItem>( 71 model->AddItem(scoped_ptr<app_list::AppListItem>(
70 new DummyItem("contact", SK_ColorCYAN, browser_context_))); 72 new DummyItem("contact", SK_ColorCYAN, browser_context_)));
71 } 73 }
72 74
73 } // namespace athena 75 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698