| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 4228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4239 | 4239 |
| 4240 GURL url = pending_entry->GetURL(); | 4240 GURL url = pending_entry->GetURL(); |
| 4241 return HostZoomMap::GetForWebContents(this)->GetZoomLevelForHostAndScheme( | 4241 return HostZoomMap::GetForWebContents(this)->GetZoomLevelForHostAndScheme( |
| 4242 url.scheme(), net::GetHostOrSpecFromURL(url)); | 4242 url.scheme(), net::GetHostOrSpecFromURL(url)); |
| 4243 } | 4243 } |
| 4244 | 4244 |
| 4245 bool WebContentsImpl::HideDownloadUI() const { | 4245 bool WebContentsImpl::HideDownloadUI() const { |
| 4246 return is_overlay_content_; | 4246 return is_overlay_content_; |
| 4247 } | 4247 } |
| 4248 | 4248 |
| 4249 bool WebContentsImpl::HasPersistentVideo() const { |
| 4250 return has_persistent_video_; |
| 4251 } |
| 4252 |
| 4249 bool WebContentsImpl::IsFocusedElementEditable() { | 4253 bool WebContentsImpl::IsFocusedElementEditable() { |
| 4250 RenderFrameHostImpl* frame = GetFocusedFrame(); | 4254 RenderFrameHostImpl* frame = GetFocusedFrame(); |
| 4251 return frame && frame->has_focused_editable_element(); | 4255 return frame && frame->has_focused_editable_element(); |
| 4252 } | 4256 } |
| 4253 | 4257 |
| 4254 void WebContentsImpl::ClearFocusedElement() { | 4258 void WebContentsImpl::ClearFocusedElement() { |
| 4255 if (auto* frame = GetFocusedFrame()) | 4259 if (auto* frame = GetFocusedFrame()) |
| 4256 frame->ClearFocusedElement(); | 4260 frame->ClearFocusedElement(); |
| 4257 } | 4261 } |
| 4258 | 4262 |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5265 return; | 5269 return; |
| 5266 } | 5270 } |
| 5267 // Notify for UI updates if the state changes. | 5271 // Notify for UI updates if the state changes. |
| 5268 DCHECK(bluetooth_connected_device_count_ != 0); | 5272 DCHECK(bluetooth_connected_device_count_ != 0); |
| 5269 bluetooth_connected_device_count_--; | 5273 bluetooth_connected_device_count_--; |
| 5270 if (bluetooth_connected_device_count_ == 0) { | 5274 if (bluetooth_connected_device_count_ == 0) { |
| 5271 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); | 5275 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); |
| 5272 } | 5276 } |
| 5273 } | 5277 } |
| 5274 | 5278 |
| 5279 void WebContentsImpl::SetHasPersistentVideo(bool value) { |
| 5280 if (has_persistent_video_ == value) |
| 5281 return; |
| 5282 |
| 5283 has_persistent_video_ = value; |
| 5284 NotifyPreferencesChanged(); |
| 5285 } |
| 5286 |
| 5275 #if defined(OS_ANDROID) | 5287 #if defined(OS_ANDROID) |
| 5276 void WebContentsImpl::NotifyFindMatchRectsReply( | 5288 void WebContentsImpl::NotifyFindMatchRectsReply( |
| 5277 int version, | 5289 int version, |
| 5278 const std::vector<gfx::RectF>& rects, | 5290 const std::vector<gfx::RectF>& rects, |
| 5279 const gfx::RectF& active_rect) { | 5291 const gfx::RectF& active_rect) { |
| 5280 if (delegate_) | 5292 if (delegate_) |
| 5281 delegate_->FindMatchRectsReply(this, version, rects, active_rect); | 5293 delegate_->FindMatchRectsReply(this, version, rects, active_rect); |
| 5282 } | 5294 } |
| 5283 #endif | 5295 #endif |
| 5284 | 5296 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5329 if (visible == should_normally_be_visible_) | 5341 if (visible == should_normally_be_visible_) |
| 5330 return; | 5342 return; |
| 5331 | 5343 |
| 5332 if (visible) | 5344 if (visible) |
| 5333 WasShown(); | 5345 WasShown(); |
| 5334 else | 5346 else |
| 5335 WasHidden(); | 5347 WasHidden(); |
| 5336 } | 5348 } |
| 5337 | 5349 |
| 5338 void WebContentsImpl::UpdateOverridingUserAgent() { | 5350 void WebContentsImpl::UpdateOverridingUserAgent() { |
| 5339 std::set<RenderViewHost*> render_view_host_set; | 5351 NotifyPreferencesChanged(); |
| 5340 for (FrameTreeNode* node : frame_tree_.Nodes()) { | |
| 5341 RenderWidgetHost* render_widget_host = | |
| 5342 node->current_frame_host()->GetRenderWidgetHost(); | |
| 5343 if (!render_widget_host) | |
| 5344 continue; | |
| 5345 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | |
| 5346 if (!render_view_host) | |
| 5347 continue; | |
| 5348 render_view_host_set.insert(render_view_host); | |
| 5349 } | |
| 5350 for (RenderViewHost* render_view_host : render_view_host_set) | |
| 5351 render_view_host->OnWebkitPreferencesChanged(); | |
| 5352 } | 5352 } |
| 5353 | 5353 |
| 5354 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5354 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5355 JavaScriptDialogManager* dialog_manager) { | 5355 JavaScriptDialogManager* dialog_manager) { |
| 5356 dialog_manager_ = dialog_manager; | 5356 dialog_manager_ = dialog_manager; |
| 5357 } | 5357 } |
| 5358 | 5358 |
| 5359 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { | 5359 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { |
| 5360 auto it = binding_sets_.find(interface_name); | 5360 auto it = binding_sets_.find(interface_name); |
| 5361 if (it != binding_sets_.end()) | 5361 if (it != binding_sets_.end()) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5402 | 5402 |
| 5403 GetMainFrame()->AddMessageToConsole( | 5403 GetMainFrame()->AddMessageToConsole( |
| 5404 content::CONSOLE_MESSAGE_LEVEL_WARNING, | 5404 content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| 5405 base::StringPrintf("This site does not have a valid SSL " | 5405 base::StringPrintf("This site does not have a valid SSL " |
| 5406 "certificate! Without SSL, your site's and " | 5406 "certificate! Without SSL, your site's and " |
| 5407 "visitors' data is vulnerable to theft and " | 5407 "visitors' data is vulnerable to theft and " |
| 5408 "tampering. Get a valid SSL certificate before" | 5408 "tampering. Get a valid SSL certificate before" |
| 5409 " releasing your website to the public.")); | 5409 " releasing your website to the public.")); |
| 5410 } | 5410 } |
| 5411 | 5411 |
| 5412 void WebContentsImpl::NotifyPreferencesChanged() { |
| 5413 std::set<RenderViewHost*> render_view_host_set; |
| 5414 for (FrameTreeNode* node : frame_tree_.Nodes()) { |
| 5415 RenderWidgetHost* render_widget_host = |
| 5416 node->current_frame_host()->GetRenderWidgetHost(); |
| 5417 if (!render_widget_host) |
| 5418 continue; |
| 5419 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
| 5420 if (!render_view_host) |
| 5421 continue; |
| 5422 render_view_host_set.insert(render_view_host); |
| 5423 } |
| 5424 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5425 render_view_host->OnWebkitPreferencesChanged(); |
| 5426 } |
| 5427 |
| 5412 } // namespace content | 5428 } // namespace content |
| OLD | NEW |