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

Side by Side Diff: components/guest_view/browser/guest_view_base.cc

Issue 1554233004: Plumb audio muting state to guest web-contents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/guest_view/browser/guest_view_base.h" 5 #include "components/guest_view/browser/guest_view_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 } 105 }
106 106
107 void OnPageScaleFactorChanged(float page_scale_factor) override { 107 void OnPageScaleFactorChanged(float page_scale_factor) override {
108 if (destroyed_) 108 if (destroyed_)
109 return; 109 return;
110 110
111 guest_->web_contents()->SetPageScale(page_scale_factor); 111 guest_->web_contents()->SetPageScale(page_scale_factor);
112 } 112 }
113 113
114 void DidUpdateAudioMutingState(bool muted) override {
115 if (destroyed_)
116 return;
117
118 guest_->web_contents()->SetAudioMuted(muted);
119 }
120
114 private: 121 private:
115 bool is_fullscreen_; 122 bool is_fullscreen_;
116 bool destroyed_; 123 bool destroyed_;
117 GuestViewBase* guest_; 124 GuestViewBase* guest_;
118 125
119 void Destroy() { 126 void Destroy() {
120 if (destroyed_) 127 if (destroyed_)
121 return; 128 return;
122 destroyed_ = true; 129 destroyed_ = true;
123 guest_->Destroy(); 130 guest_->Destroy();
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 401
395 void GuestViewBase::DidAttach(int guest_proxy_routing_id) { 402 void GuestViewBase::DidAttach(int guest_proxy_routing_id) {
396 DCHECK(guest_proxy_routing_id_ == MSG_ROUTING_NONE || 403 DCHECK(guest_proxy_routing_id_ == MSG_ROUTING_NONE ||
397 guest_proxy_routing_id == guest_proxy_routing_id_); 404 guest_proxy_routing_id == guest_proxy_routing_id_);
398 guest_proxy_routing_id_ = guest_proxy_routing_id; 405 guest_proxy_routing_id_ = guest_proxy_routing_id;
399 406
400 opener_lifetime_observer_.reset(); 407 opener_lifetime_observer_.reset();
401 408
402 SetUpSizing(*attach_params()); 409 SetUpSizing(*attach_params());
403 410
411 // The guest should have the same muting state as the owner.
412 web_contents()->SetAudioMuted(owner_web_contents()->IsAudioMuted());
413
404 // Give the derived class an opportunity to perform some actions. 414 // Give the derived class an opportunity to perform some actions.
405 DidAttachToEmbedder(); 415 DidAttachToEmbedder();
406 416
407 // Inform the associated GuestViewContainer that the contentWindow is ready. 417 // Inform the associated GuestViewContainer that the contentWindow is ready.
408 embedder_web_contents()->Send(new GuestViewMsg_GuestAttached( 418 embedder_web_contents()->Send(new GuestViewMsg_GuestAttached(
409 element_instance_id_, 419 element_instance_id_,
410 guest_proxy_routing_id)); 420 guest_proxy_routing_id));
411 421
412 SendQueuedEvents(); 422 SendQueuedEvents();
413 } 423 }
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 886
877 void GuestViewBase::UpdateGuestSize(const gfx::Size& new_size, 887 void GuestViewBase::UpdateGuestSize(const gfx::Size& new_size,
878 bool due_to_auto_resize) { 888 bool due_to_auto_resize) {
879 if (due_to_auto_resize) 889 if (due_to_auto_resize)
880 GuestSizeChangedDueToAutoSize(guest_size_, new_size); 890 GuestSizeChangedDueToAutoSize(guest_size_, new_size);
881 DispatchOnResizeEvent(guest_size_, new_size); 891 DispatchOnResizeEvent(guest_size_, new_size);
882 guest_size_ = new_size; 892 guest_size_ = new_size;
883 } 893 }
884 894
885 } // namespace guest_view 895 } // namespace guest_view
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698