| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // We want to load the sample calculator app by default, for a while. Expecting | 39 // We want to load the sample calculator app by default, for a while. Expecting |
| 40 // to run athena_main at src/ | 40 // to run athena_main at src/ |
| 41 const char kDefaultAppPath[] = | 41 const char kDefaultAppPath[] = |
| 42 "chrome/common/extensions/docs/examples/apps/calculator/app"; | 42 "chrome/common/extensions/docs/examples/apps/calculator/app"; |
| 43 | 43 |
| 44 } // namespace | 44 } // namespace |
| 45 | 45 |
| 46 class AthenaDesktopController : public extensions::DesktopController { | 46 class AthenaDesktopController : public extensions::DesktopController { |
| 47 public: | 47 public: |
| 48 AthenaDesktopController() {} | 48 AthenaDesktopController() {} |
| 49 virtual ~AthenaDesktopController() {} | 49 ~AthenaDesktopController() override {} |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 // extensions::DesktopController: | 52 // extensions::DesktopController: |
| 53 virtual aura::WindowTreeHost* GetHost() override { | 53 virtual aura::WindowTreeHost* GetHost() override { |
| 54 return athena::AthenaEnv::Get()->GetHost(); | 54 return athena::AthenaEnv::Get()->GetHost(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Creates a new app window and adds it to the desktop. The desktop maintains | 57 // Creates a new app window and adds it to the desktop. The desktop maintains |
| 58 // ownership of the window. | 58 // ownership of the window. |
| 59 // TODO(jamescook|oshima): Is this function needed? | 59 // TODO(jamescook|oshima): Is this function needed? |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 | 71 |
| 72 // Closes and destroys the app windows. | 72 // Closes and destroys the app windows. |
| 73 virtual void CloseAppWindows() override {} | 73 virtual void CloseAppWindows() override {} |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(AthenaDesktopController); | 75 DISALLOW_COPY_AND_ASSIGN(AthenaDesktopController); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate { | 78 class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate { |
| 79 public: | 79 public: |
| 80 AthenaBrowserMainDelegate() {} | 80 AthenaBrowserMainDelegate() {} |
| 81 virtual ~AthenaBrowserMainDelegate() {} | 81 ~AthenaBrowserMainDelegate() override {} |
| 82 | 82 |
| 83 // extensions::ShellBrowserMainDelegate: | 83 // extensions::ShellBrowserMainDelegate: |
| 84 virtual void Start(content::BrowserContext* context) override { | 84 virtual void Start(content::BrowserContext* context) override { |
| 85 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 85 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 86 | 86 |
| 87 base::FilePath app_dir = base::FilePath::FromUTF8Unsafe( | 87 base::FilePath app_dir = base::FilePath::FromUTF8Unsafe( |
| 88 command_line->HasSwitch(extensions::switches::kAppShellAppPath) | 88 command_line->HasSwitch(extensions::switches::kAppShellAppPath) |
| 89 ? command_line->GetSwitchValueNative( | 89 ? command_line->GetSwitchValueNative( |
| 90 extensions::switches::kAppShellAppPath) | 90 extensions::switches::kAppShellAppPath) |
| 91 : kDefaultAppPath); | 91 : kDefaultAppPath); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 117 private: | 117 private: |
| 118 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); | 118 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 class AthenaContentBrowserClient | 121 class AthenaContentBrowserClient |
| 122 : public extensions::ShellContentBrowserClient { | 122 : public extensions::ShellContentBrowserClient { |
| 123 public: | 123 public: |
| 124 AthenaContentBrowserClient() | 124 AthenaContentBrowserClient() |
| 125 : extensions::ShellContentBrowserClient(new AthenaBrowserMainDelegate()) { | 125 : extensions::ShellContentBrowserClient(new AthenaBrowserMainDelegate()) { |
| 126 } | 126 } |
| 127 virtual ~AthenaContentBrowserClient() {} | 127 ~AthenaContentBrowserClient() override {} |
| 128 | 128 |
| 129 // content::ContentBrowserClient: | 129 // content::ContentBrowserClient: |
| 130 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( | 130 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( |
| 131 content::WebContents* web_contents) override { | 131 content::WebContents* web_contents) override { |
| 132 return athena::CreateWebContentsViewDelegate(web_contents); | 132 return athena::CreateWebContentsViewDelegate(web_contents); |
| 133 } | 133 } |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 DISALLOW_COPY_AND_ASSIGN(AthenaContentBrowserClient); | 136 DISALLOW_COPY_AND_ASSIGN(AthenaContentBrowserClient); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 class AthenaContentRendererClient | 139 class AthenaContentRendererClient |
| 140 : public extensions::ShellContentRendererClient { | 140 : public extensions::ShellContentRendererClient { |
| 141 public: | 141 public: |
| 142 AthenaContentRendererClient() {} | 142 AthenaContentRendererClient() {} |
| 143 virtual ~AthenaContentRendererClient() {} | 143 ~AthenaContentRendererClient() override {} |
| 144 | 144 |
| 145 // content::ContentRendererClient: | 145 // content::ContentRendererClient: |
| 146 virtual void RenderFrameCreated(content::RenderFrame* render_frame) override { | 146 virtual void RenderFrameCreated(content::RenderFrame* render_frame) override { |
| 147 new athena::AthenaRendererPDFHelper(render_frame); | 147 new athena::AthenaRendererPDFHelper(render_frame); |
| 148 extensions::ShellContentRendererClient::RenderFrameCreated(render_frame); | 148 extensions::ShellContentRendererClient::RenderFrameCreated(render_frame); |
| 149 } | 149 } |
| 150 | 150 |
| 151 virtual const void* CreatePPAPIInterface( | 151 virtual const void* CreatePPAPIInterface( |
| 152 const std::string& interface_name) override { | 152 const std::string& interface_name) override { |
| 153 if (interface_name == PPB_PDF_INTERFACE) | 153 if (interface_name == PPB_PDF_INTERFACE) |
| 154 return pdf::PPB_PDF_Impl::GetInterface(); | 154 return pdf::PPB_PDF_Impl::GetInterface(); |
| 155 return extensions::ShellContentRendererClient::CreatePPAPIInterface( | 155 return extensions::ShellContentRendererClient::CreatePPAPIInterface( |
| 156 interface_name); | 156 interface_name); |
| 157 } | 157 } |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 class AthenaMainDelegate : public extensions::ShellMainDelegate { | 160 class AthenaMainDelegate : public extensions::ShellMainDelegate { |
| 161 public: | 161 public: |
| 162 AthenaMainDelegate() {} | 162 AthenaMainDelegate() {} |
| 163 virtual ~AthenaMainDelegate() {} | 163 ~AthenaMainDelegate() override {} |
| 164 | 164 |
| 165 private: | 165 private: |
| 166 // extensions::ShellMainDelegate: | 166 // extensions::ShellMainDelegate: |
| 167 virtual content::ContentClient* CreateContentClient() override { | 167 virtual content::ContentClient* CreateContentClient() override { |
| 168 return new athena::AthenaContentClient(); | 168 return new athena::AthenaContentClient(); |
| 169 } | 169 } |
| 170 virtual content::ContentBrowserClient* CreateShellContentBrowserClient() | 170 virtual content::ContentBrowserClient* CreateShellContentBrowserClient() |
| 171 override { | 171 override { |
| 172 return new AthenaContentBrowserClient(); | 172 return new AthenaContentBrowserClient(); |
| 173 } | 173 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 190 | 190 |
| 191 int main(int argc, const char** argv) { | 191 int main(int argc, const char** argv) { |
| 192 AthenaMainDelegate delegate; | 192 AthenaMainDelegate delegate; |
| 193 content::ContentMainParams params(&delegate); | 193 content::ContentMainParams params(&delegate); |
| 194 | 194 |
| 195 params.argc = argc; | 195 params.argc = argc; |
| 196 params.argv = argv; | 196 params.argv = argv; |
| 197 | 197 |
| 198 return content::ContentMain(params); | 198 return content::ContentMain(params); |
| 199 } | 199 } |
| OLD | NEW |