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 "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_content_browser_client.h" |
7 #include "apps/shell/browser/shell_desktop_controller.h" | 8 #include "apps/shell/browser/shell_desktop_controller.h" |
8 #include "apps/shell/browser/shell_extension_system.h" | 9 #include "apps/shell/browser/shell_extension_system.h" |
9 #include "apps/shell/common/switches.h" | 10 #include "apps/shell/common/switches.h" |
10 #include "apps/shell/renderer/shell_renderer_main_delegate.h" | 11 #include "apps/shell/renderer/shell_renderer_main_delegate.h" |
11 #include "athena/content/public/content_activity_factory.h" | 12 #include "athena/content/public/content_activity_factory.h" |
12 #include "athena/content/public/content_app_model_builder.h" | 13 #include "athena/content/public/content_app_model_builder.h" |
13 #include "athena/home/public/home_card.h" | 14 #include "athena/home/public/home_card.h" |
14 #include "athena/main/athena_app_window_controller.h" | 15 #include "athena/main/athena_app_window_controller.h" |
15 #include "athena/main/athena_launcher.h" | 16 #include "athena/main/athena_launcher.h" |
16 #include "athena/main/debug/debug_window.h" | 17 #include "athena/main/debug/debug_window.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 desktop->SetAppWindowController(new athena::AthenaAppWindowController()); | 104 desktop->SetAppWindowController(new athena::AthenaAppWindowController()); |
104 return desktop; | 105 return desktop; |
105 } | 106 } |
106 | 107 |
107 private: | 108 private: |
108 scoped_ptr<VirtualKeyboardObserver> keyboard_observer_; | 109 scoped_ptr<VirtualKeyboardObserver> keyboard_observer_; |
109 | 110 |
110 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); | 111 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); |
111 }; | 112 }; |
112 | 113 |
| 114 class AthenaContentBrowserClient : public apps::ShellContentBrowserClient { |
| 115 public: |
| 116 AthenaContentBrowserClient() |
| 117 : apps::ShellContentBrowserClient(new AthenaBrowserMainDelegate()) {} |
| 118 virtual ~AthenaContentBrowserClient() {} |
| 119 |
| 120 // content::ContentBrowserClient: |
| 121 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( |
| 122 content::WebContents* web_contents) OVERRIDE { |
| 123 // TODO(oshima): Implement athena's WebContentsViewDelegate. |
| 124 return NULL; |
| 125 } |
| 126 |
| 127 private: |
| 128 DISALLOW_COPY_AND_ASSIGN(AthenaContentBrowserClient); |
| 129 }; |
| 130 |
113 class AthenaRendererMainDelegate : public apps::ShellRendererMainDelegate { | 131 class AthenaRendererMainDelegate : public apps::ShellRendererMainDelegate { |
114 public: | 132 public: |
115 AthenaRendererMainDelegate() {} | 133 AthenaRendererMainDelegate() {} |
116 virtual ~AthenaRendererMainDelegate() {} | 134 virtual ~AthenaRendererMainDelegate() {} |
117 | 135 |
118 private: | 136 private: |
119 // apps::ShellRendererMainDelegate: | 137 // apps::ShellRendererMainDelegate: |
120 virtual void OnThreadStarted(content::RenderThread* thread) OVERRIDE {} | 138 virtual void OnThreadStarted(content::RenderThread* thread) OVERRIDE {} |
121 | 139 |
122 virtual void OnViewCreated(content::RenderView* render_view) OVERRIDE { | 140 virtual void OnViewCreated(content::RenderView* render_view) OVERRIDE { |
123 athena::VirtualKeyboardBindings::Create(render_view); | 141 athena::VirtualKeyboardBindings::Create(render_view); |
124 } | 142 } |
125 | 143 |
126 DISALLOW_COPY_AND_ASSIGN(AthenaRendererMainDelegate); | 144 DISALLOW_COPY_AND_ASSIGN(AthenaRendererMainDelegate); |
127 }; | 145 }; |
128 | 146 |
129 class AthenaMainDelegate : public apps::ShellMainDelegate { | 147 class AthenaMainDelegate : public apps::ShellMainDelegate { |
130 public: | 148 public: |
131 AthenaMainDelegate() {} | 149 AthenaMainDelegate() {} |
132 virtual ~AthenaMainDelegate() {} | 150 virtual ~AthenaMainDelegate() {} |
133 | 151 |
134 private: | 152 private: |
135 // apps::ShellMainDelegate: | 153 // apps::ShellMainDelegate: |
136 virtual apps::ShellBrowserMainDelegate* CreateShellBrowserMainDelegate() | 154 virtual content::ContentBrowserClient* CreateShellContentBrowserClient() |
137 OVERRIDE { | 155 OVERRIDE { |
138 return new AthenaBrowserMainDelegate(); | 156 return new AthenaContentBrowserClient(); |
139 } | 157 } |
140 | 158 |
141 virtual scoped_ptr<apps::ShellRendererMainDelegate> | 159 virtual scoped_ptr<apps::ShellRendererMainDelegate> |
142 CreateShellRendererMainDelegate() OVERRIDE { | 160 CreateShellRendererMainDelegate() OVERRIDE { |
143 return scoped_ptr<apps::ShellRendererMainDelegate>( | 161 return scoped_ptr<apps::ShellRendererMainDelegate>( |
144 new AthenaRendererMainDelegate()); | 162 new AthenaRendererMainDelegate()); |
145 } | 163 } |
146 | 164 |
147 virtual void InitializeResourceBundle() OVERRIDE { | 165 virtual void InitializeResourceBundle() OVERRIDE { |
148 base::FilePath pak_dir; | 166 base::FilePath pak_dir; |
149 PathService::Get(base::DIR_MODULE, &pak_dir); | 167 PathService::Get(base::DIR_MODULE, &pak_dir); |
150 base::FilePath pak_file = | 168 base::FilePath pak_file = |
151 pak_dir.Append(FILE_PATH_LITERAL("athena_resources.pak")); | 169 pak_dir.Append(FILE_PATH_LITERAL("athena_resources.pak")); |
152 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); | 170 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); |
153 } | 171 } |
154 | 172 |
155 DISALLOW_COPY_AND_ASSIGN(AthenaMainDelegate); | 173 DISALLOW_COPY_AND_ASSIGN(AthenaMainDelegate); |
156 }; | 174 }; |
157 | 175 |
158 int main(int argc, const char** argv) { | 176 int main(int argc, const char** argv) { |
159 AthenaMainDelegate delegate; | 177 AthenaMainDelegate delegate; |
160 content::ContentMainParams params(&delegate); | 178 content::ContentMainParams params(&delegate); |
161 | 179 |
162 params.argc = argc; | 180 params.argc = argc; |
163 params.argv = argv; | 181 params.argv = argv; |
164 | 182 |
165 return content::ContentMain(params); | 183 return content::ContentMain(params); |
166 } | 184 } |
OLD | NEW |