| 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 "athena/activity/public/activity_factory.h" | 5 #include "athena/activity/public/activity_factory.h" |
| 6 #include "athena/activity/public/activity_manager.h" | 6 #include "athena/activity/public/activity_manager.h" |
| 7 #include "athena/content/public/web_contents_view_delegate_creator.h" | 7 #include "athena/content/public/web_contents_view_delegate_creator.h" |
| 8 #include "athena/env/public/athena_env.h" | 8 #include "athena/env/public/athena_env.h" |
| 9 #include "athena/extensions/public/extensions_delegate.h" | 9 #include "athena/extensions/public/extensions_delegate.h" |
| 10 #include "athena/main/athena_content_client.h" | 10 #include "athena/main/athena_content_client.h" |
| 11 #include "athena/main/athena_renderer_pdf_helper.h" | 11 #include "athena/main/athena_renderer_pdf_helper.h" |
| 12 #include "athena/main/public/athena_launcher.h" | 12 #include "athena/main/public/athena_launcher.h" |
| 13 #include "athena/screen/public/screen_manager.h" | 13 #include "athena/screen/public/screen_manager.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "components/pdf/renderer/ppb_pdf_impl.h" | 17 #include "components/pdf/renderer/ppb_pdf_impl.h" |
| 18 #include "content/public/app/content_main.h" | 18 #include "content/public/app/content_main.h" |
| 19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 #include "extensions/browser/app_window/app_window.h" |
| 21 #include "extensions/browser/app_window/apps_client.h" |
| 20 #include "extensions/shell/app/shell_main_delegate.h" | 22 #include "extensions/shell/app/shell_main_delegate.h" |
| 21 #include "extensions/shell/browser/desktop_controller.h" | 23 #include "extensions/shell/browser/desktop_controller.h" |
| 24 #include "extensions/shell/browser/shell_app_delegate.h" |
| 22 #include "extensions/shell/browser/shell_app_window.h" | 25 #include "extensions/shell/browser/shell_app_window.h" |
| 23 #include "extensions/shell/browser/shell_browser_main_delegate.h" | 26 #include "extensions/shell/browser/shell_browser_main_delegate.h" |
| 24 #include "extensions/shell/browser/shell_content_browser_client.h" | 27 #include "extensions/shell/browser/shell_content_browser_client.h" |
| 25 #include "extensions/shell/browser/shell_extension_system.h" | 28 #include "extensions/shell/browser/shell_extension_system.h" |
| 29 #include "extensions/shell/browser/shell_native_app_window.h" |
| 26 #include "extensions/shell/common/shell_content_client.h" | 30 #include "extensions/shell/common/shell_content_client.h" |
| 27 #include "extensions/shell/common/switches.h" | 31 #include "extensions/shell/common/switches.h" |
| 28 #include "extensions/shell/renderer/shell_content_renderer_client.h" | 32 #include "extensions/shell/renderer/shell_content_renderer_client.h" |
| 29 #include "ppapi/c/private/ppb_pdf.h" | 33 #include "ppapi/c/private/ppb_pdf.h" |
| 30 #include "ui/aura/window_tree_host.h" | 34 #include "ui/aura/window_tree_host.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "ui/wm/core/visibility_controller.h" | 36 #include "ui/wm/core/visibility_controller.h" |
| 33 | 37 |
| 34 namespace { | 38 namespace { |
| 35 | 39 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 virtual void AddAppWindow(aura::Window* window) OVERRIDE { | 81 virtual void AddAppWindow(aura::Window* window) OVERRIDE { |
| 78 NOTIMPLEMENTED(); | 82 NOTIMPLEMENTED(); |
| 79 } | 83 } |
| 80 | 84 |
| 81 // Closes and destroys the app windows. | 85 // Closes and destroys the app windows. |
| 82 virtual void CloseAppWindows() OVERRIDE {} | 86 virtual void CloseAppWindows() OVERRIDE {} |
| 83 | 87 |
| 84 DISALLOW_COPY_AND_ASSIGN(AthenaDesktopController); | 88 DISALLOW_COPY_AND_ASSIGN(AthenaDesktopController); |
| 85 }; | 89 }; |
| 86 | 90 |
| 91 class AthenaAppsClient : public extensions::AppsClient { |
| 92 public: |
| 93 AthenaAppsClient() {} |
| 94 virtual ~AthenaAppsClient() {} |
| 95 |
| 96 // extensions::AppsClient: |
| 97 virtual std::vector<content::BrowserContext*> |
| 98 GetLoadedBrowserContexts() OVERRIDE { |
| 99 NOTIMPLEMENTED(); |
| 100 return std::vector<content::BrowserContext*>(); |
| 101 } |
| 102 |
| 103 virtual extensions::AppWindow* CreateAppWindow( |
| 104 content::BrowserContext* context, |
| 105 const extensions::Extension* extension) OVERRIDE { |
| 106 return new extensions::AppWindow( |
| 107 context, new extensions::ShellAppDelegate, extension); |
| 108 } |
| 109 |
| 110 virtual extensions::NativeAppWindow* CreateNativeAppWindow( |
| 111 extensions::AppWindow* window, |
| 112 const extensions::AppWindow::CreateParams& params) OVERRIDE { |
| 113 athena::ActivityManager::Get()->AddActivity( |
| 114 athena::ActivityFactory::Get()->CreateAppActivity(window, NULL)); |
| 115 return new extensions::ShellNativeAppWindow(window, params); |
| 116 } |
| 117 |
| 118 virtual void IncrementKeepAliveCount() OVERRIDE {} |
| 119 |
| 120 virtual void DecrementKeepAliveCount() OVERRIDE {} |
| 121 |
| 122 virtual void OpenDevToolsWindow(content::WebContents* web_contents, |
| 123 const base::Closure& callback) OVERRIDE { |
| 124 NOTIMPLEMENTED(); |
| 125 } |
| 126 |
| 127 virtual bool IsCurrentChannelOlderThanDev() OVERRIDE { |
| 128 return false; |
| 129 } |
| 130 |
| 131 private: |
| 132 DISALLOW_COPY_AND_ASSIGN(AthenaAppsClient); |
| 133 }; |
| 134 |
| 87 class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate { | 135 class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate { |
| 88 public: | 136 public: |
| 89 AthenaBrowserMainDelegate() {} | 137 AthenaBrowserMainDelegate() {} |
| 90 virtual ~AthenaBrowserMainDelegate() {} | 138 virtual ~AthenaBrowserMainDelegate() {} |
| 91 | 139 |
| 92 // extensions::ShellBrowserMainDelegate: | 140 // extensions::ShellBrowserMainDelegate: |
| 93 virtual void Start(content::BrowserContext* context) OVERRIDE { | 141 virtual void Start(content::BrowserContext* context) OVERRIDE { |
| 94 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 142 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 95 | 143 |
| 96 base::FilePath app_dir = base::FilePath::FromUTF8Unsafe( | 144 base::FilePath app_dir = base::FilePath::FromUTF8Unsafe( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 115 | 163 |
| 116 virtual void Shutdown() OVERRIDE { | 164 virtual void Shutdown() OVERRIDE { |
| 117 athena::AthenaEnv::Get()->OnTerminating(); | 165 athena::AthenaEnv::Get()->OnTerminating(); |
| 118 athena::ShutdownAthena(); | 166 athena::ShutdownAthena(); |
| 119 } | 167 } |
| 120 | 168 |
| 121 virtual extensions::DesktopController* CreateDesktopController() OVERRIDE { | 169 virtual extensions::DesktopController* CreateDesktopController() OVERRIDE { |
| 122 return new AthenaDesktopController(); | 170 return new AthenaDesktopController(); |
| 123 } | 171 } |
| 124 | 172 |
| 173 virtual extensions::AppsClient* CreateAppsClient() OVERRIDE { |
| 174 return new AthenaAppsClient(); |
| 175 } |
| 176 |
| 125 private: | 177 private: |
| 126 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); | 178 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); |
| 127 }; | 179 }; |
| 128 | 180 |
| 129 class AthenaContentBrowserClient | 181 class AthenaContentBrowserClient |
| 130 : public extensions::ShellContentBrowserClient { | 182 : public extensions::ShellContentBrowserClient { |
| 131 public: | 183 public: |
| 132 AthenaContentBrowserClient() | 184 AthenaContentBrowserClient() |
| 133 : extensions::ShellContentBrowserClient(new AthenaBrowserMainDelegate()) { | 185 : extensions::ShellContentBrowserClient(new AthenaBrowserMainDelegate()) { |
| 134 } | 186 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 250 |
| 199 int main(int argc, const char** argv) { | 251 int main(int argc, const char** argv) { |
| 200 AthenaMainDelegate delegate; | 252 AthenaMainDelegate delegate; |
| 201 content::ContentMainParams params(&delegate); | 253 content::ContentMainParams params(&delegate); |
| 202 | 254 |
| 203 params.argc = argc; | 255 params.argc = argc; |
| 204 params.argv = argv; | 256 params.argv = argv; |
| 205 | 257 |
| 206 return content::ContentMain(params); | 258 return content::ContentMain(params); |
| 207 } | 259 } |
| OLD | NEW |