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

Side by Side Diff: extensions/browser/extension_web_contents_observer.cc

Issue 2065513004: Expose flash playback status and volume control to content renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@audio_focus_manager
Patch Set: fixed nits for bbudge Created 4 years, 6 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 "extensions/browser/extension_web_contents_observer.h" 5 #include "extensions/browser/extension_web_contents_observer.h"
6 6
7 #include "content/public/browser/child_process_security_policy.h" 7 #include "content/public/browser/child_process_security_policy.h"
8 #include "content/public/browser/navigation_details.h" 8 #include "content/public/browser/navigation_details.h"
9 #include "content/public/browser/render_frame_host.h" 9 #include "content/public/browser/render_frame_host.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 content::RenderFrameHost* render_frame_host) { 173 content::RenderFrameHost* render_frame_host) {
174 bool handled = true; 174 bool handled = true;
175 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM( 175 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(
176 ExtensionWebContentsObserver, message, render_frame_host) 176 ExtensionWebContentsObserver, message, render_frame_host)
177 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) 177 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
178 IPC_MESSAGE_UNHANDLED(handled = false) 178 IPC_MESSAGE_UNHANDLED(handled = false)
179 IPC_END_MESSAGE_MAP() 179 IPC_END_MESSAGE_MAP()
180 return handled; 180 return handled;
181 } 181 }
182 182
183 void ExtensionWebContentsObserver::PepperInstanceCreated() { 183 void ExtensionWebContentsObserver::PepperInstanceCreated(int32_t pp_instance) {
184 if (GetViewType(web_contents()) == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { 184 if (GetViewType(web_contents()) == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
185 ProcessManager* const process_manager = 185 ProcessManager* const process_manager =
186 ProcessManager::Get(browser_context_); 186 ProcessManager::Get(browser_context_);
187 const Extension* const extension = 187 const Extension* const extension =
188 process_manager->GetExtensionForWebContents(web_contents()); 188 process_manager->GetExtensionForWebContents(web_contents());
189 if (extension) 189 if (extension)
190 process_manager->IncrementLazyKeepaliveCount(extension); 190 process_manager->IncrementLazyKeepaliveCount(extension);
191 } 191 }
192 } 192 }
193 193
194 void ExtensionWebContentsObserver::PepperInstanceDeleted() { 194 void ExtensionWebContentsObserver::PepperInstanceDeleted(int32_t pp_instance) {
dcheng 2016/06/14 20:00:32 Do we need to pass pp_instance needed here (and ab
Zhiqiang Zhang (Slow) 2016/06/20 19:11:54 It is needed in a follow-up CL (2060933002), where
dcheng 2016/06/20 19:32:08 OK. This CL is fine, but that one has at least one
Zhiqiang Zhang (Slow) 2016/06/21 17:19:30 Yes, that CL is pretty rough, and there are severa
195 if (GetViewType(web_contents()) == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { 195 if (GetViewType(web_contents()) == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
196 ProcessManager* const process_manager = 196 ProcessManager* const process_manager =
197 ProcessManager::Get(browser_context_); 197 ProcessManager::Get(browser_context_);
198 const Extension* const extension = 198 const Extension* const extension =
199 process_manager->GetExtensionForWebContents(web_contents()); 199 process_manager->GetExtensionForWebContents(web_contents());
200 if (extension) 200 if (extension)
201 process_manager->DecrementLazyKeepaliveCount(extension); 201 process_manager->DecrementLazyKeepaliveCount(extension);
202 } 202 }
203 } 203 }
204 204
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // Since this is called for all existing RenderFrameHosts during the 280 // Since this is called for all existing RenderFrameHosts during the
281 // ExtensionWebContentsObserver's creation, it's possible that not all hosts 281 // ExtensionWebContentsObserver's creation, it's possible that not all hosts
282 // are ready. 282 // are ready.
283 // We only initialize the frame if the renderer counterpart is live; otherwise 283 // We only initialize the frame if the renderer counterpart is live; otherwise
284 // we wait for the RenderFrameCreated notification. 284 // we wait for the RenderFrameCreated notification.
285 if (render_frame_host->IsRenderFrameLive()) 285 if (render_frame_host->IsRenderFrameLive())
286 InitializeRenderFrame(render_frame_host); 286 InitializeRenderFrame(render_frame_host);
287 } 287 }
288 288
289 } // namespace extensions 289 } // namespace extensions
OLDNEW
« content/renderer/render_frame_impl.cc ('K') | « extensions/browser/extension_web_contents_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698