Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2692903002: Don't show media controls when there is a persistent video. (Closed)
Patch Set: cleanup and tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 4236 matching lines...) Expand 10 before | Expand all | Expand 10 after
4247 4247
4248 GURL url = pending_entry->GetURL(); 4248 GURL url = pending_entry->GetURL();
4249 return HostZoomMap::GetForWebContents(this)->GetZoomLevelForHostAndScheme( 4249 return HostZoomMap::GetForWebContents(this)->GetZoomLevelForHostAndScheme(
4250 url.scheme(), net::GetHostOrSpecFromURL(url)); 4250 url.scheme(), net::GetHostOrSpecFromURL(url));
4251 } 4251 }
4252 4252
4253 bool WebContentsImpl::HideDownloadUI() const { 4253 bool WebContentsImpl::HideDownloadUI() const {
4254 return is_overlay_content_; 4254 return is_overlay_content_;
4255 } 4255 }
4256 4256
4257 bool WebContentsImpl::HasPersistentVideo() const {
4258 return has_persistent_video_;
4259 }
4260
4257 bool WebContentsImpl::IsFocusedElementEditable() { 4261 bool WebContentsImpl::IsFocusedElementEditable() {
4258 RenderFrameHostImpl* frame = GetFocusedFrame(); 4262 RenderFrameHostImpl* frame = GetFocusedFrame();
4259 return frame && frame->has_focused_editable_element(); 4263 return frame && frame->has_focused_editable_element();
4260 } 4264 }
4261 4265
4262 void WebContentsImpl::ClearFocusedElement() { 4266 void WebContentsImpl::ClearFocusedElement() {
4263 if (auto* frame = GetFocusedFrame()) 4267 if (auto* frame = GetFocusedFrame())
4264 frame->ClearFocusedElement(); 4268 frame->ClearFocusedElement();
4265 } 4269 }
4266 4270
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
5273 return; 5277 return;
5274 } 5278 }
5275 // Notify for UI updates if the state changes. 5279 // Notify for UI updates if the state changes.
5276 DCHECK(bluetooth_connected_device_count_ != 0); 5280 DCHECK(bluetooth_connected_device_count_ != 0);
5277 bluetooth_connected_device_count_--; 5281 bluetooth_connected_device_count_--;
5278 if (bluetooth_connected_device_count_ == 0) { 5282 if (bluetooth_connected_device_count_ == 0) {
5279 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); 5283 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
5280 } 5284 }
5281 } 5285 }
5282 5286
5287 void WebContentsImpl::SetHasPersistentVideo(bool value) {
5288 if (has_persistent_video_ == value)
5289 return;
5290
5291 has_persistent_video_ = value;
5292 NotifyPreferencesChanged();
5293 }
5294
5283 #if defined(OS_ANDROID) 5295 #if defined(OS_ANDROID)
5284 void WebContentsImpl::NotifyFindMatchRectsReply( 5296 void WebContentsImpl::NotifyFindMatchRectsReply(
5285 int version, 5297 int version,
5286 const std::vector<gfx::RectF>& rects, 5298 const std::vector<gfx::RectF>& rects,
5287 const gfx::RectF& active_rect) { 5299 const gfx::RectF& active_rect) {
5288 if (delegate_) 5300 if (delegate_)
5289 delegate_->FindMatchRectsReply(this, version, rects, active_rect); 5301 delegate_->FindMatchRectsReply(this, version, rects, active_rect);
5290 } 5302 }
5291 #endif 5303 #endif
5292 5304
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
5337 if (visible == should_normally_be_visible_) 5349 if (visible == should_normally_be_visible_)
5338 return; 5350 return;
5339 5351
5340 if (visible) 5352 if (visible)
5341 WasShown(); 5353 WasShown();
5342 else 5354 else
5343 WasHidden(); 5355 WasHidden();
5344 } 5356 }
5345 5357
5346 void WebContentsImpl::UpdateOverridingUserAgent() { 5358 void WebContentsImpl::UpdateOverridingUserAgent() {
5347 std::set<RenderViewHost*> render_view_host_set; 5359 NotifyPreferencesChanged();
5348 for (FrameTreeNode* node : frame_tree_.Nodes()) {
5349 RenderWidgetHost* render_widget_host =
5350 node->current_frame_host()->GetRenderWidgetHost();
5351 if (!render_widget_host)
5352 continue;
5353 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5354 if (!render_view_host)
5355 continue;
5356 render_view_host_set.insert(render_view_host);
5357 }
5358 for (RenderViewHost* render_view_host : render_view_host_set)
5359 render_view_host->OnWebkitPreferencesChanged();
5360 } 5360 }
5361 5361
5362 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5362 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5363 JavaScriptDialogManager* dialog_manager) { 5363 JavaScriptDialogManager* dialog_manager) {
5364 dialog_manager_ = dialog_manager; 5364 dialog_manager_ = dialog_manager;
5365 } 5365 }
5366 5366
5367 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { 5367 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5368 auto it = binding_sets_.find(interface_name); 5368 auto it = binding_sets_.find(interface_name);
5369 if (it != binding_sets_.end()) 5369 if (it != binding_sets_.end())
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5410 5410
5411 GetMainFrame()->AddMessageToConsole( 5411 GetMainFrame()->AddMessageToConsole(
5412 content::CONSOLE_MESSAGE_LEVEL_WARNING, 5412 content::CONSOLE_MESSAGE_LEVEL_WARNING,
5413 base::StringPrintf("This site does not have a valid SSL " 5413 base::StringPrintf("This site does not have a valid SSL "
5414 "certificate! Without SSL, your site's and " 5414 "certificate! Without SSL, your site's and "
5415 "visitors' data is vulnerable to theft and " 5415 "visitors' data is vulnerable to theft and "
5416 "tampering. Get a valid SSL certificate before" 5416 "tampering. Get a valid SSL certificate before"
5417 " releasing your website to the public.")); 5417 " releasing your website to the public."));
5418 } 5418 }
5419 5419
5420 void WebContentsImpl::NotifyPreferencesChanged() {
5421 std::set<RenderViewHost*> render_view_host_set;
5422 for (FrameTreeNode* node : frame_tree_.Nodes()) {
5423 RenderWidgetHost* render_widget_host =
5424 node->current_frame_host()->GetRenderWidgetHost();
5425 if (!render_widget_host)
5426 continue;
5427 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5428 if (!render_view_host)
5429 continue;
5430 render_view_host_set.insert(render_view_host);
5431 }
5432 for (RenderViewHost* render_view_host : render_view_host_set)
5433 render_view_host->OnWebkitPreferencesChanged();
5434 }
5435
5420 } // namespace content 5436 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698