OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 load_state_(net::LOAD_STATE_IDLE, base::string16()), | 301 load_state_(net::LOAD_STATE_IDLE, base::string16()), |
302 upload_size_(0), | 302 upload_size_(0), |
303 upload_position_(0), | 303 upload_position_(0), |
304 displayed_insecure_content_(false), | 304 displayed_insecure_content_(false), |
305 capturer_count_(0), | 305 capturer_count_(0), |
306 should_normally_be_visible_(true), | 306 should_normally_be_visible_(true), |
307 is_being_destroyed_(false), | 307 is_being_destroyed_(false), |
308 notify_disconnection_(false), | 308 notify_disconnection_(false), |
309 dialog_manager_(NULL), | 309 dialog_manager_(NULL), |
310 is_showing_before_unload_dialog_(false), | 310 is_showing_before_unload_dialog_(false), |
| 311 last_active_time_(base::TimeTicks::Now()), |
311 closed_by_user_gesture_(false), | 312 closed_by_user_gesture_(false), |
312 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 313 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
313 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 314 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
314 temporary_zoom_settings_(false), | 315 temporary_zoom_settings_(false), |
315 color_chooser_identifier_(0), | 316 color_chooser_identifier_(0), |
316 render_view_message_source_(NULL), | 317 render_view_message_source_(NULL), |
317 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), | 318 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), |
318 is_subframe_(false) { | 319 is_subframe_(false) { |
319 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 320 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
320 g_created_callbacks.Get().at(i).Run(this); | 321 g_created_callbacks.Get().at(i).Run(this); |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 | 895 |
895 bool WebContentsImpl::IsBeingDestroyed() const { | 896 bool WebContentsImpl::IsBeingDestroyed() const { |
896 return is_being_destroyed_; | 897 return is_being_destroyed_; |
897 } | 898 } |
898 | 899 |
899 void WebContentsImpl::NotifyNavigationStateChanged(unsigned changed_flags) { | 900 void WebContentsImpl::NotifyNavigationStateChanged(unsigned changed_flags) { |
900 if (delegate_) | 901 if (delegate_) |
901 delegate_->NavigationStateChanged(this, changed_flags); | 902 delegate_->NavigationStateChanged(this, changed_flags); |
902 } | 903 } |
903 | 904 |
904 base::TimeTicks WebContentsImpl::GetLastSelectedTime() const { | 905 base::TimeTicks WebContentsImpl::GetLastActiveTime() const { |
905 return last_selected_time_; | 906 return last_active_time_; |
906 } | 907 } |
907 | 908 |
908 void WebContentsImpl::WasShown() { | 909 void WebContentsImpl::WasShown() { |
909 controller_.SetActive(true); | 910 controller_.SetActive(true); |
910 RenderWidgetHostViewPort* rwhv = | 911 RenderWidgetHostViewPort* rwhv = |
911 RenderWidgetHostViewPort::FromRWHV(GetRenderWidgetHostView()); | 912 RenderWidgetHostViewPort::FromRWHV(GetRenderWidgetHostView()); |
912 if (rwhv) { | 913 if (rwhv) { |
913 rwhv->Show(); | 914 rwhv->Show(); |
914 #if defined(OS_MACOSX) | 915 #if defined(OS_MACOSX) |
915 rwhv->SetActive(true); | 916 rwhv->SetActive(true); |
916 #endif | 917 #endif |
917 } | 918 } |
918 | 919 |
919 last_selected_time_ = base::TimeTicks::Now(); | 920 last_active_time_ = base::TimeTicks::Now(); |
920 | 921 |
921 // The resize rect might have changed while this was inactive -- send the new | 922 // The resize rect might have changed while this was inactive -- send the new |
922 // one to make sure it's up to date. | 923 // one to make sure it's up to date. |
923 RenderViewHostImpl* rvh = | 924 RenderViewHostImpl* rvh = |
924 static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 925 static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
925 if (rvh) { | 926 if (rvh) { |
926 rvh->ResizeRectChanged(GetRootWindowResizerRect()); | 927 rvh->ResizeRectChanged(GetRootWindowResizerRect()); |
927 } | 928 } |
928 | 929 |
929 FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasShown()); | 930 FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasShown()); |
(...skipping 2713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3643 | 3644 |
3644 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3645 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
3645 if (!delegate_) | 3646 if (!delegate_) |
3646 return; | 3647 return; |
3647 const gfx::Size new_size = GetPreferredSize(); | 3648 const gfx::Size new_size = GetPreferredSize(); |
3648 if (new_size != old_size) | 3649 if (new_size != old_size) |
3649 delegate_->UpdatePreferredSize(this, new_size); | 3650 delegate_->UpdatePreferredSize(this, new_size); |
3650 } | 3651 } |
3651 | 3652 |
3652 } // namespace content | 3653 } // namespace content |
OLD | NEW |