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 "android_webview/browser/browser_view_renderer.h" | 5 #include "android_webview/browser/browser_view_renderer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "android_webview/browser/browser_view_renderer_client.h" | 9 #include "android_webview/browser/browser_view_renderer_client.h" |
10 #include "android_webview/browser/child_frame.h" | 10 #include "android_webview/browser/child_frame.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 // static | 84 // static |
85 BrowserViewRenderer* BrowserViewRenderer::FromWebContents( | 85 BrowserViewRenderer* BrowserViewRenderer::FromWebContents( |
86 content::WebContents* web_contents) { | 86 content::WebContents* web_contents) { |
87 return BrowserViewRendererUserData::GetBrowserViewRenderer(web_contents); | 87 return BrowserViewRendererUserData::GetBrowserViewRenderer(web_contents); |
88 } | 88 } |
89 | 89 |
90 BrowserViewRenderer::BrowserViewRenderer( | 90 BrowserViewRenderer::BrowserViewRenderer( |
91 BrowserViewRendererClient* client, | 91 BrowserViewRendererClient* client, |
92 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, | 92 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) |
93 bool disable_page_visibility) | |
94 : client_(client), | 93 : client_(client), |
95 ui_task_runner_(ui_task_runner), | 94 ui_task_runner_(ui_task_runner), |
96 compositor_frame_consumer_(nullptr), | 95 compositor_frame_consumer_(nullptr), |
97 disable_page_visibility_(disable_page_visibility), | |
98 compositor_(NULL), | 96 compositor_(NULL), |
99 is_paused_(false), | 97 is_paused_(false), |
100 view_visible_(false), | 98 view_visible_(false), |
101 window_visible_(false), | 99 window_visible_(false), |
102 attached_to_window_(false), | 100 attached_to_window_(false), |
103 hardware_enabled_(false), | 101 hardware_enabled_(false), |
104 dip_scale_(0.f), | 102 dip_scale_(0.f), |
105 page_scale_factor_(1.f), | 103 page_scale_factor_(1.f), |
106 min_page_scale_factor_(0.f), | 104 min_page_scale_factor_(0.f), |
107 max_page_scale_factor_(0.f), | 105 max_page_scale_factor_(0.f), |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 hardware_enabled_ = false; | 445 hardware_enabled_ = false; |
448 UpdateMemoryPolicy(); | 446 UpdateMemoryPolicy(); |
449 } | 447 } |
450 | 448 |
451 bool BrowserViewRenderer::IsVisible() const { | 449 bool BrowserViewRenderer::IsVisible() const { |
452 // Ignore |window_visible_| if |attached_to_window_| is false. | 450 // Ignore |window_visible_| if |attached_to_window_| is false. |
453 return view_visible_ && (!attached_to_window_ || window_visible_); | 451 return view_visible_ && (!attached_to_window_ || window_visible_); |
454 } | 452 } |
455 | 453 |
456 bool BrowserViewRenderer::IsClientVisible() const { | 454 bool BrowserViewRenderer::IsClientVisible() const { |
457 if (disable_page_visibility_) | |
458 return !is_paused_; | |
459 | |
460 return !is_paused_ && (!attached_to_window_ || window_visible_); | 455 return !is_paused_ && (!attached_to_window_ || window_visible_); |
461 } | 456 } |
462 | 457 |
463 gfx::Rect BrowserViewRenderer::GetScreenRect() const { | 458 gfx::Rect BrowserViewRenderer::GetScreenRect() const { |
464 return gfx::Rect(client_->GetLocationOnScreen(), size_); | 459 return gfx::Rect(client_->GetLocationOnScreen(), size_); |
465 } | 460 } |
466 | 461 |
467 uint32_t BrowserViewRenderer::GetCompositorID( | 462 uint32_t BrowserViewRenderer::GetCompositorID( |
468 content::SynchronousCompositor* compositor) { | 463 content::SynchronousCompositor* compositor) { |
469 for (auto iterator = compositor_map_.begin(); | 464 for (auto iterator = compositor_map_.begin(); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 base::StringAppendF(&str, | 718 base::StringAppendF(&str, |
724 "overscroll_rounding_error_: %s ", | 719 "overscroll_rounding_error_: %s ", |
725 overscroll_rounding_error_.ToString().c_str()); | 720 overscroll_rounding_error_.ToString().c_str()); |
726 base::StringAppendF( | 721 base::StringAppendF( |
727 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 722 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); |
728 base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 723 base::StringAppendF(&str, "clear_view: %d ", clear_view_); |
729 return str; | 724 return str; |
730 } | 725 } |
731 | 726 |
732 } // namespace android_webview | 727 } // namespace android_webview |
OLD | NEW |