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

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: Addressed creis@'s comments 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 web_contents()->GetRenderProcessHost()->GetHandle(); 100 web_contents()->GetRenderProcessHost()->GetHandle();
100 base::KillProcess(process_handle, RESULT_CODE_HUNG, false); 101 base::KillProcess(process_handle, RESULT_CODE_HUNG, false);
101 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Hung")); 102 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Hung"));
102 } 103 }
103 104
104 void BrowserPluginGuest::SetIsAcceptingTouchEvents(bool accept) { 105 void BrowserPluginGuest::SetIsAcceptingTouchEvents(bool accept) {
105 SendMessageToEmbedder( 106 SendMessageToEmbedder(
106 new BrowserPluginMsg_ShouldAcceptTouchEvents(instance_id(), accept)); 107 new BrowserPluginMsg_ShouldAcceptTouchEvents(instance_id(), accept));
107 } 108 }
108 109
110 void BrowserPluginGuest::SetVisibility(bool embedder_visible, bool visible) {
111 visible_ = visible;
112 if (embedder_visible && visible)
113 web_contents()->WasShown();
114 else
115 web_contents()->WasHidden();
116 }
117
109 WebContents* BrowserPluginGuest::GetWebContents() { 118 WebContents* BrowserPluginGuest::GetWebContents() {
110 return web_contents(); 119 return web_contents();
111 } 120 }
112 121
113 void BrowserPluginGuest::Terminate() { 122 void BrowserPluginGuest::Terminate() {
114 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Terminate")); 123 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Terminate"));
115 base::ProcessHandle process_handle = 124 base::ProcessHandle process_handle =
116 web_contents()->GetRenderProcessHost()->GetHandle(); 125 web_contents()->GetRenderProcessHost()->GetHandle();
117 base::KillProcess(process_handle, RESULT_CODE_KILLED, false); 126 base::KillProcess(process_handle, RESULT_CODE_KILLED, false);
118 } 127 }
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 break; 384 break;
376 } 385 }
377 } 386 }
378 387
379 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { 388 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) {
380 DCHECK(embedder_render_process_host()); 389 DCHECK(embedder_render_process_host());
381 embedder_render_process_host()->Send(msg); 390 embedder_render_process_host()->Send(msg);
382 } 391 }
383 392
384 } // namespace content 393 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698