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

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

Issue 1733173002: Mac: Make calling WebContents::WasShown/WasHidden the responsibility of the content layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments Created 4 years, 9 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 upload_size_(0), 331 upload_size_(0),
332 upload_position_(0), 332 upload_position_(0),
333 is_resume_pending_(false), 333 is_resume_pending_(false),
334 displayed_insecure_content_(false), 334 displayed_insecure_content_(false),
335 has_accessed_initial_document_(false), 335 has_accessed_initial_document_(false),
336 theme_color_(SK_ColorTRANSPARENT), 336 theme_color_(SK_ColorTRANSPARENT),
337 last_sent_theme_color_(SK_ColorTRANSPARENT), 337 last_sent_theme_color_(SK_ColorTRANSPARENT),
338 did_first_visually_non_empty_paint_(false), 338 did_first_visually_non_empty_paint_(false),
339 capturer_count_(0), 339 capturer_count_(0),
340 should_normally_be_visible_(true), 340 should_normally_be_visible_(true),
341 did_first_set_visible_(false),
341 is_being_destroyed_(false), 342 is_being_destroyed_(false),
342 notify_disconnection_(false), 343 notify_disconnection_(false),
343 dialog_manager_(NULL), 344 dialog_manager_(NULL),
344 is_showing_before_unload_dialog_(false), 345 is_showing_before_unload_dialog_(false),
345 last_active_time_(base::TimeTicks::Now()), 346 last_active_time_(base::TimeTicks::Now()),
346 closed_by_user_gesture_(false), 347 closed_by_user_gesture_(false),
347 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), 348 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)),
348 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), 349 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)),
349 zoom_scroll_remainder_(0), 350 zoom_scroll_remainder_(0),
350 render_view_message_source_(NULL), 351 render_view_message_source_(NULL),
(...skipping 4440 matching lines...) Expand 10 before | Expand all | Expand 10 after
4791 void WebContentsImpl::MediaStartedPlaying( 4792 void WebContentsImpl::MediaStartedPlaying(
4792 const WebContentsObserver::MediaPlayerId& id) { 4793 const WebContentsObserver::MediaPlayerId& id) {
4793 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); 4794 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id));
4794 } 4795 }
4795 4796
4796 void WebContentsImpl::MediaStoppedPlaying( 4797 void WebContentsImpl::MediaStoppedPlaying(
4797 const WebContentsObserver::MediaPlayerId& id) { 4798 const WebContentsObserver::MediaPlayerId& id) {
4798 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4799 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4799 } 4800 }
4800 4801
4802 void WebContentsImpl::UpdateWebContentsVisibility(bool visible) {
4803 if (!did_first_set_visible_) {
4804 // If this WebContents has not yet been set to be visible for the first
4805 // time, ignore any requests to make it hidden, since resources would
4806 // immediately be destroyed and only re-created after content loaded. In
4807 // this state the window content is undefined and can show garbage.
4808 // However, the page load mechanism requires an activation call through a
4809 // visibility call to (re)load.
4810 if (visible) {
4811 did_first_set_visible_ = true;
4812 WasShown();
4813 }
4814 return;
4815 }
4816 if (visible == should_normally_be_visible_)
4817 return;
4818
4819 if (visible)
4820 WasShown();
4821 else
4822 WasHidden();
4823 }
4824
4801 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 4825 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
4802 JavaScriptDialogManager* dialog_manager) { 4826 JavaScriptDialogManager* dialog_manager) {
4803 dialog_manager_ = dialog_manager; 4827 dialog_manager_ = dialog_manager;
4804 } 4828 }
4805 4829
4806 } // namespace content 4830 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698