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

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

Issue 335793005: athena: Add support for virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 "apps/shell/app/shell_main_delegate.h" 5 #include "apps/shell/app/shell_main_delegate.h"
6 #include "apps/shell/browser/shell_browser_main_delegate.h" 6 #include "apps/shell/browser/shell_browser_main_delegate.h"
7 #include "apps/shell/browser/shell_desktop_controller.h" 7 #include "apps/shell/browser/shell_desktop_controller.h"
8 #include "apps/shell/browser/shell_extension_system.h" 8 #include "apps/shell/browser/shell_extension_system.h"
9 #include "apps/shell/renderer/shell_renderer_main_delegate.h" 9 #include "apps/shell/renderer/shell_renderer_main_delegate.h"
10 #include "athena/content/public/content_activity_factory.h" 10 #include "athena/content/public/content_activity_factory.h"
11 #include "athena/content/public/content_app_model_builder.h" 11 #include "athena/content/public/content_app_model_builder.h"
12 #include "athena/home/public/home_card.h" 12 #include "athena/home/public/home_card.h"
13 #include "athena/main/athena_app_window_controller.h" 13 #include "athena/main/athena_app_window_controller.h"
14 #include "athena/main/athena_launcher.h" 14 #include "athena/main/athena_launcher.h"
15 #include "athena/main/placeholder.h" 15 #include "athena/main/placeholder.h"
16 #include "athena/main/url_search_provider.h" 16 #include "athena/main/url_search_provider.h"
17 #include "athena/virtual_keyboard/public/virtual_keyboard_bindings.h"
18 #include "athena/virtual_keyboard/public/virtual_keyboard_manager.h"
17 #include "base/command_line.h" 19 #include "base/command_line.h"
18 #include "base/file_util.h" 20 #include "base/file_util.h"
19 #include "content/public/app/content_main.h" 21 #include "content/public/app/content_main.h"
20 #include "ui/aura/window_tree_host.h" 22 #include "ui/aura/window_tree_host.h"
21 #include "ui/wm/core/visibility_controller.h" 23 #include "ui/wm/core/visibility_controller.h"
22 24
23 namespace { 25 namespace {
24 const std::string kAppSwitch = "app"; 26 const std::string kAppSwitch = "app";
25 } // namespace 27 } // namespace
26 28
27 class AthenaBrowserMainDelegate : public apps::ShellBrowserMainDelegate { 29 class AthenaBrowserMainDelegate : public apps::ShellBrowserMainDelegate {
28 public: 30 public:
29 AthenaBrowserMainDelegate() {} 31 AthenaBrowserMainDelegate() {}
30 virtual ~AthenaBrowserMainDelegate() {} 32 virtual ~AthenaBrowserMainDelegate() {}
31 33
32 // apps::ShellBrowserMainDelegate: 34 // apps::ShellBrowserMainDelegate:
33 virtual void Start(content::BrowserContext* context) OVERRIDE { 35 virtual void Start(content::BrowserContext* context) OVERRIDE {
34 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 36 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
35 if (command_line->HasSwitch(kAppSwitch)) { 37 if (command_line->HasSwitch(kAppSwitch)) {
36 base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch)); 38 base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch));
37 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir); 39 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir);
38 extensions::ShellExtensionSystem* extension_system = 40 extensions::ShellExtensionSystem* extension_system =
39 static_cast<extensions::ShellExtensionSystem*>( 41 static_cast<extensions::ShellExtensionSystem*>(
40 extensions::ExtensionSystem::Get(context)); 42 extensions::ExtensionSystem::Get(context));
41 extension_system->LoadApp(app_absolute_dir); 43 extension_system->LoadApp(app_absolute_dir);
42 } 44 }
43 45
44 athena::StartAthena( 46 aura::Window* root =
45 apps::ShellDesktopController::instance()->host()->window(), 47 apps::ShellDesktopController::instance()->host()->window();
46 new athena::ContentActivityFactory(), 48 athena::StartAthena(root,
47 new athena::ContentAppModelBuilder(context)); 49 new athena::ContentActivityFactory(),
50 new athena::ContentAppModelBuilder(context));
48 athena::HomeCard::Get()->RegisterSearchProvider( 51 athena::HomeCard::Get()->RegisterSearchProvider(
49 new athena::UrlSearchProvider(context)); 52 new athena::UrlSearchProvider(context));
53 athena::VirtualKeyboardManager::Create(root, context);
54
50 CreateTestPages(context); 55 CreateTestPages(context);
51 } 56 }
52 57
53 virtual void Shutdown() OVERRIDE { athena::ShutdownAthena(); } 58 virtual void Shutdown() OVERRIDE { athena::ShutdownAthena(); }
54 59
55 virtual apps::ShellDesktopController* CreateDesktopController() OVERRIDE { 60 virtual apps::ShellDesktopController* CreateDesktopController() OVERRIDE {
56 // TODO(mukai): create Athena's own ShellDesktopController subclass so that 61 // TODO(mukai): create Athena's own ShellDesktopController subclass so that
57 // it can initialize its own window manager logic. 62 // it can initialize its own window manager logic.
58 apps::ShellDesktopController* desktop = new apps::ShellDesktopController(); 63 apps::ShellDesktopController* desktop = new apps::ShellDesktopController();
59 desktop->SetAppWindowController(new athena::AthenaAppWindowController()); 64 desktop->SetAppWindowController(new athena::AthenaAppWindowController());
60 return desktop; 65 return desktop;
61 } 66 }
62 67
63 private: 68 private:
64 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); 69 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate);
65 }; 70 };
66 71
67 class AthenaRendererMainDelegate : public apps::ShellRendererMainDelegate { 72 class AthenaRendererMainDelegate : public apps::ShellRendererMainDelegate {
68 public: 73 public:
69 AthenaRendererMainDelegate() {} 74 AthenaRendererMainDelegate() {}
70 virtual ~AthenaRendererMainDelegate() {} 75 virtual ~AthenaRendererMainDelegate() {}
71 76
72 private: 77 private:
73 // apps::ShellRendererMainDelegate: 78 // apps::ShellRendererMainDelegate:
74 virtual void OnThreadStarted(content::RenderThread* thread) OVERRIDE {} 79 virtual void OnThreadStarted(content::RenderThread* thread) OVERRIDE {}
75 80
76 virtual void OnViewCreated(content::RenderView* render_view) OVERRIDE {} 81 virtual void OnViewCreated(content::RenderView* render_view) OVERRIDE {
82 athena::VirtualKeyboardBindings::Create(render_view);
83 }
77 84
78 DISALLOW_COPY_AND_ASSIGN(AthenaRendererMainDelegate); 85 DISALLOW_COPY_AND_ASSIGN(AthenaRendererMainDelegate);
79 }; 86 };
80 87
81 class AthenaMainDelegate : public apps::ShellMainDelegate { 88 class AthenaMainDelegate : public apps::ShellMainDelegate {
82 public: 89 public:
83 AthenaMainDelegate() {} 90 AthenaMainDelegate() {}
84 virtual ~AthenaMainDelegate() {} 91 virtual ~AthenaMainDelegate() {}
85 92
86 private: 93 private:
(...skipping 14 matching lines...) Expand all
101 108
102 int main(int argc, const char** argv) { 109 int main(int argc, const char** argv) {
103 AthenaMainDelegate delegate; 110 AthenaMainDelegate delegate;
104 content::ContentMainParams params(&delegate); 111 content::ContentMainParams params(&delegate);
105 112
106 params.argc = argc; 113 params.argc = argc;
107 params.argv = argv; 114 params.argv = argv;
108 115
109 return content::ContentMain(params); 116 return content::ContentMain(params);
110 } 117 }
OLDNEW
« athena/athena.gyp ('K') | « athena/main/DEPS ('k') | athena/main/athena_main.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698