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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 10779023: Fix focus notification for Flash fullscreen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 ScheduleAsyncDidChangeView(previous_view); 776 ScheduleAsyncDidChangeView(previous_view);
777 777
778 // Reset the size attributes that we hacked to fill in the screen and 778 // Reset the size attributes that we hacked to fill in the screen and
779 // retrigger ViewChanged. Make sure we don't forward duplicates of 779 // retrigger ViewChanged. Make sure we don't forward duplicates of
780 // this view to the plugin. 780 // this view to the plugin.
781 ResetSizeAttributesAfterFullscreen(); 781 ResetSizeAttributesAfterFullscreen();
782 return; 782 return;
783 } 783 }
784 } 784 }
785 785
786 flash_fullscreen_ = (fullscreen_container_ != NULL); 786 UpdateFlashFullscreenState(fullscreen_container_ != NULL);
787
787 SendDidChangeView(previous_view); 788 SendDidChangeView(previous_view);
788 } 789 }
789 790
790 void PluginInstance::SetWebKitFocus(bool has_focus) { 791 void PluginInstance::SetWebKitFocus(bool has_focus) {
791 if (has_webkit_focus_ == has_focus) 792 if (has_webkit_focus_ == has_focus)
792 return; 793 return;
793 794
794 bool old_plugin_focus = PluginHasFocus(); 795 bool old_plugin_focus = PluginHasFocus();
795 has_webkit_focus_ = has_focus; 796 has_webkit_focus_ = has_focus;
796 if (PluginHasFocus() != old_plugin_focus) { 797 if (PluginHasFocus() != old_plugin_focus)
797 delegate()->PluginFocusChanged(this, PluginHasFocus()); 798 SendFocusChangeNotification();
798 instance_interface_->DidChangeFocus(pp_instance(),
799 PP_FromBool(PluginHasFocus()));
800 }
801 } 799 }
802 800
803 void PluginInstance::SetContentAreaFocus(bool has_focus) { 801 void PluginInstance::SetContentAreaFocus(bool has_focus) {
804 if (has_content_area_focus_ == has_focus) 802 if (has_content_area_focus_ == has_focus)
805 return; 803 return;
806 804
807 bool old_plugin_focus = PluginHasFocus(); 805 bool old_plugin_focus = PluginHasFocus();
808 has_content_area_focus_ = has_focus; 806 has_content_area_focus_ = has_focus;
809 if (PluginHasFocus() != old_plugin_focus) { 807 if (PluginHasFocus() != old_plugin_focus)
810 instance_interface_->DidChangeFocus(pp_instance(), 808 SendFocusChangeNotification();
811 PP_FromBool(PluginHasFocus()));
812 }
813 } 809 }
814 810
815 void PluginInstance::PageVisibilityChanged(bool is_visible) { 811 void PluginInstance::PageVisibilityChanged(bool is_visible) {
816 if (is_visible == view_data_.is_page_visible) 812 if (is_visible == view_data_.is_page_visible)
817 return; // Nothing to do. 813 return; // Nothing to do.
818 ViewData old_data = view_data_; 814 ViewData old_data = view_data_;
819 view_data_.is_page_visible = is_visible; 815 view_data_.is_page_visible = is_visible;
820 SendDidChangeView(old_data); 816 SendDidChangeView(old_data);
821 } 817 }
822 818
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 if (!plugin_zoom_interface_) { 1045 if (!plugin_zoom_interface_) {
1050 plugin_zoom_interface_ = 1046 plugin_zoom_interface_ =
1051 static_cast<const PPP_Zoom_Dev*>(module_->GetPluginInterface( 1047 static_cast<const PPP_Zoom_Dev*>(module_->GetPluginInterface(
1052 PPP_ZOOM_DEV_INTERFACE)); 1048 PPP_ZOOM_DEV_INTERFACE));
1053 } 1049 }
1054 1050
1055 return !!plugin_zoom_interface_; 1051 return !!plugin_zoom_interface_;
1056 } 1052 }
1057 1053
1058 bool PluginInstance::PluginHasFocus() const { 1054 bool PluginInstance::PluginHasFocus() const {
1059 return has_webkit_focus_ && has_content_area_focus_; 1055 return flash_fullscreen_ || (has_webkit_focus_ && has_content_area_focus_);
1056 }
1057
1058 void PluginInstance::SendFocusChangeNotification() {
1059 bool has_focus = PluginHasFocus();
1060 delegate()->PluginFocusChanged(this, has_focus);
1061 instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus));
1060 } 1062 }
1061 1063
1062 bool PluginInstance::IsAcceptingTouchEvents() const { 1064 bool PluginInstance::IsAcceptingTouchEvents() const {
1063 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) || 1065 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) ||
1064 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH); 1066 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH);
1065 } 1067 }
1066 1068
1067 void PluginInstance::ScheduleAsyncDidChangeView( 1069 void PluginInstance::ScheduleAsyncDidChangeView(
1068 const ::ppapi::ViewData& previous_view) { 1070 const ::ppapi::ViewData& previous_view) {
1069 if (view_change_weak_ptr_factory_.HasWeakPtrs()) 1071 if (view_change_weak_ptr_factory_.HasWeakPtrs())
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 // Unbind current 2D or 3D graphics context. 1329 // Unbind current 2D or 3D graphics context.
1328 BindGraphics(pp_instance(), 0); 1330 BindGraphics(pp_instance(), 0);
1329 VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off"); 1331 VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off");
1330 if (fullscreen) { 1332 if (fullscreen) {
1331 DCHECK(!fullscreen_container_); 1333 DCHECK(!fullscreen_container_);
1332 fullscreen_container_ = delegate_->CreateFullscreenContainer(this); 1334 fullscreen_container_ = delegate_->CreateFullscreenContainer(this);
1333 } else { 1335 } else {
1334 DCHECK(fullscreen_container_); 1336 DCHECK(fullscreen_container_);
1335 fullscreen_container_->Destroy(); 1337 fullscreen_container_->Destroy();
1336 fullscreen_container_ = NULL; 1338 fullscreen_container_ = NULL;
1337 flash_fullscreen_ = false; 1339 UpdateFlashFullscreenState(false);
1338 if (!delay_report) { 1340 if (!delay_report) {
1339 ReportGeometry(); 1341 ReportGeometry();
1340 } else { 1342 } else {
1341 MessageLoop::current()->PostTask( 1343 MessageLoop::current()->PostTask(
1342 FROM_HERE, base::Bind(&PluginInstance::ReportGeometry, this)); 1344 FROM_HERE, base::Bind(&PluginInstance::ReportGeometry, this));
1343 } 1345 }
1344 } 1346 }
1345 } 1347 }
1346 1348
1349 void PluginInstance::UpdateFlashFullscreenState(bool flash_fullscreen) {
1350 if (flash_fullscreen == flash_fullscreen_)
1351 return;
1352
1353 bool old_plugin_focus = PluginHasFocus();
1354 flash_fullscreen_ = flash_fullscreen;
1355 if (PluginHasFocus() != old_plugin_focus)
brettw 2012/07/17 20:06:14 This seems wrong. The old_plugin_focus value was j
yzshen1 2012/07/18 01:17:58 PluginHasFocus() was changed and it is now determi
1356 SendFocusChangeNotification();
1357 }
1358
1347 int32_t PluginInstance::Navigate(PPB_URLRequestInfo_Impl* request, 1359 int32_t PluginInstance::Navigate(PPB_URLRequestInfo_Impl* request,
1348 const char* target, 1360 const char* target,
1349 bool from_user_action) { 1361 bool from_user_action) {
1350 if (!container_) 1362 if (!container_)
1351 return PP_ERROR_FAILED; 1363 return PP_ERROR_FAILED;
1352 1364
1353 WebDocument document = container_->element().document(); 1365 WebDocument document = container_->element().document();
1354 WebFrame* frame = document.frame(); 1366 WebFrame* frame = document.frame();
1355 if (!frame) 1367 if (!frame)
1356 return PP_ERROR_FAILED; 1368 return PP_ERROR_FAILED;
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 screen_size_for_fullscreen_ = gfx::Size(); 2224 screen_size_for_fullscreen_ = gfx::Size();
2213 WebElement element = container_->element(); 2225 WebElement element = container_->element();
2214 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2226 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2215 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2227 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2216 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2228 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2217 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2229 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2218 } 2230 }
2219 2231
2220 } // namespace ppapi 2232 } // namespace ppapi
2221 } // namespace webkit 2233 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698