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/main/athena_main_delegate.h" | 5 #include "athena/main/athena_main_delegate.h" |
6 | 6 |
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/main/athena_content_client.h" | 9 #include "athena/main/athena_content_client.h" |
10 #include "athena/main/athena_renderer_pdf_helper.h" | 10 #include "athena/main/athena_renderer_pdf_helper.h" |
11 #include "athena/main/public/athena_launcher.h" | 11 #include "athena/main/public/athena_launcher.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "components/pdf/renderer/ppb_pdf_impl.h" | 15 #include "components/pdf/renderer/ppb_pdf_impl.h" |
16 #include "content/public/app/content_main.h" | 16 #include "content/public/app/content_main.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "extensions/common/switches.h" | 18 #include "extensions/common/switches.h" |
19 #include "extensions/shell/browser/desktop_controller.h" | 19 #include "extensions/shell/browser/desktop_controller.h" |
20 #include "extensions/shell/browser/shell_browser_main_delegate.h" | 20 #include "extensions/shell/browser/shell_browser_main_delegate.h" |
21 #include "extensions/shell/browser/shell_content_browser_client.h" | 21 #include "extensions/shell/browser/shell_content_browser_client.h" |
22 #include "extensions/shell/browser/shell_extension_system.h" | 22 #include "extensions/shell/browser/shell_extension_system.h" |
23 #include "extensions/shell/common/shell_content_client.h" | 23 #include "extensions/shell/common/shell_content_client.h" |
24 #include "extensions/shell/common/switches.h" | 24 #include "extensions/shell/common/switches.h" |
25 #include "extensions/shell/renderer/shell_content_renderer_client.h" | 25 #include "extensions/shell/renderer/shell_content_renderer_client.h" |
26 #include "ppapi/c/private/ppb_pdf.h" | 26 #include "ppapi/c/private/ppb_pdf.h" |
| 27 #include "ui/aura/window.h" |
| 28 #include "ui/aura/window_tree_host.h" |
27 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/gfx/geometry/size.h" |
28 | 31 |
29 namespace athena { | 32 namespace athena { |
30 namespace { | 33 namespace { |
31 | 34 |
32 // We want to load the sample calculator app by default, for a while. Expecting | 35 // We want to load the sample calculator app by default, for a while. Expecting |
33 // to run athena_main at src/ | 36 // to run athena_main at src/ |
34 const char kDefaultAppPath[] = | 37 const char kDefaultAppPath[] = |
35 "chrome/common/extensions/docs/examples/apps/calculator/app"; | 38 "chrome/common/extensions/docs/examples/apps/calculator/app"; |
36 | 39 |
37 class AthenaDesktopController : public extensions::DesktopController { | 40 class AthenaDesktopController : public extensions::DesktopController { |
38 public: | 41 public: |
39 AthenaDesktopController() {} | 42 AthenaDesktopController() {} |
40 ~AthenaDesktopController() override {} | 43 ~AthenaDesktopController() override {} |
41 | 44 |
42 private: | 45 private: |
43 // extensions::DesktopController: | 46 // extensions::DesktopController: |
44 virtual aura::WindowTreeHost* GetHost() override { | 47 virtual gfx::Size GetWindowSize() override { |
45 return athena::AthenaEnv::Get()->GetHost(); | 48 return athena::AthenaEnv::Get()->GetHost()->window()->bounds().size(); |
46 } | 49 } |
47 | 50 |
48 // Creates a new app window and adds it to the desktop. The desktop maintains | 51 // Creates a new app window and adds it to the desktop. The desktop maintains |
49 // ownership of the window. | 52 // ownership of the window. |
50 // TODO(jamescook|oshima): Is this function needed? | 53 // TODO(jamescook|oshima): Is this function needed? |
51 virtual extensions::AppWindow* CreateAppWindow( | 54 virtual extensions::AppWindow* CreateAppWindow( |
52 content::BrowserContext* context, | 55 content::BrowserContext* context, |
53 const extensions::Extension* extension) override { | 56 const extensions::Extension* extension) override { |
54 NOTIMPLEMENTED(); | 57 NOTIMPLEMENTED(); |
55 return nullptr; | 58 return nullptr; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 170 |
168 void AthenaMainDelegate::InitializeResourceBundle() { | 171 void AthenaMainDelegate::InitializeResourceBundle() { |
169 base::FilePath pak_dir; | 172 base::FilePath pak_dir; |
170 PathService::Get(base::DIR_MODULE, &pak_dir); | 173 PathService::Get(base::DIR_MODULE, &pak_dir); |
171 base::FilePath pak_file = | 174 base::FilePath pak_file = |
172 pak_dir.Append(FILE_PATH_LITERAL("athena_resources.pak")); | 175 pak_dir.Append(FILE_PATH_LITERAL("athena_resources.pak")); |
173 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); | 176 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); |
174 } | 177 } |
175 | 178 |
176 } // namespace athena | 179 } // namespace athena |
OLD | NEW |