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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 11066032: Browser Plugin: Update Guest WebContents Visibility on BrowserPlugin Visiblity Change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a test Created 8 years, 2 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
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/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" 10 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h"
(...skipping 25 matching lines...) Expand all
36 RenderViewHost* render_view_host) 36 RenderViewHost* render_view_host)
37 : WebContentsObserver(web_contents), 37 : WebContentsObserver(web_contents),
38 embedder_render_process_host_(NULL), 38 embedder_render_process_host_(NULL),
39 instance_id_(instance_id), 39 instance_id_(instance_id),
40 #if defined(OS_WIN) 40 #if defined(OS_WIN)
41 damage_buffer_size_(0), 41 damage_buffer_size_(0),
42 #endif 42 #endif
43 damage_buffer_scale_factor_(1.0f), 43 damage_buffer_scale_factor_(1.0f),
44 pending_update_counter_(0), 44 pending_update_counter_(0),
45 guest_hang_timeout_( 45 guest_hang_timeout_(
46 base::TimeDelta::FromMilliseconds(kGuestHangTimeoutMs)) { 46 base::TimeDelta::FromMilliseconds(kGuestHangTimeoutMs)),
47 visible_(true) {
47 DCHECK(web_contents); 48 DCHECK(web_contents);
48 // |render_view_host| manages the ownership of this BrowserPluginGuestHelper. 49 // |render_view_host| manages the ownership of this BrowserPluginGuestHelper.
49 new BrowserPluginGuestHelper(this, render_view_host); 50 new BrowserPluginGuestHelper(this, render_view_host);
50 } 51 }
51 52
52 BrowserPluginGuest::~BrowserPluginGuest() { 53 BrowserPluginGuest::~BrowserPluginGuest() {
53 } 54 }
54 55
55 // static 56 // static
56 BrowserPluginGuest* BrowserPluginGuest::Create( 57 BrowserPluginGuest* BrowserPluginGuest::Create(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 web_contents()->GetRenderProcessHost()->GetHandle(); 92 web_contents()->GetRenderProcessHost()->GetHandle();
92 base::KillProcess(process_handle, RESULT_CODE_HUNG, false); 93 base::KillProcess(process_handle, RESULT_CODE_HUNG, false);
93 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Hung")); 94 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Hung"));
94 } 95 }
95 96
96 void BrowserPluginGuest::SetIsAcceptingTouchEvents(bool accept) { 97 void BrowserPluginGuest::SetIsAcceptingTouchEvents(bool accept) {
97 SendMessageToEmbedder( 98 SendMessageToEmbedder(
98 new BrowserPluginMsg_ShouldAcceptTouchEvents(instance_id(), accept)); 99 new BrowserPluginMsg_ShouldAcceptTouchEvents(instance_id(), accept));
99 } 100 }
100 101
102 void BrowserPluginGuest::SetVisibility(bool embedder_visible, bool visible) {
103 visible_ = visible;
104 if (embedder_visible && visible)
105 web_contents()->WasShown();
106 else
107 web_contents()->WasHidden();
Charlie Reis 2012/10/05 00:33:18 Just to be clear, does this notify the guest rende
Fady Samuel 2012/10/05 15:22:07 Done.
108 }
109
101 WebContents* BrowserPluginGuest::GetWebContents() { 110 WebContents* BrowserPluginGuest::GetWebContents() {
102 return web_contents(); 111 return web_contents();
103 } 112 }
104 113
105 void BrowserPluginGuest::Terminate() { 114 void BrowserPluginGuest::Terminate() {
106 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Terminate")); 115 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Terminate"));
107 base::ProcessHandle process_handle = 116 base::ProcessHandle process_handle =
108 web_contents()->GetRenderProcessHost()->GetHandle(); 117 web_contents()->GetRenderProcessHost()->GetHandle();
109 base::KillProcess(process_handle, RESULT_CODE_KILLED, false); 118 base::KillProcess(process_handle, RESULT_CODE_KILLED, false);
110 } 119 }
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 break; 376 break;
368 } 377 }
369 } 378 }
370 379
371 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { 380 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) {
372 DCHECK(embedder_render_process_host()); 381 DCHECK(embedder_render_process_host());
373 embedder_render_process_host()->Send(msg); 382 embedder_render_process_host()->Send(msg);
374 } 383 }
375 384
376 } // namespace content 385 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698