| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_HTML_VIEWER_SETUP_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_SETUP_H_ |
| 6 #define COMPONENTS_HTML_VIEWER_SETUP_H_ | 6 #define COMPONENTS_HTML_VIEWER_SETUP_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Use to explicitly create headless regardless of command line switches. | 42 // Use to explicitly create headless regardless of command line switches. |
| 43 // This must be invoked before InitIfNecessary(). | 43 // This must be invoked before InitIfNecessary(). |
| 44 void InitHeadless(); | 44 void InitHeadless(); |
| 45 | 45 |
| 46 // Inits with the specified screen size and device pixel ratio. | 46 // Inits with the specified screen size and device pixel ratio. |
| 47 // NOTE: we wait to complete setup until the device pixel ratio is available | 47 // NOTE: we wait to complete setup until the device pixel ratio is available |
| 48 // as ResourceBundle uses the device pixel ratio during initialization. | 48 // as ResourceBundle uses the device pixel ratio during initialization. |
| 49 void InitIfNecessary(const gfx::Size& screen_size_in_pixels, | 49 void InitIfNecessary(const gfx::Size& screen_size_in_pixels, |
| 50 float device_pixel_ratio); | 50 float device_pixel_ratio); |
| 51 | 51 |
| 52 mojo::ApplicationImpl* app() const { return app_; } | |
| 53 bool is_headless() const { return is_headless_; } | 52 bool is_headless() const { return is_headless_; } |
| 54 bool did_init() const { return did_init_; } | 53 bool did_init() const { return did_init_; } |
| 55 | 54 |
| 56 const gfx::Size& screen_size_in_pixels() const { | 55 const gfx::Size& screen_size_in_pixels() const { |
| 57 return screen_size_in_pixels_; | 56 return screen_size_in_pixels_; |
| 58 } | 57 } |
| 59 | 58 |
| 60 float device_pixel_ratio() const { return device_pixel_ratio_; } | 59 float device_pixel_ratio() const { return device_pixel_ratio_; } |
| 61 | 60 |
| 62 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread() { | 61 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread() { |
| 63 return compositor_thread_.task_runner(); | 62 return compositor_thread_.task_runner(); |
| 64 } | 63 } |
| 65 | 64 |
| 66 MediaFactory* media_factory() { return media_factory_.get(); } | 65 MediaFactory* media_factory() { return media_factory_.get(); } |
| 67 | 66 |
| 68 private: | 67 private: |
| 68 // App for HTMLViewer, not the document's app. |
| 69 // WARNING: do not expose this. It's too easy to use the wrong one. |
| 70 // HTMLDocument should be using the application it creates, not this one. |
| 69 mojo::ApplicationImpl* app_; | 71 mojo::ApplicationImpl* app_; |
| 70 | 72 |
| 71 resource_provider::ResourceLoader resource_loader_; | 73 resource_provider::ResourceLoader resource_loader_; |
| 72 | 74 |
| 73 bool is_headless_; | 75 bool is_headless_; |
| 74 | 76 |
| 75 // True once we've completed init. | 77 // True once we've completed init. |
| 76 bool did_init_; | 78 bool did_init_; |
| 77 | 79 |
| 78 float device_pixel_ratio_; | 80 float device_pixel_ratio_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 93 scoped_ptr<BlinkPlatformImpl> blink_platform_; | 95 scoped_ptr<BlinkPlatformImpl> blink_platform_; |
| 94 base::Thread compositor_thread_; | 96 base::Thread compositor_thread_; |
| 95 scoped_ptr<MediaFactory> media_factory_; | 97 scoped_ptr<MediaFactory> media_factory_; |
| 96 | 98 |
| 97 DISALLOW_COPY_AND_ASSIGN(Setup); | 99 DISALLOW_COPY_AND_ASSIGN(Setup); |
| 98 }; | 100 }; |
| 99 | 101 |
| 100 } // namespace html_viewer | 102 } // namespace html_viewer |
| 101 | 103 |
| 102 #endif // COMPONENTS_HTML_VIEWER_SETUP_H_ | 104 #endif // COMPONENTS_HTML_VIEWER_SETUP_H_ |
| OLD | NEW |