| 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 13 matching lines...) Expand all Loading... |
| 73 | 73 |
| 74 // Closes and destroys the app windows. | 74 // Closes and destroys the app windows. |
| 75 virtual void CloseAppWindows() override {} | 75 virtual void CloseAppWindows() override {} |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(AthenaDesktopController); | 77 DISALLOW_COPY_AND_ASSIGN(AthenaDesktopController); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate { | 80 class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate { |
| 81 public: | 81 public: |
| 82 AthenaBrowserMainDelegate() {} | 82 AthenaBrowserMainDelegate() {} |
| 83 virtual ~AthenaBrowserMainDelegate() {} | 83 ~AthenaBrowserMainDelegate() override {} |
| 84 | 84 |
| 85 // extensions::ShellBrowserMainDelegate: | 85 // extensions::ShellBrowserMainDelegate: |
| 86 virtual void Start(content::BrowserContext* context) override { | 86 virtual void Start(content::BrowserContext* context) override { |
| 87 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 87 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 88 | 88 |
| 89 base::FilePath app_dir = base::FilePath::FromUTF8Unsafe( | 89 base::FilePath app_dir = base::FilePath::FromUTF8Unsafe( |
| 90 command_line->HasSwitch(extensions::switches::kAppShellAppPath) | 90 command_line->HasSwitch(extensions::switches::kAppShellAppPath) |
| 91 ? command_line->GetSwitchValueNative( | 91 ? command_line->GetSwitchValueNative( |
| 92 extensions::switches::kAppShellAppPath) | 92 extensions::switches::kAppShellAppPath) |
| 93 : kDefaultAppPath); | 93 : kDefaultAppPath); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 119 private: | 119 private: |
| 120 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); | 120 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 class AthenaContentBrowserClient | 123 class AthenaContentBrowserClient |
| 124 : public extensions::ShellContentBrowserClient { | 124 : public extensions::ShellContentBrowserClient { |
| 125 public: | 125 public: |
| 126 AthenaContentBrowserClient() | 126 AthenaContentBrowserClient() |
| 127 : extensions::ShellContentBrowserClient(new AthenaBrowserMainDelegate()) { | 127 : extensions::ShellContentBrowserClient(new AthenaBrowserMainDelegate()) { |
| 128 } | 128 } |
| 129 virtual ~AthenaContentBrowserClient() {} | 129 ~AthenaContentBrowserClient() override {} |
| 130 | 130 |
| 131 // content::ContentBrowserClient: | 131 // content::ContentBrowserClient: |
| 132 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( | 132 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( |
| 133 content::WebContents* web_contents) override { | 133 content::WebContents* web_contents) override { |
| 134 return athena::CreateWebContentsViewDelegate(web_contents); | 134 return athena::CreateWebContentsViewDelegate(web_contents); |
| 135 } | 135 } |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 DISALLOW_COPY_AND_ASSIGN(AthenaContentBrowserClient); | 138 DISALLOW_COPY_AND_ASSIGN(AthenaContentBrowserClient); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 class AthenaContentRendererClient | 141 class AthenaContentRendererClient |
| 142 : public extensions::ShellContentRendererClient { | 142 : public extensions::ShellContentRendererClient { |
| 143 public: | 143 public: |
| 144 AthenaContentRendererClient() {} | 144 AthenaContentRendererClient() {} |
| 145 virtual ~AthenaContentRendererClient() {} | 145 ~AthenaContentRendererClient() override {} |
| 146 | 146 |
| 147 // content::ContentRendererClient: | 147 // content::ContentRendererClient: |
| 148 virtual void RenderFrameCreated(content::RenderFrame* render_frame) override { | 148 virtual void RenderFrameCreated(content::RenderFrame* render_frame) override { |
| 149 new athena::AthenaRendererPDFHelper(render_frame); | 149 new athena::AthenaRendererPDFHelper(render_frame); |
| 150 extensions::ShellContentRendererClient::RenderFrameCreated(render_frame); | 150 extensions::ShellContentRendererClient::RenderFrameCreated(render_frame); |
| 151 } | 151 } |
| 152 | 152 |
| 153 virtual const void* CreatePPAPIInterface( | 153 virtual const void* CreatePPAPIInterface( |
| 154 const std::string& interface_name) override { | 154 const std::string& interface_name) override { |
| 155 if (interface_name == PPB_PDF_INTERFACE) | 155 if (interface_name == PPB_PDF_INTERFACE) |
| 156 return pdf::PPB_PDF_Impl::GetInterface(); | 156 return pdf::PPB_PDF_Impl::GetInterface(); |
| 157 return extensions::ShellContentRendererClient::CreatePPAPIInterface( | 157 return extensions::ShellContentRendererClient::CreatePPAPIInterface( |
| 158 interface_name); | 158 interface_name); |
| 159 } | 159 } |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 class AthenaMainDelegate : public extensions::ShellMainDelegate { | 162 class AthenaMainDelegate : public extensions::ShellMainDelegate { |
| 163 public: | 163 public: |
| 164 AthenaMainDelegate() {} | 164 AthenaMainDelegate() {} |
| 165 virtual ~AthenaMainDelegate() {} | 165 ~AthenaMainDelegate() override {} |
| 166 | 166 |
| 167 private: | 167 private: |
| 168 // extensions::ShellMainDelegate: | 168 // extensions::ShellMainDelegate: |
| 169 virtual content::ContentClient* CreateContentClient() override { | 169 virtual content::ContentClient* CreateContentClient() override { |
| 170 return new athena::AthenaContentClient(); | 170 return new athena::AthenaContentClient(); |
| 171 } | 171 } |
| 172 virtual content::ContentBrowserClient* CreateShellContentBrowserClient() | 172 virtual content::ContentBrowserClient* CreateShellContentBrowserClient() |
| 173 override { | 173 override { |
| 174 return new AthenaContentBrowserClient(); | 174 return new AthenaContentBrowserClient(); |
| 175 } | 175 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 192 | 192 |
| 193 int main(int argc, const char** argv) { | 193 int main(int argc, const char** argv) { |
| 194 AthenaMainDelegate delegate; | 194 AthenaMainDelegate delegate; |
| 195 content::ContentMainParams params(&delegate); | 195 content::ContentMainParams params(&delegate); |
| 196 | 196 |
| 197 params.argc = argc; | 197 params.argc = argc; |
| 198 params.argv = argv; | 198 params.argv = argv; |
| 199 | 199 |
| 200 return content::ContentMain(params); | 200 return content::ContentMain(params); |
| 201 } | 201 } |
| OLD | NEW |