| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 // WebContentsImpl ------------------------------------------------------------- | 307 // WebContentsImpl ------------------------------------------------------------- |
| 308 | 308 |
| 309 WebContentsImpl::WebContentsImpl( | 309 WebContentsImpl::WebContentsImpl( |
| 310 BrowserContext* browser_context, | 310 BrowserContext* browser_context, |
| 311 WebContentsImpl* opener) | 311 WebContentsImpl* opener) |
| 312 : delegate_(NULL), | 312 : delegate_(NULL), |
| 313 controller_(this, browser_context), | 313 controller_(this, browser_context), |
| 314 render_view_host_delegate_view_(NULL), | 314 render_view_host_delegate_view_(NULL), |
| 315 opener_(opener), | 315 opener_(opener), |
| 316 created_with_opener_(!!opener), | 316 created_with_opener_(!!opener), |
| 317 #if defined(OS_WIN) | |
| 318 accessible_parent_(NULL), | |
| 319 #endif | |
| 320 frame_tree_(new NavigatorImpl(&controller_, this), | 317 frame_tree_(new NavigatorImpl(&controller_, this), |
| 321 this, this, this, this), | 318 this, this, this, this), |
| 322 is_loading_(false), | 319 is_loading_(false), |
| 323 is_load_to_different_document_(false), | 320 is_load_to_different_document_(false), |
| 324 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 321 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 325 crashed_error_code_(0), | 322 crashed_error_code_(0), |
| 326 waiting_for_response_(false), | 323 waiting_for_response_(false), |
| 327 load_state_(net::LOAD_STATE_IDLE, base::string16()), | 324 load_state_(net::LOAD_STATE_IDLE, base::string16()), |
| 328 loading_total_progress_(0.0), | 325 loading_total_progress_(0.0), |
| 329 loading_weak_factory_(this), | 326 loading_weak_factory_(this), |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 controller_.ReloadIgnoringCache(true); | 710 controller_.ReloadIgnoringCache(true); |
| 714 | 711 |
| 715 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 712 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 716 UserAgentOverrideSet(override)); | 713 UserAgentOverrideSet(override)); |
| 717 } | 714 } |
| 718 | 715 |
| 719 const std::string& WebContentsImpl::GetUserAgentOverride() const { | 716 const std::string& WebContentsImpl::GetUserAgentOverride() const { |
| 720 return renderer_preferences_.user_agent_override; | 717 return renderer_preferences_.user_agent_override; |
| 721 } | 718 } |
| 722 | 719 |
| 723 #if defined(OS_WIN) | |
| 724 void WebContentsImpl::SetParentNativeViewAccessible( | |
| 725 gfx::NativeViewAccessible accessible_parent) { | |
| 726 accessible_parent_ = accessible_parent; | |
| 727 if (GetRenderViewHost()) | |
| 728 GetRenderViewHostImpl()->SetParentNativeViewAccessible(accessible_parent); | |
| 729 } | |
| 730 #endif | |
| 731 | |
| 732 const base::string16& WebContentsImpl::GetTitle() const { | 720 const base::string16& WebContentsImpl::GetTitle() const { |
| 733 // Transient entries take precedence. They are used for interstitial pages | 721 // Transient entries take precedence. They are used for interstitial pages |
| 734 // that are shown on top of existing pages. | 722 // that are shown on top of existing pages. |
| 735 NavigationEntry* entry = controller_.GetTransientEntry(); | 723 NavigationEntry* entry = controller_.GetTransientEntry(); |
| 736 std::string accept_languages = | 724 std::string accept_languages = |
| 737 GetContentClient()->browser()->GetAcceptLangs( | 725 GetContentClient()->browser()->GetAcceptLangs( |
| 738 GetBrowserContext()); | 726 GetBrowserContext()); |
| 739 if (entry) { | 727 if (entry) { |
| 740 return entry->GetTitleForDisplay(accept_languages); | 728 return entry->GetTitleForDisplay(accept_languages); |
| 741 } | 729 } |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 currentPinchZoomStepDelta_--; | 1247 currentPinchZoomStepDelta_--; |
| 1260 if (delegate_) | 1248 if (delegate_) |
| 1261 delegate_->ContentsZoomChange(false); | 1249 delegate_->ContentsZoomChange(false); |
| 1262 } | 1250 } |
| 1263 return true; | 1251 return true; |
| 1264 } | 1252 } |
| 1265 | 1253 |
| 1266 return false; | 1254 return false; |
| 1267 } | 1255 } |
| 1268 | 1256 |
| 1269 #if defined(OS_WIN) | |
| 1270 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { | |
| 1271 return accessible_parent_; | |
| 1272 } | |
| 1273 #endif | |
| 1274 | |
| 1275 void WebContentsImpl::HandleMouseDown() { | 1257 void WebContentsImpl::HandleMouseDown() { |
| 1276 if (delegate_) | 1258 if (delegate_) |
| 1277 delegate_->HandleMouseDown(); | 1259 delegate_->HandleMouseDown(); |
| 1278 } | 1260 } |
| 1279 | 1261 |
| 1280 void WebContentsImpl::HandleMouseUp() { | 1262 void WebContentsImpl::HandleMouseUp() { |
| 1281 if (delegate_) | 1263 if (delegate_) |
| 1282 delegate_->HandleMouseUp(); | 1264 delegate_->HandleMouseUp(); |
| 1283 } | 1265 } |
| 1284 | 1266 |
| (...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4058 | 4040 |
| 4059 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 4041 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 4060 if (!delegate_) | 4042 if (!delegate_) |
| 4061 return; | 4043 return; |
| 4062 const gfx::Size new_size = GetPreferredSize(); | 4044 const gfx::Size new_size = GetPreferredSize(); |
| 4063 if (new_size != old_size) | 4045 if (new_size != old_size) |
| 4064 delegate_->UpdatePreferredSize(this, new_size); | 4046 delegate_->UpdatePreferredSize(this, new_size); |
| 4065 } | 4047 } |
| 4066 | 4048 |
| 4067 } // namespace content | 4049 } // namespace content |
| OLD | NEW |